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




Loading

gcc / gdb related issue

Posted by Nobody/Anonymous on January 9, 2007
Hi!

Maybe my question is not so FreeRTOS specific but I ran into it while trying out FreeRTOS.

Im using:
yagarto toolchain/eplipse/openocd
target board is based on SAM7A1

The problem is that debugger is not able to show variables correctly. I used the same "naked" attribute as serial port demo for FreeRTOS:

-----------------------------------------------------------
void vUART_ISR( void ) __attribute__ ((naked));

void vUART_ISR( void )
{
portENTER_SWITCHING_ISR();

portBASE_TYPE xStatus;
portBASE_TYPE a;
portBASE_TYPE xST, xMask, xDummy;
portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByRx = pdFALSE;

xST= USART1->SR; <---------------I inserted brakepoint here
xMask= USART1->IMR;
xStatus= xST & xMask;
-----------------------------------------------------------

I checked the assembly output of the compiler. Variables are inserted below the sp as C compiler is used to do (as I understood it so far) and interrupt mask registers and everything seems reasonable. But eclipse debugger (as well as insight) shows totally different values and does not change the value as program reads status/mask registers. Same thing for xTaskWokenBy..., despite assembly output initialises these values and inserts below the sp, debugger has different opinion about the values... This is rather annoying while debugging and I guess everything that does not work correctly can cause a lot of trouble...

My C and linker flags are the following:
DEBUG=-ggdb (also tried -g)
OPTIM=-O0
RUN_MODE=RUN_FROM_RAM

CFLAGS=-Wall -D $(RUN_MODE) -D SAM7A1\
-I. \
-I../FreeRTOS/Source/include \
-I../FreeRTOS_port/include\
-I../FreeRTOS/Demo/Common/include \
-I../lib\
-ICOM\
$(DEBUG) -mcpu=arm7tdmi \
-T../script/SAM7A1-ram.ld \
-Wcast-align $(OPTIM) -fomit-frame-pointer

LINKER_FLAGS=-Xlinker -ortosdemo.elf -Xlinker -M -Xlinker -Map=rtosdemo.map -Wl,--cref,-L../lib,-lSAM7A1

Thank you in advance!
Madis

RE: gcc / gdb related issue

Posted by Jeff Smith on January 10, 2007
One case where I don't see the right variables is if I compile with '-fomit-frame-pointer' but the debugger doesn't support it. Of course the solution would be a debugger that supports it There's good reason why __attribute__((naked)) is required by FreeRTOS, otherwise removing it would probably make the debugger work.

The bottom line is that FreeRTOS is by design, dificult to debug all the way through. I use other methods of debugging those parts (i.e. add code to output trace information).


[ 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