Skip to content

Commit 2651fd8

Browse files
[nrf noup] generate PERIPHCONF c file from regtool UICR hex
Only for testing on CI. Signed-off-by: Jonathan Nilsen <[email protected]>
1 parent ca545eb commit 2651fd8

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ function(nrf_regtool_generate_uicr generated_hex_file)
1414
COMMAND_ERROR_IS_FATAL ANY
1515
)
1616
message(STATUS "Generated UICR hex file: ${generated_hex_file}")
17+
18+
if(CONFIG_SOC_NRF54H20_IRON)
19+
execute_process(
20+
COMMAND
21+
${CMAKE_COMMAND} -E env PYTHONPATH=${ZEPHYR_BASE}/scripts/dts/python-devicetree/src
22+
${NRF_REGTOOL} ${verbosity} uicr-migrate
23+
--uicr-hex-file ${generated_hex_file}
24+
--edt-pickle-file ${EDT_PICKLE}
25+
--output-periphconf-file ${PROJECT_BINARY_DIR}/periphconf_migrated.c
26+
WORKING_DIRECTORY ${APPLICATION_SOURCE_DIR}
27+
COMMAND_ERROR_IS_FATAL ANY
28+
)
29+
set_property(GLOBAL APPEND PROPERTY GENERATED_APP_SOURCE_FILES
30+
${PROJECT_BINARY_DIR}/periphconf_migrated.c
31+
)
32+
endif()
1733
endfunction()
1834

1935
function(nrf_regtool_generate_peripheral peripheral generated_hex_file)
@@ -41,23 +57,29 @@ get_property(version GLOBAL PROPERTY nrf_regtool_version)
4157

4258
foreach(component IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
4359
if(component STREQUAL "GENERATE:UICR")
44-
set(generated_hex_file ${PROJECT_BINARY_DIR}/uicr.hex)
60+
if(NOT CONFIG_SOC_NRF54H20_IRON)
61+
set(generated_hex_file ${PROJECT_BINARY_DIR}/uicr.hex)
62+
else()
63+
# need a different name than the other one
64+
set(generated_hex_file ${PROJECT_BINARY_DIR}/uicr_regtool.hex)
65+
endif()
4566
if(version VERSION_GREATER_EQUAL 7.0.0)
4667
nrf_regtool_generate_uicr(${generated_hex_file})
4768
else()
4869
nrf_regtool_generate_peripheral(UICR ${generated_hex_file})
4970
endif()
5071

51-
# UICR must be flashed together with the Zephyr binary.
52-
set(merged_hex_file ${PROJECT_BINARY_DIR}/uicr_merged.hex)
53-
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
54-
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/mergehex.py
55-
-o ${merged_hex_file}
56-
${generated_hex_file}
57-
${PROJECT_BINARY_DIR}/${KERNEL_HEX_NAME}
58-
)
59-
set_property(TARGET runners_yaml_props_target PROPERTY hex_file ${merged_hex_file})
60-
72+
if(NOT CONFIG_SOC_NRF54H20_IRON)
73+
# UICR must be flashed together with the Zephyr binary.
74+
set(merged_hex_file ${PROJECT_BINARY_DIR}/uicr_merged.hex)
75+
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
76+
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/mergehex.py
77+
-o ${merged_hex_file}
78+
${generated_hex_file}
79+
${PROJECT_BINARY_DIR}/${KERNEL_HEX_NAME}
80+
)
81+
set_property(TARGET runners_yaml_props_target PROPERTY hex_file ${merged_hex_file})
82+
endif()
6183
else()
6284
message(FATAL_ERROR "Unrecognized package component: \"${component}\"")
6385
endif()

0 commit comments

Comments
 (0)