From 47b0c5c1cd5852a2d34e5b86d3e73238355f80c2 Mon Sep 17 00:00:00 2001 From: Armando Montanez Date: Tue, 3 Dec 2019 11:03:22 -0800 Subject: [PATCH] Use openocd provided by CIPD Updates Pigweed tools to use OpenOCD provided by CIPD. Change-Id: Iea80343373bc5d36d223dd327b854e89ee9e274a --- env_setup/cipd/ensure_file | 3 +++ env_setup/cipd/update.py | 2 ++ .../py/stm32f429i_disc1_utils/unit_test_runner.py | 13 ++++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/env_setup/cipd/ensure_file b/env_setup/cipd/ensure_file index 6a592732f..3b1cc2d65 100644 --- a/env_setup/cipd/ensure_file +++ b/env_setup/cipd/ensure_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 diff --git a/env_setup/cipd/update.py b/env_setup/cipd/update.py index 8c9690c71..969916894 100755 --- a/env_setup/cipd/update.py +++ b/env_setup/cipd/update.py @@ -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)) diff --git a/targets/stm32f429i-disc1/py/stm32f429i_disc1_utils/unit_test_runner.py b/targets/stm32f429i-disc1/py/stm32f429i_disc1_utils/unit_test_runner.py index 361076f06..a3698f673 100755 --- a/targets/stm32f429i-disc1/py/stm32f429i_disc1_utils/unit_test_runner.py +++ b/targets/stm32f429i-disc1/py/stm32f429i_disc1_utils/unit_test_runner.py @@ -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,