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 <jbettis@google.com>
This commit is contained in:
Jeremy Bettis 2022-06-16 16:34:33 -06:00 committed by Carles Cufí
commit 6ede43b078
3 changed files with 7 additions and 2 deletions

View file

@ -118,8 +118,7 @@ Build and flash the blinky sample.::
west build -t clean && \
west build -c -p auto -b npcx9m6f_evb samples/basic/blinky && \
west flash --hex-file build/zephyr/zephyr.npcx.hex \
--openocd /usr/local/bin/openocd --openocd-search /usr/local/share/openocd/scripts
west flash --openocd /usr/local/bin/openocd
Debugging
=========

View file

@ -38,6 +38,10 @@ function(runners_yaml_append_config)
runners_yaml_append(" elf_file: ${elf}")
if(CONFIG_BUILD_OUTPUT_HEX)
get_runners_prop(hex_file hex "${KERNEL_HEX_NAME}")
else()
get_runners_prop(hex_file hex "")
endif()
if(hex)
runners_yaml_append(" hex_file: ${hex}")
endif()
if(CONFIG_BUILD_OUTPUT_BIN)

View file

@ -32,6 +32,8 @@ if (DEFINED CONFIG_NPCX_IMAGE_OUTPUT_BIN)
)
if (DEFINED CONFIG_NPCX_IMAGE_OUTPUT_HEX)
set(NPCX_HEX_NAME ${CONFIG_KERNEL_BIN_NAME}.npcx.hex)
# Property magic which makes west flash choose right file.
set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CONFIG_KERNEL_BIN_NAME}.npcx.hex")
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND $<TARGET_PROPERTY:bintools,elfconvert_command>
$<TARGET_PROPERTY:bintools,elfconvert_flag>