FreeRTOS & AT91SAM7S256

I am having trouble getting FreeRTOS (5.4.2) to work on my AT91SAM7S256. Has anyone successfully run their AT91SAM7S256 with FreeRTOS (there is one project by “Spaude” online, but it is very old)? I would like to add this topic to my journal/tutorial I mentioned on another thread.

Details:

I am using lightly modified AT91SAM7X256 port files (the AT91SAM7S64 port uses co-routines). The program I am running in SRAM is a simple set of two tasks - one that turns the status LED on, one that turns it off. Ideally at a tick freq of 10Hz, I should see blinking. I have also tried a single task with a blink routine, which also freezes.

The thing that makes this difficult is that it frequently crashes my debugger, but I have noted the following:

  • The code is functional before the scheduler kicks in.

  • Once the scheduler kicks in, it correctly selects the highest priority task and executes it.

  • If I call any of the scheduling methods (like vTaskDelay or taskYield) the program will fail to “tick” even though the interrupt is enabled. If I do not, sometimes the vPreemptiveTick in portISR will fire a few times on schedule, then never fire again.

  • Context switching does not function, or only functions once.

As far as I can tell the tick interrupt is being properly cleared. My guess is that somewhere deep within the bowels of the context switcher there is a problem. I can’t actually get the debugger to go this deep into the execution.

Anyone? Somebody has to have used this chip with some RTOS before…

I took a stab at using FreeRTOS on the AT91SAM7S64 board, but ran into enough difficulties like yours that I put it aside. :frowning: I might come back to it later (or eCos or Nut/OS) once I start doing more complicated things, but for now I’m just using a hand-rolled scheduler+timer loop kind of thing.

I brought up that RTOS on an Atmel AVR mega128 and on an NXP LPC2106. Not too hard. I’ve never used Atmel’s ARMs - I prefer NXP’s line.

wiml, there is actually a dedicated AT91SAM7S64 demo in FreeRTOS. It uses coroutines instead of a fully preemptive scheduler though.

I’ve made some sideways progress since posting - I think those problems were caused by my use of Atmel’s startup code instead of FreeRTOS’s, which configures the timers differently. I switched to the boot.s and the linker file they provided, but now I get linker problems…

I feel the solution is to transplant the guts of FreeRTOS’s boot.s into Atmel’s board_cstartup.s in a way that Atmel’s Flash linker file doesn’t complain. If anyone has a recent example of a FreeRTOS AT91SAM7S256 project, I would greatly appreciate seeing your linker file, startup assembly file and makefile.