Bloat Bdscr (Exclusive Deal)

.bdscr : ALIGN(4) KEEP(*(.bdscr)) > FLASH Instead of:

5.1. Linker Script Optimization Replace:

Example bloaty command:

bloaty -d sections firmware.elf | grep bdscr Bloat in bdscr is a subtle but impactful inefficiency in embedded and low-level software. It stems from over-alignment, static allocation, and leftover debug structures. Detecting it requires basic binary inspection tools; fixing it yields measurable gains in size, speed, and maintainability.

gcc -DNDEBUG -ffunction-sections -fdata-sections ... ld --gc-sections -o output.elf input.o Or manually strip after linking: bloat bdscr

bdscr_t *blocks; blocks = malloc(actual_count * sizeof(bdscr_t)); In release builds:

bdscr_t blocks[256]; // 256 * 32 bytes = 8KB Use: Detecting it requires basic binary inspection tools; fixing

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.