rtel wrote on Monday, July 24, 2006:
It should be straight forward. Here are some notes:
+ Create a directory to hold the new port files. This should be something like FreeRTOS/Source/Portable/Keil/STR9.
+ Copy the FreeRTOS/Source/Portable/IAR/STR9 files into this directory.
+ Open FreeRTOS/Source/include/portable.h and add a new line something like:
+ Create a new directory to hold the new demo app files. Something like FreeRTOS/Demo/ARM9_STR91X_KEIL. Create a new uVision project targeted at the STR91x and a new main.c file in this directory. Also copy the FreeRTOSConfig.h file from the IAR STR9 demo into this directory.
+ In your new project include the following files:
+ Make sure header files can be located in the following directories
+ Check the startup code that is included in the project. Ensure this includes a stack allocation for IRQ and supervisor modes. You can take the values from the IAR equivalent. In addition ***ENSURE THAT MAIN IS CALLED FROM SUPERVISOR MODE***.
+ Convert the IAR syntax in the files that were copied from the STR9 port layer to Keil format. Code that uses a separate assembly file for IAR can probably be incorporated into inline assembly when using Keil. Use the Keil ARM7 port for examples.
However, the easiest way to do this might to be to take the example interrupt handling mechanism from the IAR code. If you look in the IAR example (function IRQHandler in file FreeRTOS/Demo/ARM9_STR91x_IAR/91x_vect_IAR.s) you will see that IRQ interrupts do not read the interrupt controller directly but first jump to IRQHandler. This saves the task context, then obtains the handler address from the interrupt controller, then calls the interrupt handler just like an ordinary function. This removes the reliance on the compiler specific extensions like __irq keywords, but has the disadvantage of saving the context on every interrupt which might be wasteful.
This part will take a bit of fiddling around, keep checking the Keil ARM7 example.
+ Write a small task along the lines of:
void vATask( void * pvParameters )
for( ;; )
vTaskDelay( 250 );
+ Get it to compiler. Some hassle here no doubt but it should not put up too much of a fight.
+ In your main.c file, setup any hardware necessary (see prvSetupHardware() in the main.c file for the IAR demo). Then create the task just defined, and start the scheduler. You can see examples of this again in the IAR example.
+ If nothing happens, step through the code and see where it goes pair shaped. First place a break point on main() to see if you get through the startup code. Next on where the scheduler is started to see if you get through the hardware init code. Then finally step through the scheduler being started. If there are any problems starting the scheduler report back here where the problem occurs.
Also check out the following link: