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

west: Question on west flash --hex-file behavior with build.dir-fmt #33498

Closed
erwango opened this issue Mar 19, 2021 · 5 comments
Closed

west: Question on west flash --hex-file behavior with build.dir-fmt #33498

erwango opened this issue Mar 19, 2021 · 5 comments
Assignees
Labels
area: West West utility bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@erwango
Copy link
Member

erwango commented Mar 19, 2021

Describe the bug
Cf related dicussion here

To Reproduce
Steps to reproduce the behavior:
0. Configure dir-fmt as follows
[build]
dir-fmt = build/{board}/

  1. cd samples/tfm_integration/tfm_ipc
  2. west build -b stm32l562e_dk_ns
  3. west flash --hex-file build/stm32l562e_dk_ns/tfm_merged.hex
    Reported error:
FATAL ERROR: --build-dir was not given, /local/mcu/zephyrproject/zephyr/samples/tfm_integration/tfm_ipc is not a build directory and the default build directory cannot be determined. Check your build.dir-fmt configuration option

The equivalent procedure works well w/o dir-fmt configuration

Expected behavior
west flash --hex-file has same behavior whatever dir-fmt configuration.

Impact
Annoying

@erwango erwango added the bug The issue is a bug, or the PR is fixing a bug label Mar 19, 2021
@erwango erwango added priority: low Low impact/importance bug area: West West utility labels Mar 19, 2021
@erwango erwango changed the title west: Question on west flash --hex-file behavior with dir-fmt west: Question on west flash --hex-file behavior with build.dir-fmt Mar 19, 2021
@mbolivar-nordic
Copy link
Contributor

I don't think this is a bug. West should not guess which build directory you are using IMO.

You can try using build.guess-dir which will work in some situations if the build directory can be guessed unambiguously. But it's not clear that we can just start at the hex file location and assume it's in a build directory, I think.

@erwango
Copy link
Member Author

erwango commented Mar 31, 2021

@mbolivar-nordic My request is not to ask west to guess the location in current case (at least this is not my understanding):
Observation is that the following works:

$ west flash --hex-file build/tfm_merged.hex

But the following reports an error, while the file location is given in the same way

$ west flash --hex-file build/stm32l562e_dk_ns/tfm_merged.hex
FATAL ERROR: --build-dir was not given, /local/mcu/zephyrproject/zephyr/samples/tfm_integration/tfm_ipc is not a build directory and the default build directory cannot be determined. Check your build.dir-fmt configuration option

@mbolivar-nordic
Copy link
Contributor

mbolivar-nordic commented Mar 31, 2021

The first example looks like build.dir-fmt is not set, and therefore the default build directory build can be checked and used if it exists.

The second example seems to be using build.dir-fmt, so there is no single default location. It could be build/my-board or build/my-other-board. West has to guess in this case; which you can ask it to do with build.guess-dir; but that won't always work.

@erwango
Copy link
Member Author

erwango commented Apr 1, 2021

Ok, I had a try using west flash -d build/nucleo_l552ze_q_ns/ --hex-file build/nucleo_l552ze_q_ns/tfm_merged.hex .
This works indeed. Thanks for the support.

@erwango erwango closed this as completed Apr 1, 2021
@mbolivar-nordic
Copy link
Contributor

I had a try using west flash -d build/nucleo_l552ze_q_ns/ --hex-file build/nucleo_l552ze_q_ns/tfm_merged.hex .
This works indeed.

I know that's kind of pain to specify twice but I don't see a good way to avoid it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: West West utility bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants