NINA-B4 series - System integration manual
UBX-19052230 - R06
Open CPU software
Page 33 of 45
C1-Public
☞
Note that memory sizes can vary dependent on the SoftDevice radio stack software running on
the module.
3.2.2.1
Building applications to be flashed using the boot loader
To flash an application to the module without destroying the master boot record (MBR) that is
preflashed in the factory, the start address in flash must be changed to
0x27000
(for applications with
S140 SoftDevice) or
0x1000
(applications without SoftDevice). This change can be done in the nRF5
SDK by changing the macro
FLASH_START
– in a similar way to how the
BOARD_CUSTOM
flag was set in
section 3.1.1.3. The flag is set in the Section Linker->Section placement macros, as shown in
Figure 15.
Figure 16 Setting the FLASH_START macro
3.2.2.2
Preparing the Device Firmware Update (DFU) package
The package to be flashed is in a special DFU package format. The package is generated in the
following way:
An application that does not use a SoftDevice:
nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application-version 0 --application
app.hex app.zip
An application with SoftDevice:
nrfutil pkg generate --hw-version 52 --sd-req 0xCA --sd-id 0xCA --softdevice
s140_nrf52_7.0.1_softdevice.hex --application-version 0 --application app.hex sd_app.zip
3.2.2.3
Flashing the DFU package
The generated DFU package can be flashed on the module using the following
nrfutil
command:
nrfutil dfu serial -pkg app.zip -p COM95 -b 115200 -fc 1
☞
As there is no application to boot, the loader automatically stops in DFU mode when flashing is
done for the first time. On subsequent reboots, you need to stop the boot loader in DFU mode by
driving
SWITCH_2
low during startup.