west: runners: nrf: Check for missing UICR
On nRF54H and nRF92, booting certain cores requires programming a UICR, which is normally generated using nrf-regtool. This should be considered an optional dependency, because we do not wish to force non-Nordic users to install it just to work with Zephyr, or just for build-only tests. When nrf-regtool is not installed, a CMake warning will be displayed, but people ignore warnings all the time. As the last line of defense, check for missing UICR in the nrfutil flash runner, to prevent our users from unintentionally programming unbootable firmware. Show a fatal error specifically if CONFIG_NRF_REGTOOL_GENERATE_UICR=y, yet no UICR exists. Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
This commit is contained in:
parent
ce02d0c0fc
commit
8fc161f820
1 changed files with 25 additions and 13 deletions
|
|
@ -35,9 +35,17 @@ UICR_RANGES = {
|
|||
'NRFDL_DEVICE_CORE_APPLICATION': (0x00FF8000, 0x00FF8800),
|
||||
'NRFDL_DEVICE_CORE_NETWORK': (0x01FF8000, 0x01FF8800),
|
||||
},
|
||||
'NRF54H_FAMILY': {
|
||||
'NRFDL_DEVICE_CORE_APPLICATION': (0x0FFF8000, 0x0FFF8800),
|
||||
'NRFDL_DEVICE_CORE_NETWORK': (0x0FFFA000, 0x0FFFA800),
|
||||
},
|
||||
'NRF91_FAMILY': {
|
||||
'NRFDL_DEVICE_CORE_APPLICATION': (0x00FF8000, 0x00FF8800),
|
||||
}
|
||||
},
|
||||
'NRF92_FAMILY': {
|
||||
'NRFDL_DEVICE_CORE_APPLICATION': (0x0FFF8000, 0x0FFF8800),
|
||||
'NRFDL_DEVICE_CORE_NETWORK': (0x0FFFA000, 0x0FFFA800),
|
||||
},
|
||||
}
|
||||
|
||||
# Relative to the root of the hal_nordic module
|
||||
|
|
@ -307,6 +315,19 @@ class NrfBinaryRunner(ZephyrBinaryRunner):
|
|||
self.build_conf.getboolean('CONFIG_SOC_NRF54H20_ENGB_CPURAD') or
|
||||
self.build_conf.getboolean('CONFIG_SOC_NRF9280_CPURAD')
|
||||
)
|
||||
generated_uicr = self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR')
|
||||
|
||||
if cpuapp:
|
||||
core = 'NRFDL_DEVICE_CORE_APPLICATION'
|
||||
elif cpurad:
|
||||
core = 'NRFDL_DEVICE_CORE_NETWORK'
|
||||
|
||||
if generated_uicr and not self.hex_get_uicrs().get(core):
|
||||
raise RuntimeError(
|
||||
f"Expected a UICR to be contained in: {self.hex_}\n"
|
||||
"Please ensure that the correct version of nrf-regtool is "
|
||||
"installed, then run 'west build --cmake' to try again."
|
||||
)
|
||||
|
||||
if self.erase:
|
||||
self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION')
|
||||
|
|
@ -335,18 +356,9 @@ class NrfBinaryRunner(ZephyrBinaryRunner):
|
|||
mpi_hex_dir / 'suit_installed_envelopes_application_merged.hex')
|
||||
self.op_program(app_root_envelope_hex_file, 'ERASE_NONE', None, defer=True, core='NRFDL_DEVICE_CORE_APPLICATION')
|
||||
|
||||
if cpuapp:
|
||||
if not self.erase and self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR'):
|
||||
self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION',
|
||||
option={'chip_erase_mode': 'ERASE_UICR',
|
||||
'qspi_erase_mode': 'ERASE_NONE'})
|
||||
core = 'NRFDL_DEVICE_CORE_APPLICATION'
|
||||
elif cpurad:
|
||||
if not self.erase and self.build_conf.getboolean('CONFIG_NRF_REGTOOL_GENERATE_UICR'):
|
||||
self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK',
|
||||
option={'chip_erase_mode': 'ERASE_UICR',
|
||||
'qspi_erase_mode': 'ERASE_NONE'})
|
||||
core = 'NRFDL_DEVICE_CORE_NETWORK'
|
||||
if not self.erase and generated_uicr:
|
||||
self.exec_op('erase', core=core, option={'chip_erase_mode': 'ERASE_UICR',
|
||||
'qspi_erase_mode': 'ERASE_NONE'})
|
||||
else:
|
||||
if self.erase:
|
||||
erase_arg = 'ERASE_ALL'
|
||||
|
|
|
|||
Loading…
Reference in a new issue