Reduced alignment to 4 bytes, changed static array to pointer + malloc, and moved non-critical descriptors to a compressed filesystem.
bdscr_t blocks[256]; // 256 * 32 bytes = 8KB Use:
Linker script reserved a 64KB aligned block for OTA descriptor storage due to a legacy flash driver requirement. bloat bdscr
gcc -DNDEBUG -ffunction-sections -fdata-sections ... ld --gc-sections -o output.elf input.o Or manually strip after linking:
Always audit your linker scripts and descriptor data structures – especially when porting code across different flash architectures or toolchains. Reduced alignment to 4 bytes, changed static array
Example bloaty command:
.bdscr : KEEP(*(.bdscr)) . = ALIGN(4096); // Over-alignment > FLASH With: Reduced alignment to 4 bytes
.bdscr : ALIGN(4) KEEP(*(.bdscr)) > FLASH Instead of: