Quality RTOS & Embedded Software

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


Usage fault exception when calling vPortSVCHandler

Posted by ltancerel on November 8, 2013

Hello, I am running an evaluation of FreeRTOS to run a custom HW embedding Cortex-M3 core. As my HW is not available, I used LM3S811_GCC demo as it is close to what I am targeting.

I run the demo inside Eclipse, and qemu-system-arm to avoid buying other HW and was successful in building, linking and starting the demo.

However I am getting wrong behavior when calling prvPortStartFirstTask() when executing "svc 0" instruction, it is jumping onto vPortSVCHandler as expected. However, at that point lr = 0xFFFFFFF9 whereas before that instruction, I had lr = 0x0000079F Note that I get LR being at that value upon breakpoint onto vPortSVCHandler, as for some reason the debugger seems to be puzzled by "svc 0" call.

As such, when executing : "bx lr" in the vPortSVCHandler, I am getting the UsageFault exception

I would like to know if I am doing anything wrong, I did not make any specific changes compared to initial demo. From ARM instruction set, I don't see why LR is changing.

Although I am out of usual FreeRTOS bounds with my QEMU emulation, I would appreciate any help regarding this issue. Could that come from emulation itself ?

Thanks, Ludovic

Usage fault exception when calling vPortSVCHandler

Posted by richardbarry on November 8, 2013

As a general (ish) rule we are extremely shy of attempting to support anything that is running on an emulator. Experience shows that most issues reported are in the emulator, and it proves to be a huge time sink with no benefit.

However, in this case, take a look at the ARMv7M architecture manuals, and you will see that you in fact do expect LR to change when entering an exception. What you are seeing in the EXC_RETURN value, which tells the hardware how to behave when returning from the exception. The real LR value is safely on the stack, ready to be popped off on exception exit.


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

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

Latest News

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

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

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