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


prvTaskExitError() present at start of call stack.

Posted by illysky on July 3, 2017

Hi All

I am running FreeRTOS v8 and lwIP on STM32F417 - based on STM32F4 cube example.

I have a couple of tasks running including HTTP client and DHCP client. All runs fine for about 24 hours then I get a hard fault.

When restarting and halting in each task (uVision), I noticed at the start of the call stack I was seeing prvTaskExitError. Which is confusing as I thought that only get called when you attempt to leave a task and to that point my tasks are exiting anyway. Sometimes there were even x2 prvTaskExitError in the call stack.

Through trial and error, I changed all my tasks variables to static and I never saw prvTaskExitError in the call stack again, and no more hard faults.

Alot of googling, and I can seem to find anything....Is that normal? I obviously want to make sure I am doing this correctly.

Best Regards


prvTaskExitError() present at start of call stack.

Posted by jalegre2003 on July 3, 2017

As far as I know, the first function in the call stack should always be prvTaskExitError. If the function executing immediately below (the task code) at the call stack exits, the code will get again at prvTaskExitError, effectively trapping the error.

prvTaskExitError() present at start of call stack.

Posted by richarddamon on July 3, 2017

SOME ports setup the prvTasskExitError return, but not others.

I think what happens if you simplify that stack frame enough for your task, is that the compiler might change its stack usage to not setup a stack frame, which may confuse the debugger and not give you the traceback.

The prvTaskExitError address on the stack is totally not a problem, as you shouldn't be returning there anyyway.

prvTaskExitError() present at start of call stack.

Posted by illysky on July 3, 2017

Thank you for your speedy responses, very grateful. That's good to know about the prvTaskExitError.

In relation to the hard faults, when I set up a "simple" task (static variables) - I never see the hard fault, but when I leave them as local (auto) variables in the task, I get an intermittent hard fault (12hrs ish in to runtime) with unaligned memory access fault (always in the tcpip thread of lwip).

Do you have any suggestions to what I could be doing wrong....have you seen this behaviour before? or is it indicitive of something? I appreciate that hard faults are tricky to diagnose - ive exhausted my debug skills!!

many thanks again


prvTaskExitError() present at start of call stack.

Posted by rtel on July 3, 2017

I was going to suggest it might be a stack overflow problem, but it looks like you know it is a misaligned access issue within lwIP. All the same, its best to ensure you have stack overflow checking turned on.

[ 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