Thumb compile error

scottthode wrote on Friday, March 18, 2011:

I’m trying to compile FreeRTOS for LPC1768 with GCC under Ubuntu. Tools are set up for arm-none-eabi. I get this error in port.c. Why might the compiler not recognise the svc instruction? I have these compiler flags: -mthumb -D__thumb2__=1 -mcpu=cortex-m3 -mtune=cortex-m3.
151:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** void vPortStartFirstTask( void )
152:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** {
150              .loc 1 152 0
151              .cfi_startproc
152              @ Naked Function: prologue and epilogue provided by programmer.
153              @ args = 0, pretend = 0, frame = 0
154              @ frame_needed = 1, uses_anonymous_args = 0
153:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** __asm volatile(
155              .loc 1 153 0
156              @ 153 “FreeRTOS/Source/portable/GCC/ARM_CM3/port.c” 1
157              ldr r0, =0xE000ED08
158              ldr r0, 
159              ldr r0, 
160 ??? 80F30888 msr msp, r0
161 ??? 62B6     cpsie i
162 ??? 00DF     svc 0
****  Error:SVC is not permitted on this architecture
163 ??? 00BF     nop
164             
165              @ 0 “” 2
154:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** " ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */
155:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** " ldr r0,  \n"
156:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** " ldr r0,  \n"
157:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** " msr msp, r0 \n" /* Set the msp back to the start of the stack. */
158:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** " cpsie i \n" /* Globally enable interrupts. */
159:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** " svc 0 \n" /* System call to start first task. */
160:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** " nop \n"
161:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** );
162:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** }
166              .loc 1 162 0
167              .thumb
168              .cfi_endproc

rtel wrote on Friday, March 18, 2011:

Check which version of binutils you are using.  There is a catastrophic bug in version 2.21 which strangely, being an ARM compiler, does not recognise this ARM instruction as being an ARM instruction.  If possible, use Binutils version 2.20.1 instead.

Regards.

scottthode wrote on Saturday, March 19, 2011:

Thanks for that Richard. I am using binutils 2.21 so I’ll try going back to 2.20.1.

I have GCC 4.5.2, newlib 1.19.2 and gdb 7.1. I did try gdb 7.2 but it fails to compile (some error compiling libiberty)

-Scott

scottthode wrote on Sunday, March 20, 2011:

Ok, my FreeRTOS test code compiles now. Just need to get it working which hopefully means debugging my errors, not tool errors.