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

occasional data abort with freertos and lpc22

Posted by Forest YU on March 13, 2009
I am using lpc2214 and FreeRTOS now, and I meet a problem. My system include two uart task, one flash led task and a LCD dispaly(touchscreen)task. Interrupt include two uart, timer1 and ext3. When using heap_1.c and I don't delete a task or queue (one task create queue when task run), it some times(several hours or several minutes) enter the data abort mode. From the LR, I find it go to exception from vListInsertEnd() function and read a invalid address from stack of IRQ. When I change to use heap_2.c, this problen haven't appeared for one day test. So I an confused!

Any reply would be appreciated.
Thank you!

RE: occasional data abort with freertos and l

Posted by Dave on March 13, 2009
Have you checked that your stack is not overflowing? That is the most common cause. Other than that there could be a memory corruption somewhere that is clobbering the data structures.

RE: occasional data abort with freertos and l

Posted by Richard on March 13, 2009
You don't say which compiler you are using, but are you writing you interrupt service routines exactly as described on the documentation page for the port you are using? This is especially relevant if you are using GCC. The demo application will provide an example that can be followed too.

Regards.

RE: occasional data abort with freertos and lpc22

Posted by Forest YU on March 13, 2009
Yes, I am sure that the task stack is not overflowing and I also write my interrupt service routine exactly as described on the documentation page for the port. I am using winarm.
Testing for another day, it doesn't happen. I have modified some insignificant parts of the code. I am really confused.
I also think that there would be a memory corruption somewhere that is clobbering the data structures. But it's very hard to find.

Thanks for your replies.

RE: occasional data abort with freertos and lpc22

Posted by DR1 on March 16, 2009
Icefishhead,

One problem I had with the ARM7 and GCC that was very hard to find: GCC has a bug that only appears under the following conditions: thumb mode and "omit frame pointer = no". So, in my case the solution was to turn on "omit frame pointer". The compiler generates code that corrupts registers (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32838).

Good luck!

RE: occasional data abort with freertos and lpc22

Posted by DR1 on March 16, 2009
Sorry, the link was broken:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32838

RE: occasional data abort with freertos and lpc22

Posted by Glen B. on March 21, 2009
The problem with using omit frame pointer is that debugging can be tough due to debugger's inability to properly unwind the stack. I have a 'fix' to FreeRTOS for ARM7 that allows use of 'omit frame pointer = no'.

In macro portSAVE_CONTEXT() in file portmacro.h you need to open up some space on the stack where FreeRTOS places the task context so the any stack data that might be clobbered by the context due to the flakey compiler code is in the space and hence is not clobbered.

I add:

SUB R0, R0, #32

(with the appropriate syntactic sugar for the macro generation) just before the comment

/* Push the return address onto the stack. */

This opens up 32 bytes just before the first item (return address) is put on the stack with

STMDB R0!, {LR}

The 32 bytes was determined empirically... I have no way to know if this is the maximum amount that the flakely compiler code ever places the stack pointer behind to true top of stack. I have never had a problem since settling on 32 bytes.

There is no need to strip this off the stack in portRESTORE_CONTEXT() because the existing code takes care of it.

Glen


[ 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