Quality RTOS & Embedded Software

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




Loading

freeRTOS hangs on bx r14 only during debug mode

Posted by mamarina on October 27, 2015

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

Posted by rtel on October 27, 2015

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

Posted by mamarina on October 28, 2015

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

Posted by davedoors on October 28, 2015

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

Posted by mamarina on October 29, 2015

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

Posted by rtel on October 29, 2015

See the bottom of the following page:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Babefdjc.html


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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