mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:12:57 +01:00
board/feather-nrf52840: add uf2 boot loader
This commit is contained in:
parent
796175591d
commit
67302bfae6
@ -16,5 +16,6 @@ config BOARD_FEATHER_NRF52840
|
|||||||
select HAS_PERIPH_SPI
|
select HAS_PERIPH_SPI
|
||||||
select HAS_PERIPH_UART
|
select HAS_PERIPH_UART
|
||||||
select HAS_PERIPH_USBDEV
|
select HAS_PERIPH_USBDEV
|
||||||
|
select HAS_HIGHLEVEL_STDIO
|
||||||
|
|
||||||
source "$(RIOTBOARD)/common/nrf52/Kconfig"
|
source "$(RIOTBOARD)/common/nrf52/Kconfig"
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
# Use stdio_cdc_acm unless another stdio_% is already used
|
|
||||||
ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE)))
|
|
||||||
USEMODULE += stdio_cdc_acm
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||||
USEMODULE += saul_gpio
|
USEMODULE += saul_gpio
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# include common nrf52 dependencies
|
# include common nrf52 dependencies
|
||||||
|
include $(RIOTBOARD)/common/nrf52/bootloader_nrfutil.dep.mk
|
||||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
||||||
|
@ -7,5 +7,6 @@ FEATURES_PROVIDED += periph_uart
|
|||||||
FEATURES_PROVIDED += periph_usbdev
|
FEATURES_PROVIDED += periph_usbdev
|
||||||
|
|
||||||
# Various other features (if any)
|
# Various other features (if any)
|
||||||
|
FEATURES_PROVIDED += highlevel_stdio
|
||||||
|
|
||||||
include $(RIOTBOARD)/common/nrf52/Makefile.features
|
include $(RIOTBOARD)/common/nrf52/Makefile.features
|
||||||
|
@ -1,3 +1,24 @@
|
|||||||
|
PROGRAMMER ?= uf2conv
|
||||||
|
|
||||||
|
UF2CONV_FLAGS = -f 0xADA52840
|
||||||
|
|
||||||
|
ifeq (uf2conv,$(PROGRAMMER))
|
||||||
|
|
||||||
|
# Using uf2conv implies using the UF2 bootloader
|
||||||
|
#
|
||||||
|
# It has a static MBR at the first 4k, and a 38k UF2 Bootloader at
|
||||||
|
# the end, leaving 972k for the application. This overwrites any SoftDevice,
|
||||||
|
# but that's what the minimal working example does as well.
|
||||||
|
ROM_OFFSET = 0x1000
|
||||||
|
ROM_LEN = 0xf3000
|
||||||
|
|
||||||
|
# Driver can take some time to get mounted
|
||||||
|
PREFLASH_DELAY ?= 3
|
||||||
|
include $(RIOTMAKE)/tools/usb_board_reset.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
PROGRAMMERS_SUPPORTED += uf2conv
|
||||||
|
|
||||||
# HACK: replicate dependency resolution in Makefile.dep, only works
|
# HACK: replicate dependency resolution in Makefile.dep, only works
|
||||||
# if `USEMODULE` or `DEFAULT_MODULE` is set by the command line or in the
|
# if `USEMODULE` or `DEFAULT_MODULE` is set by the command line or in the
|
||||||
# application Makefile.
|
# application Makefile.
|
||||||
|
@ -16,11 +16,32 @@ Low Energy and IEEE 802.15.4 support via the nRF52840 MCU.
|
|||||||
|
|
||||||
### Flash the board
|
### Flash the board
|
||||||
|
|
||||||
See the **Flashing** section in @ref boards_common_nrf52. The easiest way is to
|
The board is flashed using its on-board UF2 boot loader by default.
|
||||||
|
The boot loader will present a mass storage device that has to be mounted to /media/MDK-DONGLE so
|
||||||
|
`uf2conv.py` can find it. If you have an auto-mounter installed this will happen automatically.
|
||||||
|
|
||||||
|
The rest of the process is automated in the usual `make flash` target.
|
||||||
|
|
||||||
|
If RIOT is already running on the board, it will automatically reset the CPU and enter
|
||||||
|
the bootloader.
|
||||||
|
If some other firmware is running or RIOT crashed, you need to enter the bootloader
|
||||||
|
manually by pressing the board's reset button while plugging the device into the
|
||||||
|
|
||||||
|
Otherwise See the **Flashing** section in @ref boards_common_nrf52. The easiest way is to
|
||||||
use an external Segger J-Link Programmer connected to the [SWD Connector].
|
use an external Segger J-Link Programmer connected to the [SWD Connector].
|
||||||
|
|
||||||
[SWD Connector]: https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/pinouts#swd-connector-3-12
|
[SWD Connector]: https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/pinouts#swd-connector-3-12
|
||||||
|
|
||||||
|
#### Flashing the uf2 bootloader
|
||||||
|
|
||||||
|
To flash the uf2 bootloader (if its no longer present on your BOARD) then with
|
||||||
|
a jlink attached to your BOARD and `nrf52prog` installed:
|
||||||
|
|
||||||
|
$ git clone git@github.com:adafruit/Adafruit_nRF52_Bootloader.git
|
||||||
|
$ cd Adafruit_nRF52_Bootloader
|
||||||
|
$ make BOARD=feather_nrf52840_express all
|
||||||
|
$ make BOARD=feather_nrf52840_express flash
|
||||||
|
|
||||||
### Terminal
|
### Terminal
|
||||||
To connect a terminal to the Feather, RIOT chooses Segger RTT per default.
|
To connect a terminal to the Feather, RIOT chooses Segger RTT per default.
|
||||||
This lets you use the Segger J-Link Programmer as a serial interface to the
|
This lets you use the Segger J-Link Programmer as a serial interface to the
|
||||||
|
41
boards/feather-nrf52840/reset.c
Normal file
41
boards/feather-nrf52840/reset.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Inria
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU Lesser
|
||||||
|
* General Public License v2.1. See the file LICENSE in the top level
|
||||||
|
* directory for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup boards_feather-nrf52840
|
||||||
|
* @{
|
||||||
|
* @file
|
||||||
|
* @brief Implementation for managing the nrfutil bootloader
|
||||||
|
*
|
||||||
|
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||||
|
*
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef MODULE_USB_BOARD_RESET
|
||||||
|
|
||||||
|
#define USB_H_USER_IS_RIOT_INTERNAL
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
#include "usb_board_reset.h"
|
||||||
|
|
||||||
|
/* Set the value used by the bootloader to select between boot in
|
||||||
|
application and boot in bootloader mode. */
|
||||||
|
#define NRF52_DOUBLE_TAP_MAGIC_NUMBER (0x57)
|
||||||
|
|
||||||
|
void usb_board_reset_in_bootloader(void)
|
||||||
|
{
|
||||||
|
NRF_POWER->GPREGRET = NRF52_DOUBLE_TAP_MAGIC_NUMBER;
|
||||||
|
|
||||||
|
/* Going with a hard reset rather than a pm_off, as that might be altered
|
||||||
|
* to do *anything* -- which is not safe any more now that we've forsaken
|
||||||
|
* the RAM content */
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* MODULE_USB_BOARD_RESET */
|
Loading…
Reference in New Issue
Block a user