nrf: Change selected boards to utilize pre-flashed bootloader.

The nrf52840-mdk-usb-dongle and pca10050 comes with a pre-flashed
bootloader (OpenBootloader).

This commit updates the boards "mpconfigboard.mk" to use DFU as
default flashing method and set the corresponding BOOTLOADER
settings such that nrf52840_open_bootloader_1.2.x.ld linker
script is used.

The default DFU flashing method can be disabled by issuing "DFU=0"
when invoking make. This will lead to "segger" being used as default
flashing tool. When using "DFU=0", the linker scripts will not
compensate for any MBR and Bootloader region being present, and might
overwrite them if they were present.

The commit also removes the custom linker script specific to
nrf52840-mdk-usb-dongle as it now points to a generic.

Updated nrf52840-mdk-usb-dongle's README.md to be more clear on
how to deploy the built firmware.

The port README.md has also been updated. In the list of target
boards a new column has been added to indicate which bootloader
is present on the target board. And for consistency, changed all
examples in the README.md to use "deploy" instead of "flash".
This commit is contained in:
Glenn Ruben Bakke 2020-12-03 21:22:27 +01:00
parent 7f405236a3
commit d0b8554df4
5 changed files with 77 additions and 30 deletions

View File

@ -58,12 +58,12 @@ By default, the PCA10040 (nrf52832) is used as compile target. To build and flas
make submodules
make
make flash
make deploy
Alternatively the target board could be defined:
make BOARD=pca10040
make BOARD=pca10040 flash
make BOARD=pca10040 deploy
## Compile without LTO enabled
@ -118,26 +118,27 @@ For example:
## Target Boards and Make Flags
Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Flash Util
---------------------|-------------------------|------------------------|-------------------------------
microbit | s110 | Peripheral | [PyOCD](#pyocdopenocd-targets)
pca10000 | s110 | Peripheral | [Segger](#segger-targets)
pca10001 | s110 | Peripheral | [Segger](#segger-targets)
pca10028 | s110 | Peripheral | [Segger](#segger-targets)
pca10031 | s110 | Peripheral | [Segger](#segger-targets)
wt51822_s4at | s110 | Peripheral | Manual, see [datasheet](https://4tronix.co.uk/picobot2/WT51822-S4AT.pdf) for pinout
pca10040 | s132 | Peripheral and Central | [Segger](#segger-targets)
feather52 | s132 | Peripheral and Central | Manual, SWDIO and SWCLK solder points on the bottom side of the board
arduino_primo | s132 | Peripheral and Central | [PyOCD](#pyocdopenocd-targets)
ibk_blyst_nano | s132 | Peripheral and Central | [IDAP](#idap-midap-link-targets)
idk_blyst_nano | s132 | Peripheral and Central | [IDAP](#idap-midap-link-targets)
blueio_tag_evim | s132 | Peripheral and Central | [IDAP](#idap-midap-link-targets)
evk_nina_b1 | s132 | Peripheral and Central | [Segger](#segger-targets)
pca10056 | s140 | Peripheral and Central | [Segger](#segger-targets)
pca10059 | s140 | Peripheral and Central | Manual, SWDIO and SWCLK solder points on the sides.
particle_xenon | s140 | Peripheral and Central | [Black Magic Probe](#black-magic-probe-targets)
pca10090 | None (bsdlib.a) | None (LTE/GNSS) | [Segger](#segger-targets)
actinius_icarus | None (bsdlib.a) | None (LTE/GNSS) | [Segger](#segger-targets)
Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Bootloader | Default Flash Util
---------------------|-------------------------|------------------------|----------------|-------------------
microbit | s110 | Peripheral | | [PyOCD](#pyocdopenocd-targets)
pca10000 | s110 | Peripheral | | [Segger](#segger-targets)
pca10001 | s110 | Peripheral | | [Segger](#segger-targets)
pca10028 | s110 | Peripheral | | [Segger](#segger-targets)
pca10031 | s110 | Peripheral | | [Segger](#segger-targets)
wt51822_s4at | s110 | Peripheral | | Manual, see [datasheet](https://4tronix.co.uk/picobot2/WT51822-S4AT.pdf) for pinout
pca10040 | s132 | Peripheral and Central | | [Segger](#segger-targets)
feather52 | s132 | Peripheral and Central | | Manual, SWDIO and SWCLK solder points on the bottom side of the board
arduino_primo | s132 | Peripheral and Central | | [PyOCD](#pyocdopenocd-targets)
ibk_blyst_nano | s132 | Peripheral and Central | | [IDAP](#idap-midap-link-targets)
idk_blyst_nano | s132 | Peripheral and Central | | [IDAP](#idap-midap-link-targets)
blueio_tag_evim | s132 | Peripheral and Central | | [IDAP](#idap-midap-link-targets)
evk_nina_b1 | s132 | Peripheral and Central | | [Segger](#segger-targets)
pca10056 | s140 | Peripheral and Central | | [Segger](#segger-targets)
pca10059 | s140 | Peripheral and Central | OpenBootloader | [nrfutil](#nrfutil-targets)
particle_xenon | s140 | Peripheral and Central | | [Black Magic Probe](#black-magic-probe-targets)
nrf52840-mdk-usb-dongle | s140 | Peripheral and Central | OpenBootloader | [nrfutil](#nrfutil-targets)
pca10090 | None (bsdlib.a) | None (LTE/GNSS) | | [Segger](#segger-targets)
actinius_icarus | None (bsdlib.a) | None (LTE/GNSS) | | [Segger](#segger-targets)
## IDAP-M/IDAP-Link Targets
@ -173,6 +174,31 @@ This requires no further dependencies other than `arm-none-eabi-gdb`.
[this guide](https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands)
for more tips about using the BMP with GDB.
## nRFUtil Targets
Install the necessary Python packages that will be used for flashing using the bootloader:
sudo pip install nrfutil
sudo pip install intelhex
The `intelhex` provides the `hexmerge.py` utility which is used by the Makefile
to trim of the MBR in case SoftDevice flashing is requested.
`nrfutil` as flashing backend also requires a serial port paramter to be defined
in addition to the `deploy` target of make. For example:
make BOARD=nrf52840-mdk-usb-dongle NRFUTIL_PORT=/dev/ttyACM0 deploy
If the target device is connected to `/dev/ttyACM0` serial port, the
`NRFUTIL_PORT` parameter to make can be elided as it is the default serial
port set by the Makefile.
When enabling Bluetooth LE, as with the other flash utils, the SoftDevice
needs to be flashed in the first firmware update. This can be done by issuing
the `sd` target instead of `deploy`. For example:
make BOARD=nrf52840-mdk-usb-dongle SD=s140 NRFUTIL_PORT=/dev/ttyACM0 sd
## Bluetooth LE REPL
The port also implements a BLE REPL driver. This feature is disabled by default, as it will deactivate the UART REPL when activated. As some of the nRF devices only have one UART, using the BLE REPL free's the UART instance such that it can be used as a general UART peripheral not bound to REPL.

View File

@ -39,11 +39,10 @@ Follow the standard [nRF Port build instructions](../../README.md); but use
make BOARD=nrf52840-mdk-usb-dongle
The build artifacts will be created in `build-nrf52840-mdk-usb-dongle`. Once
built, the easiest way to deploy to the device is to open `firmware.hex` using
built, the target can be deployed to the device as described in
[nRFUtil targets](../../README.md#nrfutil-targets).
An alternative way to deploy to the device, is to open `firmware.hex` using
*nRF Connect* and select *Write*. Detailed instructions can be found on the
[developer
wiki](https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/programming/).
**Note** that the regular method of deployment for the MicroPython nRF port
(using `make deploy`) will *not* operate correctly and will overwrite the
bootloader.

View File

@ -2,6 +2,18 @@ MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
SOFTDEV_VERSION = 6.1.1
LD_FILES += boards/nrf52840-mdk-usb-dongle/nrf52840_open_bootloader.ld boards/nrf52840_1M_256k.ld
DFU ?= 1
ifeq ($(DFU),1)
BOOTLOADER=open_bootloader
BOOTLOADER_VERSION_MAJOR=1
BOOTLOADER_VERSION_MINOR=2
FLASHER=nrfutil
else
FLASHER=segger
endif
LD_FILES += boards/nrf52840_1M_256k.ld
NRF_DEFINES += -DNRF52840_XXAA

View File

@ -1,2 +0,0 @@
_ram_start = 0x20000008;
_flash_start = 0x1000;

View File

@ -2,6 +2,18 @@ MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
SOFTDEV_VERSION = 6.1.1
DFU ?= 1
ifeq ($(DFU),1)
BOOTLOADER=open_bootloader
BOOTLOADER_VERSION_MAJOR=1
BOOTLOADER_VERSION_MINOR=2
FLASHER=nrfutil
else
FLASHER=segger
endif
LD_FILES += boards/nrf52840_1M_256k.ld
NRF_DEFINES += -DNRF52840_XXAA