“I already seen some discussions about LPC2368 in the forum, I didn't
find it for IAR at the new versions of IAR, so I suppose that "work"
it's not so easy that they don't share or not possible :-).
”
There is an IAR port layer for the LPC2000, with accompanying demo projects. Converting this to be correct for the LPC23xx should not be a big job, and it sounds like you have an understanding of what is required already.
There are already LPC2000 and LPC23xx port layers for GCC, and these can be examined to see what the differences are. However, the syntax required between GCC and IAR is going to be very different, so its best to start with the IAR files, then edit the files as required to make them correct for the 2368.
One way to do this would be to:
1) In the FreeRTOS directory tree, create a directory called FreeRTOS\Source\portable\IAR\LPC23xx, and into this directory copy all the files from the FreeRTOS\Source\portable\IAR\LPC2000 directory. This will hold the modified port layer files.
2) Also create a directory called FreeRTOS\Demo\ARM7_LPC2368_IAR, and into this directory copy all the files from the FreeRTOS\Demo\ARM7_LPC2129_IAR directory. This will hold the demo project workspace and files.
3) In IAR Embedded Workbench, open up the .eww file located in the new FreeRTOS\Demo\ARM7_LPC2368_IAR directory and check that it builds. This will then be a good starting point, albeit targeted at the wrong CPU derivative.
4) In the IAR project workspace you will see a folder called "Scheduler Source". From that folder (within the IDE) remove port.c and portasm.s79 as these will be located in the LPC2000 directory. In their place add the files that have the same names from the directory created in step (1) above. Try compiling again - no idea what will happen but it should still compile as the files thus far are identical.
5) Bring up the project options by pressing ALT+F7. Under the category "General Options" (comes up by default) you will see a tab called "Target" on which you can select the LPC2368 as the CPU derivative. Next select the linker category, and ensure the linker file being used is correct for the LPC2368 [you may have to search for the correct linker file in the IAR directory, I tend to copy the files into the project directory for portability].
6) Open up FreeRTOSConfig.h from the demo directory created in step (2). At the top you will see a device specific header file being included - change this to be correct for the LPC2368.
7) Next you will have to inspect and compare the Source/Portable/LPC2000 and Source/Portable/LPC23xx files to see what differences there are and make the same changes to the IAR equivalents that are now included in your IAR workspace. As you already mentioned the timer configuration is a bit different, but you should be able to see the differences easily enough.
“When I change the ASM ( port SAVE and port RESTORE ) it change the
result, but in fact, I can go far with it.
”
You should not need to change any asm code (probably), but with the IAR projects the interrupt service routines need wrappers that are placed in asm files - whereas the GCC equivalent uses naked functions in C files instead. See the section "An example of an ISR with context switching capabilities" on the following page http://www.freertos.org/portlpciar.html .
“The big issue is that in IAR there is no possible to call the code
like in GCC ( because of naked attribute - that's why the code use ASM
MACRO )
So how to make SAVE and RESTORE totaly compatible calling this 2 lines :
( void ) ulCriticalNesting; \
( void ) pxCurrentTCB; \
”
Creating your project from the existing LPC2000 project as described about should prevent you having to change anything, I think.
Regards.