AnsweredAssumed Answered

Linker error when compiling with CodeSourcery

Question asked by sampson.david on Jan 31, 2013
Latest reply on Jan 31, 2013 by Clive One
Trying to get a linux toolchain up and running to eventually program an STM32L Discovery board.  I have Code Sourcery CodeBench Lite set up in a folder and a Make script set up to build it all.  Right now it's just a skeleton program, consisting of a main.c, startup_stm32l1xx_md.s, and system_stm32l1xx.c.  When I run the script, it compiles for a bit and then I get these errors:

/home/dsampson/arm-dev/arm-gcc/bin/arm-none-linux-gnueabi-gcc -T../stm32_flash.ld -mthumb -mcpu=cortex-m3  -o code.elf startup_stm32l1xx_md.o system_stm32l1xx.o  main.o 
/home/dsampson/arm-dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: error: startup_stm32l1xx_md.o: Conflicting architecture profiles M/A
/home/dsampson/arm-dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: failed to merge target specific data of file startup_stm32l1xx_md.o
/home/dsampson/arm-dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: error: system_stm32l1xx.o: Conflicting architecture profiles M/A
/home/dsampson/arm-dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: failed to merge target specific data of file system_stm32l1xx.o
/home/dsampson/arm-dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: error: main.o: Conflicting architecture profiles M/A
/home/dsampson/arm-dev/arm-gcc/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: failed to merge target specific data of file main.o

I ran readelf on each ot the object files, and both startup and main show up as Cortex M3 v7 object files, but it doesn't recognize the system_stm32l1xx.o file as being valid.  I tried deleting it and recompiling but no luck.  It's the system file I pulled out of the firmware pack for the L1 Discovery board so I would think it's a valid file.  Any ideas what could be going wrong?

Outcomes