Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Thumb compile error

Posted by Scott Thode on 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, [r0]
159 ldr r0, [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
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, [r0] \n"
156:FreeRTOS/Source/portable/GCC/ARM_CM3/port.c **** " ldr r0, [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

RE: Thumb compile error

Posted by Richard on March 18, 2011
[on the assumption your build options are correct, which on first glance they appear to be, and on the assumption your compiler version supports the CM3]

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.


RE: Thumb compile error

Posted by Scott Thode on 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)


RE: Thumb compile error

Posted by Scott Thode on 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.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner