5.1. Linker Script Optimization Replace:
gcc -DNDEBUG -ffunction-sections -fdata-sections ... ld --gc-sections -o output.elf input.o Or manually strip after linking: bloat bdscr
.bdscr : ALIGN(4) KEEP(*(.bdscr)) > FLASH Instead of: FLASH Instead of: bdscr_t *blocks
bdscr_t *blocks; blocks = malloc(actual_count * sizeof(bdscr_t)); In release builds: blocks = malloc(actual_count * sizeof(bdscr_t))
Example bloaty command:
Linker script reserved a 64KB aligned block for OTA descriptor storage due to a legacy flash driver requirement.
Always audit your linker scripts and descriptor data structures – especially when porting code across different flash architectures or toolchains.