rtel wrote on Friday, January 20, 2006:
You are probably best off starting with a GCC port.
Here is a suggested route:
+ Create a directory as FreeRTOS/Source/Portable/GCC/STR71x.
+ Copy into this new directory the files from the FreeRTOS/Source/Portable/GCC/ARM7_AT91SAM7S directory.
Now working in the new directory, you need to change the SAM7 files to work with the STR71x. As both are ARM7 only the peripheral information needs changing.
+ Open up the port.c file from the new directory and the port.c file from the existing IAR STR71x port.
+ Find the function prvSetupTimerInterrupt(). This sets the timer used to create the RTOS tick. Replace the workings of the function in the new port.c with those from the existing STR71x port.c. You may also need the #defines and #includes from the top of the file (replace the SAM7x defines and includes with those relevant to the STR71x). I think actually that prvSetupTimerInterrupt() uses library functions on the STR71X and might not be quite correct, but don’t worry about this for now.
+ Next open portISR.c (this is the ARM mode stuff). The interrupt handlers vNonPreemptiveTick() and/or vPreemptiveTick() have some code that clear the interrupt. This is specific to the peripheral and the SAM7 version again needs replacing with the way the interrupt is cleared in the STR71x version (note that the IAR version has this code in the port.c file as it mixes ARM and THUMB mode in the same file. In the IAR version the function is called vPortNonPreemptiveTick(), and you need the WDG->SR = 0x0000;portCLEAR_EIC(); lines).
+Now the timer peripheral is correct for the STR71x and the ISR clears the interrupt correctly - you have to actually setup the interrupt vector. The IAR port loads the vector table manually in a file called vect.s79 which can be found in the FreeRTOS/Demo/ARM7_STR71x_IAR directory.
I think that might be it as far as the kernel code goes. I’m sure there will be other minor changes needed when you come to compile it.
You also need a makefile, startup code and linker script for the STR71x. I suggest taking these from an existing GCC demo project and editing them accordingly.
Note that stacks need to be setup for IRQ and Supervisor mode and that the processor MUST BE IN SUPERVISOR MODE when the scheduler is started. It is easiest to achieve this by switching to supervisor mode prior to calling main(), and this is what the existing GCC demo’s do.
You can place the makefile, linker script and startup code in the FreeRTOS\Demo\ARM7_STR71x_IAR directory (make sure the makefile uses the correct (new) port files from the directory just created). The main.c file in that directory setups up the processor as required.