How to port to new ARM9 CPU?

jeffowen1 wrote on Monday, August 16, 2010:

I would like to use FreeRTOS with an ARM9 LPC3250.  I purchased the guide, but it does not seem to cover porting to new CPU’s except to say start with a current project.  It also lists the basic steps to set up a project in the IDE.  Seems like it would be important to set up an interrupt for the RTOS, but i did not see any mention of that.  Are there any guidelines on how the tick IRQ should be setup?  Timing recommendations for the periodic IRQ?  Is it in the code?  I have not started digging into the source yet, so it could be documented in there.  

As far as starting with an existing project, the Atmel AT91SAM9 (ARM9) Port appears to be similar (both ARM9), but it uses the IAR tools and I was planning on using the Rowley tools, not to mention an Atmel CPU rather than an NXP CPU…

Any suggestions as to which project to start with and how to set up the RTOS IRQ would be greatly appreciated!

davedoors wrote on Monday, August 16, 2010:

There is a bit of information here http://www.freertos.org/FreeRTOS-porting-guide.html but it does not go deep enough for what you want.

I would probably start with an ARM7 GCC port if there are no ARM9 ports that are suitable as a base. To the RTOS ARM7 and ARM9 look the same.

prvSetupTimerInterrupt() in port.c will definitely need changing. Get the tick interrupt working in isolation first to keep things simple. Just have it increment a variable, then when you are happy it is firing at the right frequency you can add in the real code, using the ARM7 base as a reference. The real code should save the context (again use the ARM7 code as a reference), call vTaskIncrementTick(), then vTaskSwitchContext() (this does not switch context but select the next task to run) then restore the context of the selected task.

Make sure you have SWI interrupt call vPortYieldProcessor() and read the fifth post here about IRQ interrupt https://sourceforge.net/projects/freertos/forums/forum/382005/topic/3797181 .

Stacks need to be configured for IRQ and Supervisor modes, then also for any other modes you use specifically, and make sure main() is only called in Supervisor mode.

jeffowen1 wrote on Monday, August 16, 2010:

Thank you very much, that should get me started in the right direction!