Skip to content

Commit e4479e2

Browse files
mbolivar-nordicjhedberg
authored andcommitted
cmake: flash: three runners.yaml fixes
There are two problems with the way runners.yaml is being created: 1. The dictionary which contains the arguments for each runner is using the runner's name converted to a C identifier instead of the runner's name itself. That causes west flash to fail when the two are different, e.g. for 'misc-flasher' (runner name), which is different than 'misc_flasher' (runner name as C identifier) 2. We need to make sure that the dictionary key maps to an empty list if there are no arguments, which normally doesn't happen since the runner usually at least takes the path of the file to flash or debug. It does happen in the case of misc-flasher, though, since the whole point of that runner is that it's an escape hatch for people with out of tree scripts that nevertheless want 'west flash' integration for things like sanitycheck device testing. 3. A copy/paste error is setting the debug runner to the flash runner. Fix them all. Fixes: #23004 Signed-off-by: Martí Bolívar <[email protected]>
1 parent 0d47d1e commit e4479e2

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

cmake/flash/CMakeLists.txt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ flash-runner: ${BOARD_FLASH_RUNNER}
2727
string(APPEND yaml_contents "\
2828
2929
# Default debug runner if --runner is not given.
30-
debug-runner: ${BOARD_FLASH_RUNNER}
30+
debug-runner: ${BOARD_DEBUG_RUNNER}
3131
")
3232
endif()
3333

@@ -69,14 +69,21 @@ args:
6969
foreach(runner ${runners})
7070
string(MAKE_C_IDENTIFIER ${runner} runner_id)
7171
string(APPEND yaml_contents "\
72-
${runner_id}:
73-
")
72+
${runner}:")
7473
get_property(args GLOBAL PROPERTY "BOARD_RUNNER_ARGS_${runner_id}")
75-
foreach(arg ${args})
76-
string(APPEND yaml_contents "\
77-
- ${arg}
74+
if(args)
75+
# Usually, the runner has arguments. Append them to runners.yaml,
76+
# one per line.
77+
string(APPEND yaml_contents "\n")
78+
foreach(arg ${args})
79+
string(APPEND yaml_contents "\
80+
- ${arg}
7881
")
79-
endforeach()
82+
endforeach()
83+
else()
84+
# If the runner doesn't need any arguments, just use an empty list.
85+
string(APPEND yaml_contents " []\n")
86+
endif()
8087
endforeach()
8188

8289
# Write the final contents and set its location in the cache.

0 commit comments

Comments
 (0)