Skip to content

Commit

Permalink
[microTVM] Zephyr: implement 'west_cmd' server option
Browse files Browse the repository at this point in the history
Currently Zephyr Project API server lists option 'west_cmd' as an
option available in Zephyr platform by advertising it in PROJECT_OPTIONS
but that option is not used by any API method.

That commit adds that option to the server as a non-required option to
the flash() interface method, allowing the user to specify an
alternative path to the west tool. If that option is not specified the
Zephyr build system takes care of searching for west as a module (so
relying on West being available on Python, i.e. relying on
'python3 -m west').

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
  • Loading branch information
gromero committed Sep 6, 2021
1 parent 0744641 commit 4bd1c0d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/microtvm/zephyr/template_project/microtvm_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,11 @@ def flash(self, options):
recover_args.extend(_get_nrf_device_args(options))
check_call(recover_args, cwd=API_SERVER_DIR / "build")

if "west_cmd" in options:
west_cmd = options["west_cmd"]
cmake_args = ["cmake", "..", f"-DWEST={west_cmd}"]
check_call(cmake_args, cwd=API_SERVER_DIR / "build")

check_call(["make", "flash"], cwd=API_SERVER_DIR / "build")

def open_transport(self, options):
Expand Down

0 comments on commit 4bd1c0d

Please sign in to comment.