IAR + LPC213X + Thumb code

enrico_entity wrote on Wednesday, November 23, 2005:

I am testing about usage of FreeRTOS in LPC213X series with IAR as compiler.
I verified that FreeRTOS can work in Thumb mode doing only a change in port.c file inside port\LPC2000\IAR folder.
I replaced this macro definition:

    #define portINITIAL_SPSR                ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */

with these:

#if __CPU_MODE__ == 1
    #define portINITIAL_SPSR                ( ( portSTACK_TYPE ) 0x3f ) /* System mode, THUMB mode, interrupts enabled. */
#elif __CPU_MODE__ == 2
    #define portINITIAL_SPSR                ( ( portSTACK_TYPE ) 0x1f ) /* System mode, ARM mode, interrupts enabled. */
#else
    #error "__CPU_MODE__ not equal to 1 or 2"
#endif

and now I can build my project either in ARM or in THUMB mode
I hope this can help you to add more versatility to FreeRTOS!!!
GoodBye
Enrico Dr. Dalla Mariga

nobody wrote on Wednesday, November 23, 2005:

Thanks for the input, but doesn’t the IAR LPC2000 demo already uses THUMB mode by default?  All the files are built for THUMB.  Do you mean that you verified that it can run in ARM mode also with your change.

Take a look at the .bat files in the Demo\ARM7_LPC2106_GCC directory.  The set up some environment variables to allow the GCC builds to switch between ARM and THUMB, you can see in the source code where the environment variables are used.

enrico_entity wrote on Wednesday, November 23, 2005:

Yes, that’s right. I make a mistake, sorry…
By default IAR LPC2000 port uses THUMB mode by default and I tested that it runs also in ARM mode.

I would be gratefully if these changes can made in port.c source so that if you select, in IAR IDE environment, to build in ARM mode, FreeRTOS works well (.bat files are useful with GCC but with IAR it is more difficult to use)!!!

Thank you!