FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.

Stack Over Flow error

Do you have the source code for BeaconSend()? If so view the task's
stack in the memory region. Use the debugger to stop on entry to the
task. Next get the stack pointer used by the task from the register's
window in the debugger and open a memory view at that address. You
should see the stack is filled with 0xa5. Now put a break point where
SendBeacon() is called and, watching the stack in the memory window,
step into the function. You will see the 0xa5's getting overwritten as
you step through the function - at what point do all the a5's disappear,
so all the stack is consumed?

Stack Over Flow error

What is that mean A5 value and Disappearing A5 means that stack is overflowed ?

0xA5 is just a funny pattern: b'10100101'. Indeed it is used to detect how much stack space has been used.

Important: do not use a compiler options that enable checks for stack overflow. That option often causes stack overflows.
Please check if this was included.

The FreeRTOS stack warning options normally work nicely. But be aware: the SP moves so fast (in interrupts, during task swaps), that an overflow maybemissed.

An alternative method is the following: give more than enough stack to the tasks and measure the lowest stack space available for every task during a long run. If you add N percent, you should have a reliable estimate.

Stack Over Flow error

What do you mean with "system stack", is that the initial stack that is used before FreeRTOS is running?

I suppose the size is 800 words, meaning that 3.2 KB of RAM is assigned to that initial stack.
You should also see how much is really used, or use the RAM space for other purposes once the kernel is running.

I set stack depth to 300.

Is this the stack of the task, I suppose?

Have you tried a bigger value already?

You can also try debugging to see what happens. Try to follow the value of SP when stepping through the code, especially when calling mac_tx(). You might have to step through the assembler instructions.