Skip to content

Commit 6ede43b

Browse files
jeremybettiscarlescufi
authored andcommitted
npcx: Set hex_file automatically w/ npcx hex image
When using CONFIG_NPCX_IMAGE_OUTPUT_HEX, set the hex_file runners_yaml_props_target property, so that west flash will flash the correct file. Change the cmake flash rules to populate the hex_file value in the runners.yaml file if either CONFIG_BUILD_OUTPUT_HEX is enabled or some cmake file set the runners_yaml_props_target hex_file property. Update the npcx9m6f_evb instructions now that the filename is implicit. Signed-off-by: Jeremy Bettis <[email protected]>
1 parent 27820e9 commit 6ede43b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

boards/arm/npcx9m6f_evb/doc/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ Build and flash the blinky sample.::
118118

119119
west build -t clean && \
120120
west build -c -p auto -b npcx9m6f_evb samples/basic/blinky && \
121-
west flash --hex-file build/zephyr/zephyr.npcx.hex \
122-
--openocd /usr/local/bin/openocd --openocd-search /usr/local/share/openocd/scripts
121+
west flash --openocd /usr/local/bin/openocd
123122

124123
Debugging
125124
=========

cmake/flash/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ function(runners_yaml_append_config)
3838
runners_yaml_append(" elf_file: ${elf}")
3939
if(CONFIG_BUILD_OUTPUT_HEX)
4040
get_runners_prop(hex_file hex "${KERNEL_HEX_NAME}")
41+
else()
42+
get_runners_prop(hex_file hex "")
43+
endif()
44+
if(hex)
4145
runners_yaml_append(" hex_file: ${hex}")
4246
endif()
4347
if(CONFIG_BUILD_OUTPUT_BIN)

soc/arm/nuvoton_npcx/common/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ if (DEFINED CONFIG_NPCX_IMAGE_OUTPUT_BIN)
3232
)
3333
if (DEFINED CONFIG_NPCX_IMAGE_OUTPUT_HEX)
3434
set(NPCX_HEX_NAME ${CONFIG_KERNEL_BIN_NAME}.npcx.hex)
35+
# Property magic which makes west flash choose right file.
36+
set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CONFIG_KERNEL_BIN_NAME}.npcx.hex")
3537
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
3638
COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command>
3739
$<TARGET_PROPERTY:bintools,elfconvert_flag>

0 commit comments

Comments
 (0)