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


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?


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:


[ 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