I have a Keil MDK project which outputs a library mc_comms.lib. I have another Keil project which uses this library and don't have any issues. My customer is using STM Cube and can't build the same test project with the same library.
c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: cannot find -lB:/STM32/G4/Examples/CubeIDE_1_6_0/zti_lib/zti_lib/lib/mc_comms.libFYI:
b:\STM32\G4\Examples\CubeIDE_1_6_0\zti_lib\zti_lib\lib>dir Volume in drive B is home Volume Serial Number is 4D4B-F115
Directory of b:\STM32\G4\Examples\CubeIDE_1_6_0\zti_lib\zti_lib\lib
03/18/2021 11:34 <DIR> .03/17/2021 20:14 <DIR> ..03/17/2021 18:16 2,139 mc_comms.h03/18/2021 11:33 32,674 mc_comms.lib 2 File(s) 34,813 bytes 2 Dir(s) 11,366,381,383,680 bytes free
b:\STM32\G4\Examples\CubeIDE_1_6_0\zti_lib\zti_lib\lib>
Even if I change to GNU toolchain I still have issues:
linking...c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: c:/st/stm32cubeide_1.6.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924/tools/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc.a(lib_a-exit.o): in function `exit':exit.c:(.text.exit+0x16): undefined reference to `_exit'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: ./out/startup_stm32g431xx.o:(.text+0x0): undefined reference to `_sidata'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: ./out/startup_stm32g431xx.o:(.text+0x4): undefined reference to `_sdata'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: ./out/startup_stm32g431xx.o:(.text+0xc): undefined reference to `_sbss'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: ./out/startup_stm32g431xx.o:(.text+0x10): undefined reference to `_ebss'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: ./out/startup_stm32g431xx.o: in function `LoopForever':B:/STM32/G4/Examples/mc_comm_lib GNU mk9p0/../../Nimbus/PAL/SRC/startup_stm32g431xx.asm:63: undefined reference to `_estack'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: B:/STM32/G4/Examples/mc_comm_lib GNU mk9p0/../../Nimbus/PAL/SRC/startup_stm32g431xx.asm:67: undefined reference to `_sdata'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: B:/STM32/G4/Examples/mc_comm_lib GNU mk9p0/../../Nimbus/PAL/SRC/startup_stm32g431xx.asm:69: undefined reference to `_sidata'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: B:/STM32/G4/Examples/mc_comm_lib GNU mk9p0/../../Nimbus/PAL/SRC/startup_stm32g431xx.asm:87: undefined reference to `_siccmram'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: B:/STM32/G4/Examples/mc_comm_lib GNU mk9p0/../../Nimbus/PAL/SRC/startup_stm32g431xx.asm:93: undefined reference to `_sccmram'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: B:/STM32/G4/Examples/mc_comm_lib GNU mk9p0/../../Nimbus/PAL/SRC/startup_stm32g431xx.asm:94: undefined reference to `_eccmram'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: B:/STM32/G4/Examples/mc_comm_lib GNU mk9p0/../../Nimbus/PAL/SRC/startup_stm32g431xx.asm:100: undefined reference to `_sbss'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: B:/STM32/G4/Examples/mc_comm_lib GNU mk9p0/../../Nimbus/PAL/SRC/startup_stm32g431xx.asm:101: undefined reference to `_ebss'c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: ./out/startup_stm32g431xx.o:(.isr_vector+0x0): undefined reference to `_estack'collect2.exe: error: ld returned 1 exit status
Do you know what is my problem? How can I resolve it?
Thanks.
I'm sure that my problem is incorrect linker settings. What are the correct ones?
-T ./stm32g4_flash.ld -mcpu=cortex-m4 -mthumb -mthumb-interwork -Wl,-Map="./main.map" -o ./OUT/main.elf Build started: Project: main Build target 'mc_comm_lib_mk9p0' compiling system_stm32g4xx.c... compiling main.c... linking... c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: error: ./OUT/main.elf uses VFP register arguments, c:/ST/STM32CubeIDE_1.6.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924/tools/arm-none-eabi/lib/\libc.a(lib_a-init.o) does not c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: failed to merge target specific data of file c:/ST/STM32CubeIDE_1.6.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924/tools/arm-none-eabi/lib/\libc.a(lib_a-init.o) c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: error: ./OUT/main.elf uses VFP register arguments, c:/ST/STM32CubeIDE_1.6.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924/tools/arm-none-eabi/lib/\libc.a(lib_a-memcpy-stub.o) does not c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: failed to merge target specific data of file c:/ST/STM32CubeIDE_1.6.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924/tools/arm-none-eabi/lib/\libc.a(lib_a-memcpy-stub.o) c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: error: ./OUT/main.elf uses VFP register arguments, c:/ST/STM32CubeIDE_1.6.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924/tools/arm-none-eabi/lib/\libc.a(lib_a-memset.o) does not c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: failed to merge target specific data of file c:/ST/STM32CubeIDE_1.6.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924/tools/arm-none-eabi/lib/\libc.a(lib_a-memset.o) c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: c:/ST/STM32CubeIDE_1.6.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924/tools/arm-none-eabi/lib/\libc.a(lib_a-init.o): in function `__libc_init_array': init.c:(.text.__libc_init_array+0x20): undefined reference to `_init' collect2.exe: error: ld returned 1 exit status ".\OUT\main.elf" - 1 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:02