#1 Running FreeRTOS on the Atmel AT91SAM7x256 evaluation kit

In this section, as my first experiment with FreeRTOS, I try to run a demo application on the Atmel AT91SAM7x256 evaluation kit. The board has both Ethernet and USB interface along with a dual RS232.

I. Download and install the compiler

For this trial, the ARM compiler from CodeSourcery is used. Windows users can install the toolchain from Yagarto (GCC 4.5.2 at the time). Both the CodeSourcery and Yagarto compiler prefix is arm-none-eabi-. Prior to use the compiler, the environment PATH variable must be updated according to the location of the installed compiler. The default location of the Yagarto compiler is C:\Program Files\yagarto\bin\.

II. Download / Compile FreeRTOS application

Download and extract the latest source code from sourceforge. The AT91SAM7x256 demo application is explained on FreeRTOS web site. When compiling under Linux host, few modifications of the source code is required. Because file naming under Linux is case-sensitive, the following updates are required (newer FreeRTOS version might have these bugs fixed):

_>1 In FreeRTOSV6.1.1/Demo/ARM7_AT91SAM7X256_Eclipse/RTOSDemo/makefile, change the file name ./webserver/emac_isr.c to ./webserver/EMAC_ISR.c.

_>2 Additionally, in the makefile, update the compiler name prefix according to your compiler, .e.g.:

_>3 Finally, in FreeRTOSV6.1.1/Demo/ARM7_AT91SAM7X256_Eclipse/RTOSDemo/main.c, change the line #include "uip_task.h" to #include "uIP_Task.h".

Run make from the directory FreeRTOSV6.1.1/Demo/ARM7_AT91SAM7X256_Eclipse/RTOSDemo/. The resulting binary and elf files are RTOSDemo.bin and RTOSDemo.elf.

III. Running the demo application

Program the binary image ( RTOSDemo.bin ) on the target flash at address @0x00100000 using OpenOCD [18] or an Hardware debugger. The demo application uses around 70KB of the 256 KB flash. The AT91SAM7X256 demo application starts multiple tasks. A task is in charge of controlling the evaluation kit LEDs mounting on the primary side of the PCB, you should see some LEDs activity while the application is running. The default kit IP address is ( set from FreeRTOSConfig.h ). The demo application includes a small webserver build on top of the uIP stack. While accessing the target webserver, I encountered two different behaviors depending of the compiler used:

- CodeSourcery: multiple sofware crashes observed, the web page never finishes loading. The problem has not been investigated yet but seems to be related to the dynamic handling of the web page content..

- Yagarto: no sofware crash observed but the web pages did not provide any statistics as specified by the FreeRTOS web page mention earlier. Some investigation shows that the CGI calls structure is empty because the data section is not initialized properly, from GDB:
p &__data_beg_src__
$2 = (variable (not text or data), no debug info*) 0x3121ac ""
$3 = (variable (not text or data), no debug info *) 0x1121ac ""
The symbol __data_beg_src__ should be equal to the end of the text section but for some reason is incremented by the ram start address. Replacing the symbol __data_beg_src__ by __end_of_text__ in boot.s fixed the problem, the web page now loads correctly with all statistics available:

The USB is correctly detected by my Linux host machine:
[ 2159.283584] usb 2-1.2: New USB device found, idVendor=ffff, idProduct=0002
[ 2159.283588] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2159.283592] usb 2-1.2: Product: FreeRTOS.org Mouse
[ 2159.283594] usb 2-1.2: Manufacturer: FreeRTOS