January 2019
Intermediate to advanced
458 pages
10h 35m
English
Whether one needs to initialize the stack on the MCU that one is programming for depends on how low-level one wishes to go. When using the C-runtime (on AVR: avr-libc), the runtime will handle initializing the stack and other details by letting the linker place naked code into init sections, for example specified by:
__attribute__ ((naked, used, section (".init3")))
Preceding the execution of any of our own application code.
The standard RAM layout on AVR is to start with the .data variables at the beginning of the RAM, followed by .bss. The stack is started from the opposite site of the RAM, growing towards the beginning. There will be room left between the end of the .bss section and the end of the stack illustrated as follows: ...