stack location in RAM

antoxaxa wrote on Monday, December 07, 2015:

Hello!
I have a simple question,
how can I find where my task stack begins in RAM?
I use heap_1.c implementation on dsPIC.

Thanks in advance,

rtel wrote on Monday, December 07, 2015:

There is currently a feature request, to be implemented for the next release, to provide a function that provides this and other information on the stack of a task. Currently you would have to inspect the task’s control block manually.

Regards.

tlafleur wrote on Monday, December 07, 2015:

look in the linker map…

On Mon, Dec 7, 2015 at 1:45 PM, Anton antoxaxa@users.sf.net wrote:

Hello!
I have a simple question,
how can I find where my task stack begins in RAM?
I use heap_1.c implementation.

Thanks in advance,

stack location in RAM
https://sourceforge.net/p/freertos/discussion/382005/thread/27ab8afe/?limit=25#c2af

Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/freertos/discussion/382005/

To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/

~~ _/) _/) _/) ``` _/) ~~

Tom Lafleur

heinbali01 wrote on Tuesday, December 08, 2015:

Richard wrote:

Currently you would have to inspect the task’s control block manually.

In case this is not immediately clear to you:

If you put a break somewhere in tasks.c you can see ‘pxCurrentTCB’, which points to the Task’s Control Block of the task which is currently active.

Two fields in the PCB may be of interest:

StackType_t pxTopOfStack; /* Location of the last item placed on the tasks stack. */
StackType_t pxStack; /* Start of the stack. */

And beside these two members, it might be interesting to check the actual Stack Pointer SP, which can be found in a window showing the CPU registers.

Lafleur wrote:

look in the linker map…

You will find the location of the stack that will be used at boot time.

For instance, these are 512 bytes of boot stack.

    00000200 a __stack_size__
    ...
    0000fe00 B _stack
    00010000 B _estack

This stack space becomes vacant as soon as the scheduler is started by calling vTaskStartScheduler().
The function xTaskCreate() will have allocated stack space for each of the tasks ( using pvPortMalloc() ).

Regards.

antoxaxa wrote on Tuesday, December 08, 2015:

I could not find anything in the map file.
but the structure pxNewTCB->pxStack was a good hint!

Thanks to all