FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! 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.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [October 2008 Threads] uxTaskGetStackHighWaterMark problem?Posted by graham clark on October 19, 2008 Hi, I'm using FreeRTOS 5.0.3 on a PIC32 and just I've started to use uxTaskGetStackHighWaterMark() to determine my stack usage. However I'm getting some strange values returned from it. As far as I can see it should return the number of words available on the stack. On the PIC32 a word is 4 bytes. Looking at the code it seems to return the number of 16byte words remaining!
while( *pucStackByte == tskSTACK_FILL_BYTE ) { pucStackByte -= portSTACK_GROWTH; usCount++; }
usCount /= sizeof( portSTACK_TYPE );
return usCount;
posSTACK_GROWTH is set to -4 by FreeRTOS, so the pointer moves from low to high memory couting 4 bytes at a time until a byte indicating stack has been used.
This is OK but then it adjusts the counter by dividing by 4 and returning this. This appears to be the number of 16 byte words remaining in the stack. Any comments?
Graham
RE: uxTaskGetStackHighWaterMark problem?Posted by Richard on October 19, 2008 Oops, my bad. portSTACK_GROWTH should be set to -1, not -4.
I have corrected this in the SVN head revision and it will get included in the next release.
Thanks for pointing this out.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|