mirror of https://github.com/ARMmbed/mbed-os.git
Added to switch -c option 'eACommander' and 'eACommander-usb'
Added to switch --reset-type option 'eACommander' and 'eACommander-usb'pull/475/head
parent
ff9252a247
commit
e25ffc7856
|
@ -27,6 +27,10 @@ from optparse import OptionParser
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
|
||||||
|
import sys
|
||||||
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||||
|
from private_settings import EACOMMANDER_CMD
|
||||||
|
|
||||||
class Mbed:
|
class Mbed:
|
||||||
""" Base class for a host driven test
|
""" Base class for a host driven test
|
||||||
"""
|
"""
|
||||||
|
@ -166,16 +170,48 @@ class Mbed:
|
||||||
sleep(1)
|
sleep(1)
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
""" Reset function. Supports 'standard' send break command via Mbed's CDC,
|
""" Reset function.
|
||||||
also handles other reset modes.
|
Supports:
|
||||||
E.g. reset by touching file with specific file name:
|
- 'standard' send break command via Mbed's CDC,
|
||||||
reboot.txt - startup from standby state, reboots when in run mode.
|
- also handles other reset modes:
|
||||||
shutdown.txt - shutdown from run mode
|
- E.g. reset by touching file with specific file name:
|
||||||
reset.txt - reset FPGA during run mode
|
reboot.txt - startup from standby state, reboots when in run mode.
|
||||||
|
shutdown.txt - shutdown from run mode
|
||||||
|
reset.txt - reset FPGA during run mode
|
||||||
|
- eACommander for reset of SiLabs Gecko baords.
|
||||||
"""
|
"""
|
||||||
if self.options.forced_reset_type and self.options.forced_reset_type.endswith('.txt'):
|
if self.options.forced_reset_type:
|
||||||
reset_file_path = os.path.join(self.disk, self.options.forced_reset_type.lower())
|
if self.options.forced_reset_type == 'eACommander':
|
||||||
self.touch_file(reset_file_path)
|
# For this copy method 'disk' will be 'serialno' for eACommander command line parameters
|
||||||
|
# Note: Commands are executed in the order they are specified on the command line
|
||||||
|
cmd = [EACOMMANDER_CMD,
|
||||||
|
'--serialno', self.disk.rstrip('/\\'),
|
||||||
|
'--resettype', '2', '--reset',]
|
||||||
|
try:
|
||||||
|
ret = call(cmd, shell=True)
|
||||||
|
if ret:
|
||||||
|
resutl_msg = "Return code: %d. Command: "% ret + " ".join(cmd)
|
||||||
|
result = False
|
||||||
|
except Exception, e:
|
||||||
|
resutl_msg = e
|
||||||
|
result = False
|
||||||
|
elif self.options.forced_reset_type == 'eACommander-usb':
|
||||||
|
# For this copy method 'disk' will be 'usb address' for eACommander command line parameters
|
||||||
|
# Note: Commands are executed in the order they are specified on the command line
|
||||||
|
cmd = [EACOMMANDER_CMD,
|
||||||
|
'--usb', self.disk.rstrip('/\\'),
|
||||||
|
'--resettype', '2', '--reset',]
|
||||||
|
try:
|
||||||
|
ret = call(cmd, shell=True)
|
||||||
|
if ret:
|
||||||
|
resutl_msg = "Return code: %d. Command: "% ret + " ".join(cmd)
|
||||||
|
result = False
|
||||||
|
except Exception, e:
|
||||||
|
resutl_msg = e
|
||||||
|
result = False
|
||||||
|
elif self.options.forced_reset_type.endswith('.txt'):
|
||||||
|
reset_file_path = os.path.join(self.disk, self.options.forced_reset_type.lower())
|
||||||
|
self.touch_file(reset_file_path)
|
||||||
else:
|
else:
|
||||||
self.safe_sendBreak(self.serial) # Instead of serial.sendBreak()
|
self.safe_sendBreak(self.serial) # Instead of serial.sendBreak()
|
||||||
# Give time to wait for the image loading
|
# Give time to wait for the image loading
|
||||||
|
|
|
@ -593,6 +593,20 @@ class SingleTestRunner(object):
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
resutl_msg = e
|
resutl_msg = e
|
||||||
result = False
|
result = False
|
||||||
|
elif copy_method == 'eACommander-usb':
|
||||||
|
# For this copy method 'disk' will be 'usb address' for eACommander command line parameters
|
||||||
|
# Note: Commands are executed in the order they are specified on the command line
|
||||||
|
cmd = [EACOMMANDER_CMD,
|
||||||
|
'--usb', disk.rstrip('/\\'),
|
||||||
|
'--flash', image_path.encode('ascii', 'ignore')]
|
||||||
|
try:
|
||||||
|
ret = call(cmd, shell=True)
|
||||||
|
if ret:
|
||||||
|
resutl_msg = "Return code: %d. Command: "% ret + " ".join(cmd)
|
||||||
|
result = False
|
||||||
|
except Exception, e:
|
||||||
|
resutl_msg = e
|
||||||
|
result = False
|
||||||
else:
|
else:
|
||||||
copy_method = "shutils.copy()"
|
copy_method = "shutils.copy()"
|
||||||
# Default python method
|
# Default python method
|
||||||
|
|
Loading…
Reference in New Issue