Quality RTOS & Embedded Software

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


Loading

FreeRTOS 5.4 vs 7.1 compatibility

Posted by RouseA on March 30, 2012
I have been running with FreeRTOS V5.4 for a long time now on projects using Eclipse and an STM32 ARM processor, and have no problems with it. However, I want to evaluate Precipio's Trace add-on, which needs FreeRTOS V7.1. I tried updating to this latest version, but my project won't run:

My startup code is quite straightforward, creating a single task then starting the scheduler. That first task in turn creates further tasks. However, the problem occurs when the code reaches the vTaskStartScheduler() command, at which point the debugger jumps to the default handler. On stepping through vTaskStartScheduler() I have found that the error occurs when it calls
void vPortStartFirstTask( void )
{
__asm volatile(
" ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */
" ldr r0, [r0] \n"
" ldr r0, [r0] \n"
" msr msp, r0\n" /* Set the msp back to the start of the stack. */
" cpsie i\n" /* Globally enable interrupts. */
" svc 0\n" /* System call to start first task. */
" nop\n"
);
}

When the debugger reaches the svc 0 instruction it jumps the the Default Handler.

FreeRTOS v5.4 has slightly different code, and this works.
void vPortStartFirstTask( void )
{
__asm volatile(
" ldr r0, =0xE000ED08 \n" /* Use the NVIC offset register to locate the stack. */
" ldr r0, [r0] \n"
" ldr r0, [r0] \n"
" msr msp, r0\n" /* Set the msp back to the start of the stack. */
" svc 0\n" /* System call to start first task. */
);
}

Can anyone suggest how I should modify my code to be compatible with FreeRTOS v7.1?

RE: FreeRTOS 5.4 vs 7.1 compatibility

Posted by Richard on March 30, 2012
The extra line of code (cpsie) should not effect you. It was added to prevent a hard fault being generated under certain conditions with certain libraries. If you are jumping to the default handler, rather than hard faulting, I would suggest that your interrupt vector table is not populated with the FreeRTOS interrupt handlers.

If you are using CMSIS compliant vector table then you can add the following three lines to FreeRTOSConfig.h to allow the code to vector to FreeRTOS correctly:

“#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler”


Otherwise you will have to populate the vector table manually, and can check your previous working project to see where these three functions fit into the table.

Regards.

RE: FreeRTOS 5.4 vs 7.1 compatibility

Posted by RouseA on March 31, 2012
Richard

Thanks for your prompt response.

Regards
Alan


[ 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.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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.


Careers

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

Renesas

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