Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boards/nordic/thingy53/board.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_BOARD_THINGY53_NRF5340_CPUAPP OR CONFIG_BOARD_THINGY53_NRF5340_CPUAPP_NS)
board_runner_args(nrfutil "--ext-mem-config-file=${BOARD_DIR}/thingy53_qspi_nrfutil_config.json")
board_runner_args(jlink "--device=nrf5340_xxaa_app" "--speed=4000")
elseif(CONFIG_BOARD_THINGY53_NRF5340_CPUNET)
board_runner_args(jlink "--device=nrf5340_xxaa_net" "--speed=4000")
Expand Down
22 changes: 22 additions & 0 deletions boards/nordic/thingy53/thingy53_qspi_nrfutil_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"firmware_config": {
"peripheral": "QSPI"
},
"pins": {
"sck": 17,
"csn": 18,
"io0": 13,
"io1": 14,
"io2": 15,
"io3": 16
},
"flash_size": 67108864,
"sck_frequency": 8000000,
"address_mode": "MODE24BIT",
"readoc": "READ2IO",
"writeoc": "PP",
"pp_size": "PPSIZE256",
"sck_delay": 128,
"rx_delay": 2,
"page_size": 4096
}
7 changes: 7 additions & 0 deletions doc/releases/migration-guide-4.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Boards
instead of pin reset when flashing with ``west flash``. If you want to keep
using pin reset on the nRF52 family of ICs you can use ``west flash --pinreset``.

* Erasing the external memory when programming a new firmware image with ``west
flash`` on the nRF52 and nRF53 series now always correctly honors the
``--erase`` flag (and its absence) both when using the ``nrfjprog`` and
``nrfutil`` backends. Prior to this release, the ``nrjfprog`` backend would
always erase only the sectors of the external flash used by the new firmware,
and the ``nrfutil`` one would always erase the whole external flash.

Devicetree
**********

Expand Down
2 changes: 1 addition & 1 deletion scripts/west_commands/runners/nrf_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def program_hex(self):
if self.family in xip_ranges:
xip_start, xip_end = xip_ranges[self.family]
if self.hex_refers_region(xip_start, xip_end):
ext_mem_erase_opt = 'ERASE_ALL'
ext_mem_erase_opt = erase_arg

self.op_program(self.hex_, erase_arg, ext_mem_erase_opt, defer=True, core=core)
self.flush(force=False)
Expand Down
7 changes: 5 additions & 2 deletions scripts/west_commands/runners/nrfjprog.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ def do_exec_op(self, op, force=False):
raise RuntimeError(f'Invalid erase mode: {erase}')

if opts.get('ext_mem_erase_mode'):
# In the future there might be multiple QSPI erase modes
cmd.append('--qspisectorerase')
if opts['ext_mem_erase_mode'] == 'ERASE_RANGES_TOUCHED_BY_FIRMWARE':
cmd.append('--qspisectorerase')
elif opts['ext_mem_erase_mode'] == 'ERASE_ALL':
cmd.append('--qspichiperase')

if opts.get('verify'):
# In the future there might be multiple verify modes
cmd.append('--verify')
Expand Down
19 changes: 15 additions & 4 deletions scripts/west_commands/runners/nrfutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ class NrfUtilBinaryRunner(NrfBinaryRunner):

def __init__(self, cfg, family, softreset, pinreset, dev_id, erase=False,
reset=True, tool_opt=None, force=False, recover=False,
suit_starter=False):
suit_starter=False, ext_mem_config_file=None):

super().__init__(cfg, family, softreset, pinreset, dev_id, erase, reset,
tool_opt, force, recover)

self.suit_starter = suit_starter
self.ext_mem_config_file = ext_mem_config_file

self._ops = []
self._op_id = 1
Expand All @@ -43,14 +44,19 @@ def do_create(cls, cfg, args):
reset=args.reset,
tool_opt=args.tool_opt, force=args.force,
recover=args.recover,
suit_starter=args.suit_manifest_starter)
suit_starter=args.suit_manifest_starter,
ext_mem_config_file=args.ext_mem_config_file)

@classmethod
def do_add_parser(cls, parser):
super().do_add_parser(parser)
parser.add_argument('--suit-manifest-starter', required=False,
action='store_true',
help='Use the SUIT manifest starter file')
parser.add_argument('--ext-mem-config-file', required=False,
dest='ext_mem_config_file',
help='path to an JSON file with external memory configuration')


def _exec(self, args):
jout_all = []
Expand Down Expand Up @@ -139,8 +145,13 @@ def _exec_batch(self):
self._ops = []
self._op_id = 1
self.logger.debug(f'Executing batch in: {json_file}')
self._exec(['x-execute-batch', '--batch-path', f'{json_file}',
'--serial-number', f'{self.dev_id}'])
precmd = []
if self.ext_mem_config_file:
# This needs to be prepended, as it's a global option
precmd = ['--x-ext-mem-config-file', self.ext_mem_config_file]

self._exec(precmd + ['x-execute-batch', '--batch-path', f'{json_file}',
'--serial-number', f'{self.dev_id}'])

def do_exec_op(self, op, force=False):
self.logger.debug(f'Executing op: {op}')
Expand Down
Loading