Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default runners to west config #77849

Open
glenn-andrews opened this issue Aug 31, 2024 · 8 comments
Open

Add default runners to west config #77849

glenn-andrews opened this issue Aug 31, 2024 · 8 comments
Labels
area: West West utility Enhancement Changes/Updates/Additions to existing features

Comments

@glenn-andrews
Copy link
Collaborator

glenn-andrews commented Aug 31, 2024

Is your enhancement proposal related to a problem? Please describe.
If you do not have the same runner on your board as the default in board.cmake you need to supply the alternative each time.

Describe the solution you'd like

  1. west config options to set the default west flash and west debug runners that override those in board.cmake.
  2. Supplying a --runner option to the west command would override the default, as it does for the default in board.cmake.
  3. Setting the configuration option to default (or the option being missing) would revert to the default in board.cmake.

Describe alternatives you've considered
Different defaults per board would be nice, but hugely complicated to maintain and administer.

Additional context
Prompted by #75284 as it changes the runner, and anyone who does not download the ST software will have to add --runner openocd to their commands.

@glenn-andrews glenn-andrews added the Enhancement Changes/Updates/Additions to existing features label Aug 31, 2024
@henrikbrixandersen
Copy link
Member

Do you know you can set -DBOARD_FLASH_RUNNER=... and/or -DBOARD_DEBUG_RUNNER=... when invoking west?

@henrikbrixandersen henrikbrixandersen added the area: West West utility label Sep 2, 2024
@pdgendt
Copy link
Collaborator

pdgendt commented Sep 2, 2024

The proposed west aliases in zephyrproject-rtos/west#716 can be useful in this case too:

west config alias.flash "flash --runner=openocd"
west config alias.debug "debug --runner=openocd"

@glenn-andrews
Copy link
Collaborator Author

glenn-andrews commented Sep 2, 2024

The proposed west aliases in zephyrproject-rtos/west#716 can be useful in this case too:

west config alias.flash "flash --runner=openocd"
west config alias.debug "debug --runner=openocd"

That would do nicely.

Can you override the alias?

@glenn-andrews
Copy link
Collaborator Author

Do you know you can set -DBOARD_FLASH_RUNNER=... and/or -DBOARD_DEBUG_RUNNER=... when invoking west?

That seems to just move the problem from having to remember to set it during debug to having to remember to set it during build.

I'm thinking of a situation where I'm working in an STM32 shop and in my daily life I'll always be using a specific tool, or I'm a student with an STM32 development board and don't want to remember specify the assignment-recommended runner for every exercise.

In these situations you want a set-it-and-forget it option for 99% of your work, with an easy override for when you need something different.

@pdgendt
Copy link
Collaborator

pdgendt commented Sep 2, 2024

Can you override the alias?

What do you mean? You can override a command with an alias, if that is what you mean.

@pdgendt
Copy link
Collaborator

pdgendt commented Sep 2, 2024

To try it out:

$ pip uninstall west
$ pip install https://github.com/zephyrproject-rtos/west/archive/pull/716/head.zip

@glenn-andrews
Copy link
Collaborator Author

Can you override the alias?

What do you mean? You can override a command with an alias, if that is what you mean.

I mean if I did west config alias.debug "debug --runner=openocd" but then for just one test needed to use J-Link, could I do west debug --runner=jlink or would the alias expand to west debug --runner=openocd --runner=jlinkand break because of two runners specified?

@pdgendt
Copy link
Collaborator

pdgendt commented Sep 2, 2024

I mean if I did west config alias.debug "debug --runner=openocd" but then for just one test needed to use J-Link, could I do west debug --runner=jlink or would the alias expand to west debug --runner=openocd --runner=jlinkand break because of two runners specified?

It will expand to west debug --runner=openocd --runner=jlink which should actually work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: West West utility Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

3 participants