Skip to content

Commit d04e8a3

Browse files
committed
[nrf fromtree] scripts: runners: nrf: Implement the erase command
The `erase` command was being used but there was no "backend" implementation for it in nrfutil nor nrfjprog. Simplify the syntax and implement it for both tools. Signed-off-by: Carles Cufi <[email protected]> (cherry picked from commit dc7d8bb)
1 parent 11a055b commit d04e8a3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

scripts/west_commands/runners/nrf_common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ def program_hex(self):
390390
)
391391

392392
if not self.erase and generated_uicr:
393-
self.exec_op('erase', core=core, option={'chip_erase_mode': 'ERASE_UICR',
394-
'ext_mem_erase_mode': 'ERASE_NONE'})
393+
self.exec_op('erase', core=core, kind='uicr')
395394
else:
396395
if self.erase:
397396
erase_arg = 'ERASE_ALL'

scripts/west_commands/runners/nrfjprog.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ def do_exec_op(self, op, force=False):
106106
cmd.append('--reset')
107107
if _op['kind'] == 'RESET_PIN':
108108
cmd.append('--pinreset')
109+
elif op_type == 'erase':
110+
cmd.append(f'--erase{_op["kind"]}')
109111
else:
110112
raise RuntimeError(f'Invalid operation: {op_type}')
111113

scripts/west_commands/runners/nrfutil.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ def _append_batch(self, op, json_file):
121121
elif op_type == 'reset':
122122
cmd += ['--reset-kind', _op['kind']]
123123
elif op_type == 'erase':
124-
cmd += ['--reset-kind', _op['kind']]
125-
124+
cmd.append(f'--{_op["kind"]}')
126125

127126
cmd += ['--core', op['core']] if op.get('core') else []
128127
cmd += ['--x-family', f'{self.family}']

0 commit comments

Comments
 (0)