nobody wrote on Tuesday, January 09, 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