Use openocd provided by CIPD

Updates Pigweed tools to use OpenOCD provided by CIPD.

Change-Id: Iea80343373bc5d36d223dd327b854e89ee9e274a
This commit is contained in:
Armando Montanez 2019-12-03 11:03:22 -08:00
parent 956ea9dd52
commit 47b0c5c1cd
3 changed files with 15 additions and 3 deletions

View File

@ -41,6 +41,9 @@ fuchsia/third_party/bazel/${platform} version:0.25.1
# Bloaty (Embedded Fork)
pigweed/third_party/bloaty-embedded/${platform} git_revision:551e70f736e0dc40184c568095b25851f62ea0db
# OpenOCD
pigweed/third_party/openocd/${platform} git_revision:646566e006acd58fb9ac405511d3ecca79f26d55
# GCC ARM None EABI
pigweed/third_party/gcc-arm-none-eabi/${platform} version:9-2019-q4-major

View File

@ -78,6 +78,8 @@ def update(argv=None):
prefix='cipdsetup') as temp:
print('PATH="{}"'.format(os.pathsep.join(paths)), file=temp)
print('export PATH', file=temp)
print('CIPD_INSTALL_DIR="{}"'.format(args.install_dir), file=temp)
print('export CIPD_INSTALL_DIR', file=temp)
print('. {}'.format(temp.name))

View File

@ -27,6 +27,10 @@ _DIR = os.path.dirname(__file__)
# Path to default openocd configuration file.
_OPENOCD_CONFIG = os.path.join(_DIR, 'openocd_stm32f4xx.cfg')
# Path to scripts provided by openocd.
_OPENOCD_SCRIPTS_DIR = os.path.join(os.getenv('CIPD_INSTALL_DIR'), 'share',
'openocd', 'scripts')
_LOG = logging.getLogger('unit_test_runner')
# Verification of test pass/failure depends on these strings. If the formatting
@ -89,8 +93,8 @@ def reset_device(openocd_config):
flash_tool = os.getenv('OPENOCD_PATH', default_flasher)
cmd = [
flash_tool, '-f', openocd_config, '-c', 'init', '-c', 'reset run',
'-c', 'exit'
flash_tool, '-s', _OPENOCD_SCRIPTS_DIR, '-f', openocd_config, '-c',
'init', '-c', 'reset run', '-c', 'exit'
]
_LOG.debug('Resetting device')
@ -155,7 +159,10 @@ def flash_device(binary, openocd_config):
flash_tool = os.getenv('OPENOCD_PATH', default_flasher)
openocd_command = ' '.join(['program', binary, 'reset', 'exit'])
cmd = [flash_tool, '-f', openocd_config, '-c', openocd_command]
cmd = [
flash_tool, '-s', _OPENOCD_SCRIPTS_DIR, '-f', openocd_config, '-c',
openocd_command
]
_LOG.info('Flashing firmware to device')
process = subprocess.run(cmd,