freertos hangs during execution of prvPortStartFirstTask. Specifically, it hangs during the svc handler, when it tries to jump to r14 (via bx r14). r14 before the jump contains 0xFFFF FFFD. I am using lpc1768, with gcc on eclipse.
This only happens on debug, and runs fine otherwise (i have 2 tasks running). i am suspecting it has something to do with my debug configurations (ie startup commands), but I have no idea how to fix it. any pointer is appreciated.
Is it possible that the debugger is running a scrip that changes the vector table base address, but when you run without the debugger the change doesn’t happen?
hi. thanks for the pointers. but still cant get it to work.
i have the 3 interrupt vectors mentioned on the faq. They’re defined in the freertosconfig.h
I am running from flash, so I didnt relocate the vector table to somewhere else.
i have these lines in my startup:
0xFFFF FFFD is the return code, not the address it is returning too, and looks right. The address it returns to comes off the stack. The return code just tells the LPC the state being returned too.
__asm volatile (
" ldr r3, pxCurrentTCBConst2 \n" /* Restore the context. */
" ldr r1, [r3] \n" /* Use pxCurrentTCBConst to get the pxCurrentTCB address. */
" ldr r0, [r1] \n" /* The first item in pxCurrentTCB is the task top of stack. */
" ldmia r0!, {r4-r11} \n" /* Pop the registers that are not automatically saved on exception entry and the critical nesting count. */
" msr psp, r0 \n" /* Restore the task stack pointer. */
" isb \n"
" mov r0, #0 \n"
" msr basepri, r0 \n"
" orr r14, #0xd \n"
" bx r14 \n"
" \n"
" .align 2 \n"
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
);
I checked that the r3 (at the beginning of the function) points to 1000 xxxx, so that looks correct since thats where my stack is. Any other pointers how I can debug this?