freeRTOS hangs on bx r14 only during debug mode

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.

freeRTOS hangs on bx r14 only during debug mode

It is most likely something to do with the interrupt vector table. See the red text in FAQ 1 on this page: http://www.freertos.org/FAQHelp.html 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?

freeRTOS hangs on bx r14 only during debug mode

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: monitor writeu32 0xE000ED08 = 0x00000000 monitor reg r13 = (0x00000000) monitor reg pc = (0x00000004) any more idea? thanks.

freeRTOS hangs on bx r14 only during debug mode

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.

freeRTOS hangs on bx r14 only during debug mode

Hi Dave, thanks for replying… But I thought that bx r14 would cause the processor to jump to the address in r14, which in this case is 0xFFFF ….. The arm website says so… http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0040d/Cabdcdci.html … Or did i misunderstood something? Anyway, here is the full function: ~~~~ __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?

freeRTOS hangs on bx r14 only during debug mode

See the bottom of the following page: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Babefdjc.html