Sysprogs forums › Forums › VisualGDB › XMC1100 Linking fails
- This topic has 1 reply, 2 voices, and was last updated 9 years ago by support.
-
AuthorPosts
-
December 12, 2015 at 09:35 #7333julianrParticipant
I am tring to compile code for the XMC2Go board. The Infineon chips are not directly supported by VisualGDB but it still should be possible to write for it since it is just a Cortex M0 processor.
I am using these the files from this tutorial as a base: http://eleceng.dit.ie/frank/arm/BareMetalXMC2Go/index.html together with this tutorial for VisualGDB: http://visualgdb.com/tutorials/arm/legacy/
Compilation works fine, the *.0 files are created but linking fails. VisualGDB is using g++ as a linker but the Makefile from the tutorial uses ld. Where can I change the linker? When I link the *.o files by hand and flash the hex file via J-Flash lite it works like a charm. This means that code generation works.
Here is the relevant log output:
VisualGDB: Run “cmd.exe /c “C:\SysGCC\arm-eabi\bin\make.exe” CONFIG=Debug” in directory “C:\Users\Julian\documents\VisualGDB\Projects\XMC2Go\XMC2Go” on local computer
C:\SysGCC\arm-eabi/bin/arm-eabi-gcc.exe -ggdb -ffunction-sections -O0 -mcpu=cortex-m0 -mthumb -g -DDEBUG -c init.c -o Debug/init.o -MD -MF Debug/init.dep
init.c: In function ‘init’:
1>C:\Users\Julian\documents\VisualGDB\Projects\XMC2Go\XMC2Go\init.c(119,2): warning : implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
main();
^
C:\SysGCC\arm-eabi/bin/arm-eabi-gcc.exe -ggdb -ffunction-sections -O0 -mcpu=cortex-m0 -mthumb -g -DDEBUG -c main.c -o Debug/main.o -MD -MF Debug/main.dep
C:\SysGCC\arm-eabi/bin/arm-eabi-g++.exe -o Debug/XMC2Go.elf -Wl,-gc-sections -lc -nostartfiles -TC:/Users/Julian/Documents/VisualGDB/Projects/XMC2Go/XMC2Go/linker_script.ld -Wl,–start-group Debug/init.o Debug/main.o -Wl,–end-group
C:\SysGCC\arm-eabi/bin/arm-eabi-objcopy.exe -O binary Debug/XMC2Go.elf Debug/XMC2Go.bin
C:\SysGCC\arm-eabi/bin/arm-eabi-objcopy.exe -O ihex Debug/XMC2Go.elf Debug/XMC2Go.ihex
——————- Memory utilization report ——————-
Used FLASH: 0 bytes
Used RAM: 0 bytesDecember 12, 2015 at 20:00 #7337supportKeymasterHi,
Based on the log you provided it looks like the linker eliminates all code and data from the output image as it assumes it is all unused.
You can resolve this by adding a KEEP statement to the declaration of the interrupt vector table in your linker script. This will mark the vector table as used and will in turn bring in the reset handler, main(), and the functions called by it. You will also need to explicitly specify the entry point in your linker script so that gdb can jump to it automatically after programming your FLASH.
Please refer to our STM32 linker scripts for examples on the KEEP() statement and the entry point definition.
-
AuthorPosts
- You must be logged in to reply to this topic.