Skip to Content
Hands-On RTOS with Microcontrollers
book

Hands-On RTOS with Microcontrollers

by Brian Amos
May 2020
Intermediate to advanced
496 pages
13h 54m
English
Packt Publishing
Content preview from Hands-On RTOS with Microcontrollers

Static memory

Static memory's lifespan is the entire duration of a program. Global variables, as well as any variables declared inside functions using the static specifier, will be placed into static memory and they will have a lifetime equal to that of the program.

For example, both globalVar and staticVar are located in static memory and will persist for the entire lifetime of the program. The initialization of staticVar only occurs once during the initial program load:

uint8_t globalVar = 12;void myFunc( void ){  static uint8_t staticVar = 0;  ...}

When variables are declared as static, memory is guaranteed to be available. All of the global and static variables defined by the program are placed into their locations during the linking phase. ...

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 - Second Edition

Hands-On RTOS with Microcontrollers - Second Edition

Jim Yuill, Penn Linder

Publisher Resources

ISBN: 9781838826734Supplemental Content