cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L0x Custom Makefile undefined address for Reset_Handler

Pkarra
Associate

Hello,

I'm running into an issue with Makefile. I ported over the structure that the CubeIDE uses to generate an elf and I'm using the exact same commands. I can build my target elf file successfully but at the end I get a warning stating: /usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol Reset_Handler; defaulting to 0000000008000000

 I generate a startup_stm32l051t8yx.o file and it's part of the object files that the linker is using to generate an elf. 

Things I've debugged:

I looked into what this meant from a few previous post (https://community.st.com/t5/stm32cubeide-mcus/how-to-fix-quot-warning-cannot-find-entry-symbol-reset-handler/td-p/252538). None of those suggestions helped fix my issue. I have a Reset_Handler entry point in my linker file and my startup file (i.e startup_stm32l051t8yx.s) also has it defined.

I did an arm-none-eabi-nm on my generated elf file and it has an "U" as in undefined address for the Reset_Handler. Attached are the outputs.

I notice that if I explicitly add the object files (that includes the startup_assembly.o) not as a pre-req to to the rule but as part of the command, the Reset_Handler has an address assigned. The problem with then is my elf file is 512Kb instead of 42Kb. 

For example this doesn't work:

$(TARGET): $(OBJECTS) $(LD_SCRIPT)

    $(CCPLUS) -o "$(OUTPUT).elf" -mcpu=cortex-m0plus -T$(LD_SCRIPT) --specs=nosys.specs -Wl,-Map="ev1.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
 
This works (with a filesize of 512Kb):
$(TARGET):
    $(CCPLUS) $(OBJECTS) -o "$(OUTPUT).elf" -mcpu=cortex-m0plus -T$(LD_SCRIPT) -lnosys -mfloat-abi=soft -mthumb -Wl,--gc-sections
 

I'd really appreciate any sort of help on this.

 

1 REPLY 1
Pkarra
Associate

Also attached is my linker and startup assembly file.