STR91x with GCC?

fabtor wrote on Thursday, August 10, 2006:

I need FreeRTOS on STR91x with GCC.
I’m a newbie on FreeRTOS and i need a point of start.
Can i use a IAR STR9x1 files? (freeRTOS/Source/Portable/IAR/STR91x)
Please help me.

nobody wrote on Thursday, August 10, 2006:

See this:

fabtor wrote on Thursday, August 10, 2006:


Thanks for the reply but the post is refered to ARM7. I need support for ARM9.
In freeRTOS there is a PORT to STR910-eval using IAR Development Tools. I need to port freeRTOS on the same board using GCC.
My question is if i can use the files in the IAR/STR91x as point of start or not.

rtel wrote on Thursday, August 10, 2006:

The link still provides valid information, but uses a GCC port as the basis, whereas there is not yet a GCC port for the STR9.

There are very few differences in the FreeRTOS code between the arm7 and 9, but you will need to convert the IAR files to GCC format and syntax.

I suggest you take a look at a port for which *both* IAR and GCC versions are already in existance.  For example, the SAM7X or LPC2000 port (yes these are ARM7, but the same principals apply).  Comparing these will give you a good idea of what is needed to convert an IAR style port.c file to a GCC style.

GCC is actually easier to use as you can use inline assembler more easily, and declare functions as being ‘naked’.  This means whereas the IAR ports require a port.c file and a port.asm file, the GCC equivalent require only the C file.

Probably not as much detail as you want, but:

+ Take a look at the portasm file included in the IAR port of the SAM7X or LPC2000.  This contains just a few lines of ASM to save and restore the context.

+ Compare this to how the GCC port does the same thing within the port.c file.  You should note that it declares the same (or equivalent) functions in C as the IAR port declared as assembly.  The C functions will be declared as naked to prevent the compiler generated function prologue code being generated, then use inline assembly to save/restore the context.  This level of control cannot be done in the IAR version hence the asm file is needed.

+ You will need a startup file, this must ensure the IRQ and Supervisor mode stacks are setup, and that main() is called from Supervisor mode.  Again you can look at an ARM7 equivalent to see how this is done.

+ One thing to note:  The IAR ARM9 port saves and restores the task context before any interrupt function is called.  The ARM7 ports save and restore the context within the interrupt function.  This means that in the ARM9 port the interrupt functions are just defined as standard functions with (no irq keyword or special processing, etc.).  This is quite a neat solution but has the overhead of saving and restoring the context each time.  Either way it is somewhere where the ARM7 and ARM9 ports differ so cold cause you confusion.

Not sure if I’m making sense.  Let me know.  Take a look at the files then ask any other questions you might have.