Assembler error for Cortex M3 GCC port

Hi I am trying to compile a project for the ARM Cortex M3 core using GCC. The tool I am using is YAGARTO, and the GCC 4.5.1 build inside. When the compiler gets to the port.c file in the ARM_CM3 directory, it exits with the return message: <tempfile>: Assembler messages:
<tempfile>:307: Error: ‘CPSR’ or ‘SPSR’ expected – ‘mrs r0,psp’ The port.c file in question contains such an inline assembler command, which is in the xPortPendSVHandler function. Could this be the cause of the problem? Is there anyone around who knows their way around the ARM assembler, and can determine why this error is returned? Thanks for answers, // Esorol

Assembler error for Cortex M3 GCC port

Which project are you trying to build. I think the standard demo projects use arm-none-eabi-gcc, rather than arm-elf-gcc. Have you tried using the CodeSourcery arm-none-eabi-gcc build?

Assembler error for Cortex M3 GCC port

Hi I am not building one of the demo projects, but some own code. I am already using the arm-none-eabi-gcc EXE for compiling. I also tried the CodeSourcery build but with the same error message. Regards, // Esorol

Assembler error for Cortex M3 GCC port

It might be that the latest GCC/AS version has changed the semantics required for the asm instructions – this has happened several times in the past.  I will download the latest CodeSourcery build and try it. However, PSP is the Process Stack Pointer so you would not think you could go wrong with that, and CPSR and SPSR do not seem to correspond with the Cortex M3 but are in fact ARM7 registers.  I suspect there is an issue with your GCC command line.  Do you have -mcpu=cortex-m3 set? Regards.

Assembler error for Cortex M3 GCC port

I just downloaded the latest CodeSourcery G++ (which uses gcc V4.4.1) and build the demo from the FreeRTOS directory DemoCORTEX_LM3S811_GCC directory with no problems. Regards.

Assembler error for Cortex M3 GCC port

Hey, Thanks for the info. I’m really not a hardcore ARM-er so bear with my mistakes. =) I did not have the -mcpu=cortex-m3 definition in the compiler command line. After adding it, I got another compiler error stating that the target does not support ARM mode. So I added also the -mthumb definition and now the mentioned port.c file compiles just fine, regardless of whether I use the CodeSourcery or the YAGARTO build, i.e 4.4.1 or 4.5.1 versions respectively of GCC. Thanks for the help. Case closed I believe. =) // Esorol