Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists