Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Measuring Stack Usage

Posted by razed11 on November 13, 2015

The two stack checking techniques do not meet my needs (assuming I understand them). I'd like to profile my stacks and then adjust them to have a certain amount of margin. If I knew where a task stack begins, its size (the same in our application), and a known pattern is written to them then I can download the memory and analyze it after exercising the system rather than compute anything at run-time.

Any suggested approaches?

Thanks.


Measuring Stack Usage

Posted by rtel on November 13, 2015

This is something that is intended for the next release: http://sourceforge.net/p/freertos/feature-requests/95/ not that that helps you immediately.

When a stack is created it is filled with 0xa5 - so there is already a known pattern in the stack.

There is also a function that will return the maximum amount of stack that has ever been consumed since the task was created: http://www.freertos.org/uxTaskGetStackHighWaterMark.html

The pxStack member of the task control block points to the start of a task's stack. Due to our strict data hiding policy, you cannot access TCB members directly, but you can view them in the debugger. For example, to view the start of the stack for the currently running task you can view pxCurrentTCB->pxStack. Some debuggers will require a case as follows ( ( tskTCB * ) pxCurrentTCB )->pxStack.

Regards.


Measuring Stack Usage

Posted by xz8987f on November 13, 2015

If you are using GNU tools, there is an approach to measure the amount of stack used, see http://mcuoneclipse.com/2015/08/21/gnu-static-stack-usage-analysis/.


Measuring Stack Usage

Posted by razed11 on November 13, 2015

This is great news. FreeRTOS is on our roadmap for many products to come so we can take advantage of the new feature during the next availalbe product cycle (which happens several times a year for us).

I'm fine with using the debugger. I'm just trying to add stack checking to our checklist for milestones. With 7.0.2 does it fill the stack with the pattern? Can you suggest a modification (to save me time hunting through the source). A product shipping soon has this version. We've moved to 8.X for following products.

Thanks,

Kenny


Measuring Stack Usage

Posted by razed11 on November 13, 2015

Erich: Thank you. Nice write up! We are using GNU and Eclipse for a Cortex-A9 which I am a little new to (IAR for many years before) so I am still learning some of the tricks. I'll try it right now.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS