1

I am trying to get some code up and running on a STM32F4-Discovery board (chip: STM32F407VGT6).

This tutorial explains the necessary code and steps required for compiling and linking for the Nucleo board (chip: STM32F401RE). I have tried to convert this procedure to my Discovery board but I get the following linking errors when I try to link the object files

error: system.o: Conflicting architecture profiles M/A
failed to merge target specific data of file system.o
error: main.o: Conflicting architecture profiles M/A
failed to merge target specific data of file main.o
error: startup_stm32f407xx.o: Conflicting architecture profiles M/A
failed to merge target specific data of file startup_stm32f407xx.o

My project structure is the following

├── STM32Cube_FW_F4_V1.13.0
│   ├── Drivers/
│   ├── Projects/
│   └── Utilities/
├── stm32f4 (my project folder)
│   ├── main.c
│   ├── Makefile
│   ├── startup_stm32f407xx.s
│   └── system.c

This is my Makefile (STM32CubeF4 can be found here):

STM32Cube:=../STM32Cube_FW_F4_V1.13.0

#DEVICE:=STM32F07xG
DEVICE:=STM32F407xx

CC:=arm-none-eabi
CFLAGS:=-Wall -mcpu=cortex-m4 -mlittle-endian -mthumb
INC_PATH1:=$(STM32Cube)/Drivers/CMSIS/Device/ST/STM32F4xx/Include
INC_PATH2:=$(STM32Cube)/Drivers/CMSIS/Include
LD_SCRIPT:=$(STM32Cube)/Projects/STM32F4-Discovery/Templates/TrueSTUDIO/STM32F4-Discovery/STM32F407VG_FLASH.ld

all:
    $(CC)-gcc $(CFLAGS) -I$(INC_PATH1) -I$(INC_PATH2) -D$(DEVICE) -Os -c system.c -o system.o
    $(CC)-gcc $(CFLAGS) -I$(INC_PATH1) -I$(INC_PATH2) -D$(DEVICE) -Os -c main.c -o main.o
    $(CC)-gcc $(CFLAGS) -I$(INC_PATH1) -I$(INC_PATH2) -D$(DEVICE) -Os -c startup_stm32f407xx.s -o startup_stm32f407xx.o

link: all
    $(CC)-gcc $(CFLAGS) -D$(DEVICE) -T$(LD_SCRIPT) -Wl,--gc-sections system.o main.o startup_stm32f407xx.o -o main.elf

I copied startup_stm32f407xx.o from

$(STM32Cube)/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s

I have changed BSRRL and BSSRH to BSRR in main.c and PWR_CR_VOS_1 to PWR_CR_VOS in system.c.

This changes were made so that the code would compile and the default variable names were absent in the headerfiles for my board.

I have looked over the tutorial twice and searched for information regarding the error message without being able to solve this issue.

Could someone tell me what I am doing wrong or point me in he right direction?

Henrik
  • 405
  • 1
  • 8
  • 19
  • 1
    I'm not a gcc user, but it looks like the complaint is that in the link step, it is finding some object code that is targeting ARM v7-A and some that is targeting ARM v7-M. I would double check that your compiler flags are complete and that there aren't additional flags needed for the link step. Do you need `-march=armv7-m`? – rjp Aug 29 '16 at 17:46
  • Are you working on a Linux or a Windows computer? – K.Mulier Nov 21 '16 at 10:42

0 Answers0