rtel wrote on Thursday, November 17, 2005:
Open the existing Keil demo then:
1) From the Project menu, select "Select device for target FreeRTOS", and select the SAM7.
2) Open the file FreeRTOS\Source\portable\IAR\AtmelSAM7S64\port.c. This is the port.c file for the IAR compiler. It contains the code that will setup the timer for the SAM7 in a function called prvSetupTimerInterrupt(). Overwrite the prvSetupTimerInterrupt() function in the Keil demo port.c (which is configured to setup an LPC2000 timer) with the version from the IAR port (which is configured to setup a SAM7 timer). There may also be a few #defines at the top of the file that are required to compile the function.
3) Open the file FreeRTOS\Demo\ARM7_LPC2129_Keil\FreeRTOSConfig.h. You will notice it includes the header lpc21xx.h. Delete this line for obvious reasons. You may have to replace it with a header file that defines the registers for your processor. This will become obvious when you try to compile.
4) Also in FreeRTOSConfig.h you will see the definitions for configCPU_CLOCK_HZ, configMINIMAL_STACK_SIZE and configTOTAL_HEAP_SIZE. Set these to values appropriate for your hardware. You might like to just copy the values from the IAR SAM7 (SAM7S or SAM7X demo as appropriate) FreeRTOSConfig.h file which can be found in the FreeRTOS\Demo\ARM7_AT91SAM7S64_IAR directory.
5) The serial port drivers will be incorrect. You can transfer the SAM7X drivers from IAR demo, but for now just delete the files serial.c and serialISR.c from the Keil project.
6) To start with the smallest application prevent all tasks other than the simple LED flash tasks from being started. To do this open main.c, and find the lines and commend out all the lines between vStartIntegerMathTasks and vStartDynamicPriorityTasks, EXCEPT the line vStartLEDFlashTasks.
7) The code to set or clear an LED is defined in the file FreeRTOS\Demo\ARM7_AT91SAM7S64_IAR\ParTest. The Keil project is configured to access the LED’s on the Keil LPC2000 demo board. You will have to update this to access the correct ports to access the LED’s on your hardware. If you are using the Atmel demo board then again you can just copy the files from the IAR SAM7 demo. There are demos for both the SAM7S and SAM7X hardware. Also check the function prvSetupHardware() in the file main.c. This sets the data direction or ports, etc. You will also have to set this appropriately for your hardware.
I’m sure when you compile there will be a few includes, definitions, etc. that need some tweaking, but this should get you 95% of the way.