diff --git a/Makefile b/Makefile index 01f21b40d..bb10e1506 100644 --- a/Makefile +++ b/Makefile @@ -264,6 +264,7 @@ CFLAGS += \ -mfpu=fpv4-sp-d16 \ -ggdb \ -Os \ + -flto \ -ffunction-sections \ -fdata-sections \ -fno-builtin \ @@ -301,6 +302,8 @@ endif # Defined Symbol (MACROS) CFLAGS += -D__HEAP_SIZE=0 +# Reset_Handler zeroes .bss and calls main directly, so newlib's crt0 is not linked in. +CFLAGS += -D__START=main -D__STARTUP_CLEAR_BSS CFLAGS += -DCONFIG_GPIO_AS_PINRESET # Skip defining CONFIG_NFCT_PINS_AS_GPIOS if the device uses the NFCT. diff --git a/changelog.md b/changelog.md index f1f258879..8849f2502 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ it and is upstream Adafruit history, kept for provenance. - Fixed BLE OTA started from an application's buttonless DFU falling back to the application after about 10 s. The 0xB1 entry now restarts through the 0xA8 path, so the bootloader initializes the SoftDevice itself; the peer data for reconnection survives the reset. - The DFU screen shows upload progress during UF2, serial, and BLE transfers, as a bar in place of the banner. The title reads BOOTLOADER during a bootloader update, ERASE during a factory erase, WRONG FILE for a UF2 this board cannot take, and NO FIRMWARE when DFU starts without a valid application. - A DFU session started after a SoftDevice update no longer ends before it begins. +- Build change, no behavior change: the bootloader is now compiled with `-flto`, which shrinks every image by about 3.3 KB of flash. Section addresses and SoftDevice call sites are unchanged. ## OTAFIX 2.5 diff --git a/linker/nrf_common.ld b/linker/nrf_common.ld index 912250f92..253e84f86 100644 --- a/linker/nrf_common.ld +++ b/linker/nrf_common.ld @@ -135,6 +135,9 @@ SECTIONS __sdata_start = .; __sdata_end = .; __sdata_load_start = .; __tdata_start = .; __tdata_end = .; __tdata_load_start = .; __fast_start = .; __fast_end = .; __fast_load_start = .; + /* Zero-length: the startup's clear loop also walks .tbss/.sbss. */ + __tbss_start__ = .; __tbss_end__ = .; + __sbss_start__ = .; __sbss_end__ = .; .bss : {