Maxim Integrated's IoT development kit
Dependencies: MAX30101 MAX30003 MAX113XX_Pixi MAX30205 max32630fthr USBDevice
tools/mbed_run.py@16:503f8308e2db, 2018-07-19 (annotated)
- Committer:
- Mahir Ozturk
- Date:
- Thu Jul 19 18:27:45 2018 +0300
- Revision:
- 16:503f8308e2db
- Parent:
- 1:efe9cad8942f
Update mbed-os to fix the bug: Symbol __user_perthread_libspace multiply defined
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mahir Ozturk |
1:efe9cad8942f | 1 | import sys |
Mahir Ozturk |
1:efe9cad8942f | 2 | import mbed_lstools |
Mahir Ozturk |
1:efe9cad8942f | 3 | import serial |
Mahir Ozturk |
1:efe9cad8942f | 4 | from shutil import copy |
Mahir Ozturk |
1:efe9cad8942f | 5 | |
Mahir Ozturk |
1:efe9cad8942f | 6 | bin_file=sys.argv[1] |
Mahir Ozturk |
1:efe9cad8942f | 7 | |
Mahir Ozturk |
1:efe9cad8942f | 8 | mbeds = mbed_lstools.create() |
Mahir Ozturk |
1:efe9cad8942f | 9 | m=mbeds.list_mbeds() |
Mahir Ozturk |
1:efe9cad8942f | 10 | |
Mahir Ozturk |
1:efe9cad8942f | 11 | if len(m) == 0: |
Mahir Ozturk |
1:efe9cad8942f | 12 | print "No mbed device detected" |
Mahir Ozturk |
1:efe9cad8942f | 13 | sys.exit(1) |
Mahir Ozturk |
1:efe9cad8942f | 14 | |
Mahir Ozturk |
1:efe9cad8942f | 15 | #print "Detected mbed devices: " |
Mahir Ozturk |
1:efe9cad8942f | 16 | #print m |
Mahir Ozturk |
1:efe9cad8942f | 17 | |
Mahir Ozturk |
1:efe9cad8942f | 18 | #Select first mbed device |
Mahir Ozturk |
1:efe9cad8942f | 19 | target_mbed=m[0] |
Mahir Ozturk |
1:efe9cad8942f | 20 | target_mount_point=target_mbed['mount_point'] |
Mahir Ozturk |
1:efe9cad8942f | 21 | target_platform_name=target_mbed['platform_name'] |
Mahir Ozturk |
1:efe9cad8942f | 22 | target_serial_port=target_mbed['serial_port'] |
Mahir Ozturk |
1:efe9cad8942f | 23 | |
Mahir Ozturk |
1:efe9cad8942f | 24 | print "Detected mbed device:" |
Mahir Ozturk |
1:efe9cad8942f | 25 | if target_platform_name: |
Mahir Ozturk |
1:efe9cad8942f | 26 | print " Platform name: " + target_platform_name |
Mahir Ozturk |
1:efe9cad8942f | 27 | print " Mount point: " + target_mount_point |
Mahir Ozturk |
1:efe9cad8942f | 28 | print " Serial port: " + target_serial_port |
Mahir Ozturk |
1:efe9cad8942f | 29 | |
Mahir Ozturk |
1:efe9cad8942f | 30 | |
Mahir Ozturk |
1:efe9cad8942f | 31 | print "Copy " + bin_file + " -> " + target_mount_point |
Mahir Ozturk |
1:efe9cad8942f | 32 | copy(bin_file, target_mount_point) |
Mahir Ozturk |
1:efe9cad8942f | 33 | |
Mahir Ozturk |
1:efe9cad8942f | 34 | try: |
Mahir Ozturk |
1:efe9cad8942f | 35 | ser = serial.Serial(target_serial_port, 115200) |
Mahir Ozturk |
1:efe9cad8942f | 36 | ser.send_break() |
Mahir Ozturk |
1:efe9cad8942f | 37 | ser.close() |
Mahir Ozturk |
1:efe9cad8942f | 38 | except Exception as e: |
Mahir Ozturk |
1:efe9cad8942f | 39 | #print e |
Mahir Ozturk |
1:efe9cad8942f | 40 | pass |