Skip to content

Commit 3ba9729

Browse files
[nrf fromlist] soc: nordic: nrf54h: generate PERIPHCONF entries based on devicetree
Upstream PR #: 95915 Add build system support for populating the PERIPHCONF (global domain peripheral configuration), based on nodes and properties found in the devicetree. This should make it so all samples and tests that were broken by the move to IronSide SE now function correctly without workarounds or manual steps. When enabled, a new python script called gen_periphconf_entries.py is run when building. The script iterates over nodes and properties in the devicetree and generates a C file called periphconf_entries_generated.c in the build directory, which is added as a source file. The C file uses the macros from uicr.h to configure the global domain according to the devicetree. The PERIPHCONF entry generation is enabled by default when building for nrf54h20dk/nrf54h20/cpuapp and nrf54h20dk/nrf54h20/cpurad. It will also be used on nrf9280 soon, therefore it is placed in the common uicr directory. This new feature does the same job as nrf-regtool did when building for nrf54h20 before, and is compatible by the bindings that were used by nrf-regtool. Signed-off-by: Jonathan Nilsen <[email protected]>
1 parent 44b9823 commit 3ba9729

File tree

6 files changed

+2182
-0
lines changed

6 files changed

+2182
-0
lines changed

soc/nordic/common/uicr/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,18 @@
44
if(CONFIG_NRF_PERIPHCONF_SECTION)
55
zephyr_linker_sources(SECTIONS uicr.ld)
66
endif()
7+
8+
if(CONFIG_NRF_PERIPHCONF_GENERATE_ENTRIES)
9+
set(periphconf_entries_c_file ${PROJECT_BINARY_DIR}/periphconf_entries_generated.c)
10+
execute_process(
11+
COMMAND
12+
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/gen_periphconf_entries.py
13+
--soc ${CONFIG_SOC}
14+
--in-edt-pickle ${EDT_PICKLE}
15+
--out-periphconf-source ${periphconf_entries_c_file}
16+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
17+
COMMAND_ERROR_IS_FATAL ANY
18+
)
19+
zephyr_sources(${periphconf_entries_c_file})
20+
message(STATUS "Generated ${periphconf_entries_c_file} from ${EDT_PICKLE}")
21+
endif()

soc/nordic/common/uicr/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,12 @@ config NRF_PERIPHCONF_SECTION
99
help
1010
Include static global domain peripheral initialization values from the
1111
build in a dedicated section in the devnull region.
12+
13+
config NRF_PERIPHCONF_GENERATE_ENTRIES
14+
bool "Generate PERIPHCONF entries source file"
15+
default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD
16+
depends on NRF_PERIPHCONF_SECTION
17+
depends on NRF_PLATFORM_HALTIUM
18+
help
19+
Generate a C file containing PERIPHCONF entries based on the
20+
device configuration in the devicetree.

0 commit comments

Comments
 (0)