How to monitor stack usage in a PIC24?

renald_travis wrote on Monday, March 15, 2010:

Hi everyone,
I am a newbie to freeRTOS. I did a baseline software development for a project using freeRTOS on a microchip PIC24F.  The system seems to be working fine with its current heap and stack values. I know that I just got lucky with my numbers. I would like to do a thorough stack and heap analysis as part of my optimization. First, I want to do a stack requirement analysis. Is there any demo code for the PIC24F processor that clearly tells me how to use pxCurrentTCB for the purpose? Also, How do I find out the amount of heap being used by my code?

I would really appreciate any help

Thanks!
Sid

davedoors wrote on Monday, March 15, 2010:

First, I want to do a stack requirement analysis.

See http://www.freertos.org/uxTaskGetStackHighWaterMark.html

How do I find out the amount of heap being used by my code?

If you are using heap_1.c or heap_2.c then simply call xPortGetFreeHeapSize().