FreeRTOS does not change how the compiler stores items, be that on the
stack or in registers. It is a problem with the measurement on that
particular device. Another user mentioned the same thing recently but I
don’t think it was concluded. However it is known that the stack
measurement doesn’t work on devices that have segmented memory spaces
(base/offset registers, rather than a linear address space).
But, number of “0xA5”(the value present the stack while creating the task) present in the stack of the perticular task is equal to the calculated value given by the “uxTaskGetStackHighWaterMark”.
Is there any other method method to calculate the stack size for segmented memory spaces?
is this issue , alsoavailable in the never version of the RTOS?
But, number of “0xA5”(the value present the stack while creating the
task) present in the stack of the perticular task is equal to the
calculated value given by the “uxTaskGetStackHighWaterMark”.
Yes, that is how it is supposed to be. I’m confused, is this working
for you then? Your original post seemed to indicate it wasn’t working.
If it’s not working then you can step into the
uxTaskGetStackHighWaterMark() function in the debugger to determine
where it is erring.
But, If I Increase local variables in the task, then stack should grow right? But it is not growing.same number of 0xA5’s are availble as same as before adding the local variables.
You told in segmented models, the stack stack size is not working. usually this device is a segmented model only. But heap is stored in the Linear address from 0x2000 to 0x3FFF. here also it will not work?
Ignore the segmented thing for now, as it seems to be working.
Are you sure your compiler is allocating the variables on the stack?
Perhaps it has put them elsewhere - although as I recall that device has
very few registers so the stack would seem to be the most likely place.
Can you show the code that is declaring the local variables.
temp[30] is the local variable here. It is added newly. And i have 15 tasks all the tasks having same stack measurement. As per my understanding for temp[30] 30*2 = 60 bytes of memory should allocate. Is this correct?
i dont know why this is behaving like ? i configured the stack size of 150.
I think you would have to look at the code generated by the compiler.
Some compilers [for very small devices] will use overlays where multiple
variables are placed in the same memory if the compiler can determine
that there is no way for them to be needed at the same time.
So, As per your above comments i am concluding that , the local variables or Global variables will not goes to stack of the task(beacuse this is the heap memory). Hence stack of the task is not growing.
I can’t see that you posted any asm code. If you did, unless it was
obvious from the code, I would probably need to look up the instructions
anyway. Try posting the asm code for the function entry and we can see.
Didn’t notice before. The variable is declared static, which means it
will not be on the stack. Static variables will never be on the stack -
this is more of a C question than a FreeRTOS question.