1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-18 11:03:50 +01:00

72 lines
2.1 KiB
Makefile

PROGRAMMER ?= uf2conv
ifneq (,$(filter uf2conv,$(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
# 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
else ifneq (,$(filter SD730,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x27000
ROM_LEN = 0x59000
else
$(error Unsupported SoftDevice Version $(UF2_SOFTDEV).)
endif
else ifneq (,$(filter nrf52840xxaa,$(CPU_MODEL)))
UF2CONV_FLAGS = -f 0xADA52840
ifneq (,$(filter DROP,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x1000
ROM_LEN = 0xf3000
else ifneq (,$(filter SD611,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x26000
ROM_LEN = 0xda000
else ifneq (,$(filter SD730,$(UF2_SOFTDEV)))
ROM_OFFSET = 0x27000
ROM_LEN = 0xd9000
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
# 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