Skip to Content
Hands-On Embedded Programming with C++17
book

Hands-On Embedded Programming with C++17

by Maya Posch
January 2019
Intermediate to advanced
458 pages
10h 35m
English
Packt Publishing
Content preview from Hands-On Embedded Programming with C++17

Stack and heap

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: ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers

Hands-On RTOS with Microcontrollers

Brian Amos

Publisher Resources

ISBN: 9781788629300Supplemental Content