- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I’m running FreeRTOS on a PSoC 6 based PSoC 6 CY8CKIT-062-BLE. How do I determine how much heap is being used by each task (and the OS)?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jihe_298791,
1. You can use the API uxTaskGetStackHighWaterMark() to query how close a task has come to overflowing the stack space allocated to it.
FreeRTOS - A FREE RTOS for small real time embedded systems
2. Using configCHECK_FOR_STACK_OVERFLOW , a compile time configuration constant within FreeRTOSConfig.h. There are two methods possible using this option.
FreeRTOS - stacks and stack overflow checking
Refer FreeRTOS documentation for details (links given above).
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jihe_298791,
1. You can use the API uxTaskGetStackHighWaterMark() to query how close a task has come to overflowing the stack space allocated to it.
FreeRTOS - A FREE RTOS for small real time embedded systems
2. Using configCHECK_FOR_STACK_OVERFLOW , a compile time configuration constant within FreeRTOSConfig.h. There are two methods possible using this option.
FreeRTOS - stacks and stack overflow checking
Refer FreeRTOS documentation for details (links given above).
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm confused. Are you saying task heap is allocated on the task's stack?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jihe_298791,
Could you please elaborate your question?
The tasks are allocated memory based on the heap scheme that you have used. What is the memory heap scheme have you used in your project?
For example, if you are using heap scheme 3, then the FreeRTOS scheduler uses malloc() and free() functions to allocate memory for the tasks from the heap memory of the SRAM. This task's stack holds function call return addresses, parameter values, local variables, etc.
If you are using heap_1, then the scheduler creates a single static array of size mentioned in configTOTAL_HEAP_SIZE in .bss section of the SRAM. All the tasks that you create takes memory from this region.
Refer FreeRTOS memory management for details.
Regards,
Bragadeesh
Bragadeesh