1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-18 11:03:50 +01:00
crasbe f9b0cc7711 boards/adafruit-{clue,itsybitsy-nrf52}: convert to common Ada nRF52 BL
The Adafruit Clue and Itsybitsy nRF52 also use the Adafruit nRF52
Bootloader which has a common module that can be used.
Especially the Itsybitsy nRF52 (mis)uses the nrfutil programmer
target and has a lot of redundant code.

Furthermore, the Double Tap Magic Value used by both boards
is incorrect for using the USB Bootloader.
2025-05-07 15:31:17 +02:00

79 lines
2.4 KiB
Makefile

PROGRAMMER ?= uf2conv
ifneq (,$(filter uf2conv adafruit-nrfutil,$(PROGRAMMER)))
# The Adafruit nRF52 Bootloader currently only really supports
# two MCUs. Set the according Family Flag and SoftDevice version if
# not set already.
ifneq (,$(filter nrf52833xxaa,$(CPU_MODEL)))
UF2CONV_FLAGS = -f 0x621E937A
ADANRFUTIL_FLAGS = --dev-type 0x0052
# The Adafruit nRF52 Bootloader has a static MBR at the first 4k
# and a 38k UF2 Bootloader at the end, leaving 972k (nRF52840) or 460k
# (nRF52833) for the application when not using the SoftDevice.
# SoftDevice v6 uses an additional 114k and SoftDevice v7 uses 118k.
# The option "DROP" overrides any SoftDevice, making a reflash of the
# bootloader necessary if i.a. Arduino or CircuitPython
# are to be used again.
ifneq (,$(filter DROP,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x1000
ROM_LEN = 0x7f000
else ifneq (,$(filter SD611,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x26000
ROM_LEN = 0x5a000
ADANRFUTIL_FLAGS += --sd-req 0x00B6
else ifneq (,$(filter SD730,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x27000
ROM_LEN = 0x59000
ADANRFUTIL_FLAGS += --sd-req 0x0123
else
$(error Unsupported SoftDevice Version $(UF2_SOFTDEV).)
endif
else ifneq (,$(filter nrf52840xxaa,$(CPU_MODEL)))
UF2CONV_FLAGS = -f 0xADA52840
ADANRFUTIL_FLAGS = --dev-type 0x0052
ifneq (,$(filter DROP,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x1000
ROM_LEN = 0xf3000
else ifneq (,$(filter SD611,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x26000
ROM_LEN = 0xda000
ADANRFUTIL_FLAGS += --sd-req 0x00B6
else ifneq (,$(filter SD730,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x27000
ROM_LEN = 0xd9000
ADANRFUTIL_FLAGS += --sd-req 0x0123
else
$(error Unsupported SoftDevice Version $(UF2_SOFTDEV).)
endif
else
$(error Unsupported CPU $(CPU_MODEL) for Adafruit nRF52 Bootloader.)
endif
# Driver can take some time to get mounted
PREFLASH_DELAY ?= 3
include $(RIOTMAKE)/tools/usb_board_reset.mk
endif
PROGRAMMERS_SUPPORTED += uf2conv
PROGRAMMERS_SUPPORTED += adafruit-nrfutil
# HACK: replicate dependency resolution in Makefile.dep, only works
# if `USEMODULE` or `DEFAULT_MODULE` is set by the command line or in the
# application Makefile.
ifeq (,$(filter stdio_%,$(DISABLE_MODULE) $(USEMODULE)))
RIOT_TERMINAL ?= jlink
endif
include $(RIOTBOARD)/common/nrf52/Makefile.include