FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2009 Threads] occasional data abort with freertos and lpc22Posted 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 lPosted 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 lPosted 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 lpc22Posted 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 lpc22Posted 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 lpc22Posted 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 lpc22Posted 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
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|