Skip to content

Commit 1b9abdc

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 26e37f9 commit 1b9abdc

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_iron_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ CONFIG_EXTERNAL_CACHE=y
2626
CONFIG_GPIO=y
2727

2828
# UICR generation is not supported, and when reintroduced will not use nrf-regtool.
29-
CONFIG_NRF_REGTOOL_GENERATE_UICR=n
29+
# CONFIG_NRF_REGTOOL_GENERATE_UICR=n

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

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ 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+
execute_process(
19+
COMMAND
20+
${CMAKE_COMMAND} -E env PYTHONPATH=${ZEPHYR_BASE}/scripts/dts/python-devicetree/src
21+
${NRF_REGTOOL} ${verbosity} uicr-migrate
22+
--uicr-hex-file ${generated_hex_file}
23+
--edt-pickle-file ${EDT_PICKLE}
24+
--output-periphconf-file ${PROJECT_BINARY_DIR}/periphconf_migrated.c
25+
WORKING_DIRECTORY ${APPLICATION_SOURCE_DIR}
26+
COMMAND_ERROR_IS_FATAL ANY
27+
)
28+
set_property(GLOBAL APPEND PROPERTY GENERATED_APP_SOURCE_FILES
29+
${PROJECT_BINARY_DIR}/periphconf_migrated.c
30+
)
1731
endfunction()
1832

1933
function(nrf_regtool_generate_peripheral peripheral generated_hex_file)
@@ -41,23 +55,24 @@ get_property(version GLOBAL PROPERTY nrf_regtool_version)
4155

4256
foreach(component IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
4357
if(component STREQUAL "GENERATE:UICR")
44-
set(generated_hex_file ${PROJECT_BINARY_DIR}/uicr.hex)
58+
set(generated_hex_file ${PROJECT_BINARY_DIR}/uicr_regtool.hex)
4559
if(version VERSION_GREATER_EQUAL 7.0.0)
4660
nrf_regtool_generate_uicr(${generated_hex_file})
4761
else()
4862
nrf_regtool_generate_peripheral(UICR ${generated_hex_file})
4963
endif()
5064

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-
65+
if(NOT CONFIG_SOC_NRF54H20_IRON)
66+
# UICR must be flashed together with the Zephyr binary.
67+
set(merged_hex_file ${PROJECT_BINARY_DIR}/uicr_merged.hex)
68+
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
69+
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/mergehex.py
70+
-o ${merged_hex_file}
71+
${generated_hex_file}
72+
${PROJECT_BINARY_DIR}/${KERNEL_HEX_NAME}
73+
)
74+
set_property(TARGET runners_yaml_props_target PROPERTY hex_file ${merged_hex_file})
75+
endif()
6176
else()
6277
message(FATAL_ERROR "Unrecognized package component: \"${component}\"")
6378
endif()

0 commit comments

Comments
 (0)