Reduced alignment to 4 bytes, changed static array to pointer + malloc, and moved non-critical descriptors to a compressed filesystem.
5.1. Linker Script Optimization Replace:
.bdscr : KEEP(*(.bdscr)) . = ALIGN(4096); // Over-alignment > FLASH With:
bdscr_t blocks[256]; // 256 * 32 bytes = 8KB Use:
bdscr_t *blocks; blocks = malloc(actual_count * sizeof(bdscr_t)); In release builds:
objcopy --remove-section=.bdscr firmware.elf stripped.elf Scenario: A Zigbee IoT hub firmware had a .bdscr section of 64KB, but only 2KB was actually used.
Linker script reserved a 64KB aligned block for OTA descriptor storage due to a legacy flash driver requirement.
.bdscr : ALIGN(4) KEEP(*(.bdscr)) > FLASH Instead of:
