Quality RTOS & Embedded Software

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


Loading

Idle task stack overflow

Posted by Tom Pycke on June 13, 2009
Hi,

To make sure everything is OK during development, I use the stack overflow hook. However, my Idle task stack is overflowing.


Code:
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed portCHAR *pcTaskName )
{
uart1_puts("Stack overflow! ");
uart1_puts(pcTaskName);
uart1_puts("\n\r");
}



Result:
06/13/2009 21:38:52.078 --> Stack overflow! IDLE
06/13/2009 21:38:52.093 --> Stack overflow! IDLE
06/13/2009 21:38:52.093 --> Stack overflow! IDLE
06/13/2009 21:38:52.093 --> Stack overflow! IDLE
06/13/2009 21:38:52.125 --> Stack overflow! IDLE
06/13/2009 21:38:52.125 --> Stack overflow! IDLE
06/13/2009 21:38:52.125 --> Stack overflow! IDLE
06/13/2009 21:38:52.125 --> Stack overflow! IDLE
06/13/2009 21:38:52.125 --> Stack overflow! IDLE
06/13/2009 21:38:52.125 --> Stack overflow! IDLE
06/13/2009 21:38:52.140 --> Stack overflow! IDLE
06/13/2009 21:38:52.140 --> Stack overflow! IDLE
....

(doesn't seem to affect the normalo operation)


Anybody any idea why that is?

Thanks,

Tom

RE: Idle task stack overflow

Posted by Richard Damon on June 13, 2009
It could be that you need to give the IDLE task a bit more stack (perhaps an interrupt function is using more than the demos planed for), or that something else is corrupting the task stack, either through a bad pointer, or some other task declairs a large buffer it doesn;t use all of in a function that corrupts it. My first guess is the interrupt function.

RE: Idle task stack overflow

Posted by Tom Pycke on June 13, 2009
Thanks,
Do the Idle task and the interrupts share the same stack? How do I make it larger?
Yes, I do use a lot of interrupt handling on top of freertos.

RE: Idle task stack overflow

Posted by Richard Damon on June 13, 2009
Unless the processor has a dedicated stack for interrupt routines (ARM processors do, many others don't), then all interrupts will use the stack of whatever task is currently running. In FreeRTOSConfig.h is a define for configMINIMAL_STACK_SIZE which sets the size of the idle task (and most other tasks should set their size based on this plus what additional space they need).

RE: Idle task stack overflow

Posted by Richard on December 31, 2010
On the LPC2000, interrupts use a separate stack (I think most if not all the 32bit FreeRTOS ports use a separate stack for interrupts). It could be that you interrupt stack is too small and that overflowing is corrupting something else to give you this symptom. The interrupt stack size (ARM7 IRQ mode stack in this case) is normally set in the C start up code.

Are you using an idle task hook function? If so, then is that using a lot of stack?

Regards.

RE: Idle task stack overflow

Posted by ARMinator on December 31, 2010
I am getting a similar issue. I haven't tried the suggested solution yet that consists of increasing configMINIMAL_STACK_SIZE.

Before reading this post, my understanding was too that the interrupts use a different stack, which is set in the startup code. When I saw this issue yesterday I did increase the interrupt stack size, from the default 256 bytes to 512. It didn't fix the issue though so I ruled out that the ISR is running our of stack.

I do not use a hook on the idle task.



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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner