alan_rouse wrote on Friday, 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?