Skip to content

Commit 4c621a1

Browse files
committed
[nrf fromtree] scripts: runners: nrf: Generalize the use of --erase-mode for all ICs
Until now, for historical reasons (see f42cef9 and 58e0e31), the use of the --erase-mode command-line switch was reserved for the nRF54L family. But in fact this can be used (instead of --erase) for any of the Nordic ICs. This patch extends the usage of this switch regardless of family. Signed-off-by: Carles Cufi <[email protected]> (cherry picked from commit 146fd2c88ec38655d61d8fa3fc879cb47a9fd33d)
1 parent e2fd60c commit 4c621a1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

scripts/west_commands/runners/nrf_common.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,13 @@ def program_hex(self):
357357
if not self.erase and regtool_generated_uicr:
358358
self.exec_op('erase', core=core, kind='uicr')
359359
else:
360+
erase_mode = self._get_erase_mode(self.erase_mode)
360361
if self.erase:
361362
erase_arg = 'ERASE_ALL'
363+
elif self.erase_mode:
364+
erase_arg = erase_mode
362365
elif self.family == 'nrf54l':
363-
erase_arg = self._get_erase_mode(self.erase_mode) or 'ERASE_NONE'
366+
erase_arg = 'ERASE_NONE'
364367
else:
365368
erase_arg = 'ERASE_RANGES_TOUCHED_BY_FIRMWARE'
366369

@@ -479,10 +482,6 @@ def do_run(self, command, **kwargs):
479482

480483
self.ensure_family()
481484

482-
if self.family != 'nrf54l' and self.erase_mode:
483-
raise RuntimeError('Option --erase-mode can only be used with the '
484-
'nRF54L family.')
485-
486485
self.ensure_output('hex')
487486
if IntelHex is None:
488487
raise RuntimeError('Python dependency intelhex was missing; '

0 commit comments

Comments
 (0)