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 <carles.cufi@nordicsemi.no>
This commit is contained in:
Carles Cufi 2025-01-30 13:23:38 +01:00 committed by Benjamin Cabé
commit dc7d8bbe16
3 changed files with 4 additions and 4 deletions

View file

@ -390,8 +390,7 @@ class NrfBinaryRunner(ZephyrBinaryRunner):
)
if not self.erase and generated_uicr:
self.exec_op('erase', core=core, option={'chip_erase_mode': 'ERASE_UICR',
'ext_mem_erase_mode': 'ERASE_NONE'})
self.exec_op('erase', core=core, kind='uicr')
else:
if self.erase:
erase_arg = 'ERASE_ALL'

View file

@ -106,6 +106,8 @@ class NrfJprogBinaryRunner(NrfBinaryRunner):
cmd.append('--reset')
if _op['kind'] == 'RESET_PIN':
cmd.append('--pinreset')
elif op_type == 'erase':
cmd.append(f'--erase{_op["kind"]}')
else:
raise RuntimeError(f'Invalid operation: {op_type}')

View file

@ -121,8 +121,7 @@ class NrfUtilBinaryRunner(NrfBinaryRunner):
elif op_type == 'reset':
cmd += ['--reset-kind', _op['kind']]
elif op_type == 'erase':
cmd += ['--reset-kind', _op['kind']]
cmd.append(f'--{_op["kind"]}')
cmd += ['--core', op['core']] if op.get('core') else []
cmd += ['--x-family', f'{self.family}']