Thursday, August 22, 2013

Makefile specified link order

Weird bug I encountered today and wasnt certain why changing the link order mattered but here is where the bug manifested itself and the latter correction:


 $(LD) -o $(APP)_test.out     $(LDFLAGS) reset.o   \
            core.o    \
             tclibS.o  \
             tclibC.o  \
            $(APP)_test.o
 
 
        $(LD) -o $(APP)_test.out        $(LDFLAGS) reset.o   \
                                                   tclibC.o  \
                                                   tclibS.o  \
                                                   core.o    \
                                                   $(APP)_test.o
 
 
Weird bug I encountered today and wasnt certain why changing the link order
The former results in a bug where global variables arent being updated. A breakpoint set in  stm32_nvic_systick_isr and single stepping with prints of strSystick structure shows that, the structure elements arent being updated (incremented). However a dump of the asm code (arm-linux-gnueabi-objdump -d core_test.out) shows the correct instructions.

Changing the linke order to the latter corrects the problem. I cant understand this. strSystick is defined in IE_stm32.h and as such would be in core.o which is sourced to IE_stm32.c. Thats also where the handler stm32_nvic_systick_isr resides so this isnt making sense.

 

No comments:

Post a Comment