nobody wrote on Wednesday, February 07, 2007:
I’m having a very difficult time getting FreeRTOS running on the Atmel AT91SAM7X-EK evaluation board. I’ve got FreeRTOS 4.1.3, GNUARM 4.10, and newlib, and am unable to get either the lwIP_Demo_Rowley or even a simple light blinker to work.
After adding a syscalls.c (stubbed, except for _sbrk, which is implemented as per Red Hat’s documentation), the lwIP demo compiles, but crashes with an undefined instruction in udp_recv.
A simple application (full code available on request) does better, but exhibits strange behavour: if I just let the code run, it dies with a data abort after a few ticks have elapsed. Depending on what debug stuff I’ve put in, it either dies towards the beginning of portRESTORE_CONTEXT, as called from vPreemptiveTick, or towards the end of vTaskSwitchContext, at the listGET_OWNER… line.
In both cases, it looks like the pxCurrentTCB variable is being set to something random (in the former crash, it’s 0xa5a5a5a5, which is suspiciously like some guard value, and in the latter case it’s in the high 0xb000s).
That’s not the weird part, though. If I attach a JTAG debugger (SAM-ICE, with Segger’s GDB server), and set a breakpoint in vPreemptiveTick, the code runs fine if I hit “continue” after the breakpoint. On the other hand, even with the debugger attached, and no breakpoint, I get the same crash.
I scattered various debugging traces throughout the code, looking for a corrupted pxCurrentTCB. What’s weird is that in a few cases, including the trace statements made everything work!
Compiling with -fomit-frame-pointer made the code go longer (about 15 ticks), but it still crashes.
Any help would be appreciated.