From 718397a37d7ec2071b5f5d3668c31e6b8f69f3b9 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Thu, 16 Jul 2020 23:04:02 +0200 Subject: [PATCH] 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_= 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). --- ports/nrf/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index e5a1b471a3..4ee9384ec2 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -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),)