diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index 6423253233c..a42e841bdbd 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -273,6 +273,11 @@ def program_hex(self): if self.erase: self.exec_op('erase', core='NRFDL_DEVICE_CORE_APPLICATION') self.exec_op('erase', core='NRFDL_DEVICE_CORE_NETWORK') + # A reset is needed if repartitioning the device memory + self.reset_target() + else: + # Ensure that firmware is not executing while erasing/programming + self.exec_op("reset", option="RESET_VIA_SECDOM") # Manage SUIT artifacts. # This logic should be executed only once per build. @@ -298,16 +303,8 @@ def program_hex(self): 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' else: if self.erase: