Commit ac851ca1 authored by Sebastian Bøe's avatar Sebastian Bøe Committed by Benjamin Cabé
Browse files

soc: nordic: uicr: Reorganize how gen_uicr.py is invoked



Reorganize how gen_uicr.py is invoked.

Instead of invoking it from one of the Zephyr images we invoke it from
a new special Zephyr image called uicr.

This uicr Zephyr image is flashed in the same way as normal Zephyr
images so special handling in the runner is no longer necessary.

Also, we simplify gen_uicr.py by moving parsing of Kconfig/DT from
gen_uicr.py to CMake.

Signed-off-by: default avatarSebastian Bøe <sebastian.boe@nordicsemi.no>
parent ae191f66
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1250,6 +1250,7 @@ flagged.
        "FOO_LOG_LEVEL",
        "FOO_SETTING_1",
        "FOO_SETTING_2",
        "GEN_UICR_GENERATE_PERIPHCONF", # Used in specialized build tool, not part of main Kconfig
        "HEAP_MEM_POOL_ADD_SIZE_", # Used as an option matching prefix
        "HUGETLBFS",          # Linux, in boards/xtensa/intel_adsp_cavs25/doc
        "IAR_BUFFERED_WRITE",
+0 −20
Original line number Diff line number Diff line
@@ -433,26 +433,6 @@ class NrfBinaryRunner(ZephyrBinaryRunner):
                            core='Application',
                        )

            if self.build_conf.getboolean("CONFIG_NRF_HALTIUM_GENERATE_UICR"):
                zephyr_build_dir = Path(self.cfg.build_dir) / 'zephyr'

                self.op_program(
                    str(zephyr_build_dir / 'uicr.hex'),
                    'ERASE_NONE',
                    None,
                    defer=True,
                    core='Application',
                )

                if self.build_conf.getboolean("CONFIG_NRF_HALTIUM_UICR_PERIPHCONF"):
                    self.op_program(
                        str(zephyr_build_dir / 'periphconf.hex'),
                        'ERASE_NONE',
                        None,
                        defer=True,
                        core='Application',
                    )

            if not self.erase and regtool_generated_uicr:
                self.exec_op('erase', core=core, kind='uicr')
        else:
+1 −0
Original line number Diff line number Diff line
@@ -4,5 +4,6 @@
config HAS_NORDIC_VPR_LAUNCHER_IMAGE
	bool

rsource "common/uicr/Kconfig.sysbuild"
rsource "common/vpr/Kconfig.sysbuild"
orsource "*/Kconfig.sysbuild"
+1 −3
Original line number Diff line number Diff line
@@ -3,9 +3,7 @@

add_subdirectory_ifdef(CONFIG_RISCV_CORE_NORDIC_VPR vpr)

if(CONFIG_NRF_PERIPHCONF_SECTION OR CONFIG_NRF_HALTIUM_GENERATE_UICR)
add_subdirectory(uicr)
endif()

# Let SystemInit() be called in place of soc_reset_hook() by default.
zephyr_linker_symbol(SYMBOL soc_reset_hook EXPR "@SystemInit@")
+0 −30
Original line number Diff line number Diff line
@@ -4,33 +4,3 @@
if(CONFIG_NRF_PERIPHCONF_SECTION)
  zephyr_linker_sources(SECTIONS uicr.ld)
endif()

if(CONFIG_NRF_HALTIUM_GENERATE_UICR)
  if(CONFIG_NRF_PERIPHCONF_SECTION)
    set(in_periphconf_elf_arg
      --in-periphconf-elf $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
    )
  endif()

  if(CONFIG_NRF_HALTIUM_UICR_PERIPHCONF)
    set(periphconf_hex_file ${PROJECT_BINARY_DIR}/periphconf.hex)
    set(out_periphconf_hex_arg
      --out-periphconf-hex ${periphconf_hex_file}
    )
    list(APPEND optional_byproducts ${periphconf_hex_file})
  endif()

  set(uicr_hex_file ${PROJECT_BINARY_DIR}/uicr.hex)
  set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
    COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${ZEPHYR_BASE}/scripts/dts/python-devicetree/src
    ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/gen_uicr.py
    --in-config ${DOTCONFIG}
    --in-edt-pickle ${EDT_PICKLE}
    ${in_periphconf_elf_arg}
    ${out_periphconf_hex_arg}
    --out-uicr-hex ${uicr_hex_file}
  )
  set_property(GLOBAL APPEND PROPERTY extra_post_build_byproducts
    ${uicr_hex_file} ${optional_byproducts}
  )
endif()
Loading