Quality RTOS & Embedded Software

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




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists