-
Notifications
You must be signed in to change notification settings - Fork 8
Description
This is a tracking issue, tabulating size of the .bss section of the app binary. The .bss section is the memory reserved for global variables within the 4 KB of working RAM available to Nano S apps. In the Nano S, there are global variables, and there stack variables that both compete for the same 4 KB of space. Being parsimonious with the globals ensures that there is adequate head room for the stack. (Note global constant variables and other app static data are kept in the flash ram, and so do not compete for the 4KB of working ram. Also there are no heap variables.)
The size of the .bss segment can be retrieved with readelf -S obj/app.elf. Note that the size of the .bss segment also includes the reserved size of the stack. (This guarantees at least a minimum stack size before the linker refuses to link.) Thus, to get the actual size consumed by the globals, you need to subtract out this reservation. The current version of the SDK (1.5.5) sets this reservation to 512 bytes. (The previous SDK reserved 768 bytes.)