FreeRTOS trace tool for Arduino Mega

Hi All,

I am using FreeRTOS in my Arduino Mega 2560 project. My code has four tasks defined and I am running out of memory. I want to optimize the heap allocation. How can I do that? Is there any trace tool available?
There is a tool called "Tracealyzer" (http://percepio.com/). But it seems not supporting for Arduino.

Running out of Dynamic memory (SRAM, 8K) or flash memory (256K)?

Hi CrossRoads,

Thanks for your reply. I assume the memory is insufficient. The Arduino is stuck in the Uploading. I can't upload the code to the board. When I reduce the allocated task heap size Uploading can be done to the board. I just want to know how much memory is used by each task.

Sometimes when it gets stuck in uploading the cause may be a missing " in a Serial.print ("some text"); statement, check yours.
Does the code successfully verify/compile? (Tools:Verify, or the left-most arrow of the menu)

I don't know how to help on your code analysis by task.

I was looking just out of curiosity, I don't otherwise have a clue about FreeRTOS.

With that said it looks like you have control of the stack size when a task is created, and the remaining 8k of SRAM memory is shared as the heap (e.g. for C++ objects and malloc() ). Perhaps the uxTaskGetStackHighWaterMark can help you tune the stack size.

I am also curious what you are trying to do within each task.