nrf/Makefile: Add bootloader specific section.

Add the option for "mpconfigboard.mk" to define whether the
board hosts a bootloader or not. The BOOTLOADER make variable
must be set to the name of the bootloader.

When the BOOTLOADER name is set it is also required to supply
the BOOTLOADER_VERSION_MAJOR and the BOOTLOADER_VERSION_MINOR
from the "mpconfigboards.mk". These will be used to resolve which
bootloader linker script that should be passed to the linker.

The BOOTLOADER section also supplies the C-compiler with
BOOTLOADER_<bootloader name>=<version major><version minor>
as a compiler define. This is for future use in case a bootloader
needs to do modification to the startup files or similar (like
setting the VTOR specific to a version of a bootloader).
This commit is contained in:
Glenn Ruben Bakke 2020-07-16 23:04:02 +02:00
parent 2489688635
commit 718397a37d
1 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,13 @@ else
include drivers/bluetooth/bluetooth_common.mk
endif
ifneq ($(BOOTLOADER),)
BOOTLOADER_UPPER = $(shell echo $(BOOTLOADER) | tr '[:lower:]' '[:upper:]')
# Use additional bootloader linker script
LD_FILES += boards/$(MCU_SUB_VARIANT)_$(BOOTLOADER)_$(BOOTLOADER_VERSION_MAJOR).$(BOOTLOADER_VERSION_MINOR).x.ld
CFLAGS += -DBOOTLOADER_$(BOOTLOADER_UPPER)_VERSION=$(BOOTLOADER_MAJOR)$(BOOTLOADER_MINOR)
endif
LD_FILES += boards/memory.ld boards/common.ld
ifneq ($(LD_FILE),)