runners: uf2: accept and warn on --dev-id#107145
runners: uf2: accept and warn on --dev-id#107145YumTaha wants to merge 1 commit intozephyrproject-rtos:mainfrom
Conversation
|
Hello @YumTaha, and thank you very much for your first pull request to the Zephyr project! |
There was a problem hiding this comment.
Great analysis and excellent commit message, thanks!
As the two bugs seem completely unrelated to each other, would you mind splitting this into two different commits? Single PR; it's small enough.
The nRF Connect VS Code extension unconditionally appends -i/--dev-id
to west flash for any detected Nordic device, regardless of runner.
UF2BinaryRunner.capabilities() did not declare dev_id=True, causing
the base-class guard to abort before any flashing occurred. [...]
Declare dev_id=True so the argument is accepted and silently ignored.
Silently discarding inputs is often puzzling and time-consuming and TBH this sounds like a (harmless) nRF connect bug. Is there a good place where you could add something like this?
if args.id: # see bug http:/.../107128
self.logger.warning("Discarding spurious --dev-id {x}")
Or at least a self.logger.info()
The nRF Connect VS Code extension unconditionally appends -i/--dev-id to west flash for any detected Nordic device, regardless of runner. UF2BinaryRunner.capabilities() did not declare dev_id=True, causing the base-class guard to abort before any flashing occurred. UF2 flashing is connectionless; do_create() reads only args.board_id. Declare dev_id=True so the argument is accepted, and emit a warning so users know it has no effect on target selection. Fixes zephyrproject-rtos#107128 Signed-off-by: Taha Momayiz <momayita@mail.uc.edu>
|
Sure, splitting into two commits and adding a warning log for the discarded |
47cc376 to
c8ac077
Compare
@carlescufi could other runners be impacted as well? |
If a significant number of other runners are affected, then it would be a tedious and unreliable game of whack-a-mole to add a workaround in all of them - as opposed to making the VS Code extension smarter? Or should Zephyr just give up and make it mandatory for all runners to accept (and possibly: ignore) |
|
Removing the |
|
Up to you @YumTaha but... if you submit the unrelated EDIT: |
|
Alright, I will make a new PR for the |
c8ac077 to
8a3ec3d
Compare
|
|
Self-assigning this, will take a look |
Just looked at runners.yaml and as far as I can see it does not contain any information of the capabilities. If tools such the VS Code extension need to made smarted, the it need a way to query the runners capabilities to determine that |
That's not what I meant when I wrote "smarter", sorry about the confusion. I meant: "better educated" and knowledgeable about which hardware types support multiple instances versus not. But maybe the real issue is this, sorry I missed it until now:
I feel like higher-level users like VS Code should not care about such low-level implementation details. In other words, UF2 should accept |
I agree fully with this! |
mbolivar
left a comment
There was a problem hiding this comment.
I think this should not be merged as-is but won't block.
In my opinion, the "device ID" in this board context seems to be easy to handle: take the name of the partition you want to flash to, or something like that.
--dev-id is a runner capability meaning "I can take an additional argument that lets you pick one of multiple boards that are currently attached to the host for me to work on".
Looking at the source code for this runner, it seems like partitions[0] is the hard-coded assumption there, and the runner could instead check to see if the --dev-id argument is somehow "in the list" and use that instead of defaulting to whatever gets found first, no?




Fixes #107128
The nRF Connect VS Code extension unconditionally appends
-i <serial>towest flashfor any detected Nordic device, regardless of which runner is selected.UF2BinaryRunner.capabilities()did not declaredev_id=True, causing the base-class guard inZephyrBinaryRunner.create()to abort with a fatal error before any flashing occurred.UF2 flashing is connectionless — the runner identifies the target drive via
INFO_UF2.TXT(--board-id) and copies a file.do_create()only readsargs.board_id. Declaredev_id=Trueso the argument is accepted, and emit a warning so users know it has no effect on target selection.Changes
scripts/west_commands/runners/uf2.pycapabilities(): adddev_id=TruetoRunnerCaps__init__(): adddev_idparameterdo_create(): passdev_id=args.dev_idthroughdo_run(): warn when--dev-idis provided and ignoredTesting
Tested on Windows 11, Seeed XIAO nRF52840, nRF Connect SDK v3.2.4, nRF Connect VS Code extension.
west flash -i F3ADA8E6C5AA9120previously aborted immediately; now completes with the expected warning: