From 3ab5250b8131d950133ea09e492ecf6437a5edf0 Mon Sep 17 00:00:00 2001 From: solosky Date: Sat, 17 Feb 2024 15:30:22 +0800 Subject: [PATCH] bl size increase to 36K --- fw/bootloader/Makefile | 15 +++++++++++++-- fw/ld/bootloader_nrf52840.ld | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fw/bootloader/Makefile b/fw/bootloader/Makefile index 519f7b84..debb28eb 100644 --- a/fw/bootloader/Makefile +++ b/fw/bootloader/Makefile @@ -5,6 +5,7 @@ OUTPUT_DIRECTORY := ../_build SDK_ROOT := $(NRF52_SDK_ROOT) PROJ_DIR := ./src BOARD ?= NEO +RELEASE ?= 1 # boards defines ifeq ($(BOARD),NEO) @@ -180,10 +181,14 @@ LIB_FILES += \ $(SDK_ROOT)/external/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.8.a \ $(SDK_ROOT)/external/micro-ecc/nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a \ -# Optimization flags -OPT = -Os -g3 + +ifneq ($(RELEASE), 1) +OPT = -O2 -g3 +else +OPT = -Os -g3 -ffunction-sections -fdata-sections # Uncomment the line below to enable link time optimization #OPT += -flto +endif # C flags common to all targets CFLAGS += $(OPT) @@ -213,6 +218,12 @@ CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing CFLAGS += -fno-builtin -fshort-enums CFLAGS += -DCUSTOM_BOARD_INC=boards_defines CFLAGS += -DBOARD_$(BOARD) +ifneq ($(RELEASE), 1) +CFLAGS += -DDEBUG +CFLAGS += -DEBUG_NRF +else +CFLAGS += -DNDEBUG +endif # C++ flags common to all targets CXXFLAGS += $(OPT) diff --git a/fw/ld/bootloader_nrf52840.ld b/fw/ld/bootloader_nrf52840.ld index 6a13c67c..0a0c7d83 100644 --- a/fw/ld/bootloader_nrf52840.ld +++ b/fw/ld/bootloader_nrf52840.ld @@ -5,7 +5,7 @@ GROUP(-lgcc -lc -lnosys) MEMORY { - FLASH (rx) : ORIGIN = 0xf8000, LENGTH = 0x6000 + FLASH (rx) : ORIGIN = 0xf5000, LENGTH = 0x9000 RAM (rwx) : ORIGIN = 0x20005978, LENGTH = 0x3a688 uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4 bootloader_settings_page (r) : ORIGIN = 0x000FF000, LENGTH = 0x1000