Skip to main content
Chandler
Associate II
March 15, 2022
Question

Adding a variable breaks the build - Is it possible to see the memory boundaries of individual RTOS tasks?

  • March 15, 2022
  • 3 replies
  • 1384 views

I am assuming this is a memory boundary issue, but maybe it is something else: I have an application that runs just fine, using a simple push button interrupt serviced by its own Free RTOS task, which is suspended until triggered. For some reason, when I add a completely unrelated variable to the Touch GFX model class **larger than a bool type**, the task throws a hard fault. It's like I'm on a boundary; I've increased task sizes beyond anything reasonable to expect, but still adding that one variable to the .hpp file breaks the build. Any similar experiences to share are appreciated.

This topic has been closed for replies.

3 replies

KnarfB
Super User
March 15, 2022

FreeRTOS has a config for Stack checking, see https://www.freertos.org/Stacks-and-stack-overflow-checking.html. This may help validating that you have allocated enough stack space for each task.

hth

KnarfB

Chandler
ChandlerAuthor
Associate II
March 16, 2022

Thank you

mattias norlander
ST Employee
March 16, 2022

Are you using C library functions like printf/strtok/...? If so, are have you added the thread-safe solution?

In the CubeIDE User Guide you find a lot of info on how to compile FreeRTOS to use the FreeRTOS debug views. These views may give you a clue.

Chandler
ChandlerAuthor
Associate II
March 16, 2022

Thanks for the advice. I will investigate.

Chandler
ChandlerAuthor
Associate II
March 16, 2022

Thank you for that advice. I will investigate.