diff --git a/firmware/Makefile b/firmware/Makefile index c9c4efe..c0705ec 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -9,6 +9,9 @@ endif BOARDDIR = boards/$(BOARD) +# optionally include board.mk that sets per-board options +-include $(BOARDDIR)/board.mk + # Compiler options here. ifeq ($(USE_OPT),) USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -fsingle-precision-constant @@ -50,6 +53,10 @@ ifeq ($(USE_SMART_BUILD),) USE_SMART_BUILD = yes endif +ifeq ($(USE_BOOTLOADER),) + USE_BOOTLOADER = no +endif + # # Build global options ############################################################################## @@ -177,8 +184,10 @@ UINCDIR = # List the user directory to look for the libraries here ULIBDIR = $(BOARDDIR) -# List all user libraries here -ULIBS = boards/f0_module/bootloader/build/wideband_bootloader.o +ifeq ($(USE_BOOTLOADER),yes) + ULIBS = boards/f0_module/bootloader/build/wideband_bootloader.o + USE_OPT += -Wl,--defsym=USE_BOOTLOADER=1 +endif # # End of user section diff --git a/firmware/boards/f0_module/board.mk b/firmware/boards/f0_module/board.mk new file mode 100644 index 0000000..6e6c781 --- /dev/null +++ b/firmware/boards/f0_module/board.mk @@ -0,0 +1 @@ +USE_BOOTLOADER = yes diff --git a/firmware/boards/f0_module/bootloader/Makefile b/firmware/boards/f0_module/bootloader/Makefile index 8e424a7..2bf70b0 100644 --- a/firmware/boards/f0_module/bootloader/Makefile +++ b/firmware/boards/f0_module/bootloader/Makefile @@ -159,6 +159,7 @@ ULIBDIR = # List all user libraries here # Add the search path of the firmware/ dir, we need wideband_layout.ld ULIBS = -L.. +USE_OPT += -Wl,--defsym=USE_BOOTLOADER=1 # # End of user section diff --git a/firmware/boards/f0_module/wideband_layout.ld b/firmware/boards/f0_module/wideband_layout.ld index 73e70b9..94fdd02 100644 --- a/firmware/boards/f0_module/wideband_layout.ld +++ b/firmware/boards/f0_module/wideband_layout.ld @@ -2,7 +2,7 @@ * STM32F042x6 memory setup. */ -blsize = 6k; +blsize = DEFINED(USE_BOOTLOADER) ? 6k : 0; MEMORY {