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

Keeping an eye on stack space

vApplicationStackOverflowHook provides a very simple way of eliminating most of the oddball behavior and halting the application. When enabling configCHECK_FOR_STACK_OVERFLOW #define in FreeRTOSConfig.h, any time a stack overflow is detected by FreeRTOS, vApplicationStackOverflowHook will be called.

There are two potential values for configCHECK_FOR_STACK_OVERFLOW:

  • #define configCHECK_FOR_STACK_OVERFLOW 1: Checks the stack pointer location upon task exit.
  • #define configCHECK_FOR_STACK_OVERFLOW 2: Fills the stack with a known pattern and checks for the pattern upon exit.

The first method checks the task stack pointer as the task exits the running state. If the stack pointer is pointing to an invalid location ...

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