使用makefile链接错误以在STM32F205,GCC-arm-none-eabi“ windows-7 target”上构建程序

时间:2018-12-23 10:18:35

标签: stm32f4

我将我的项目分为几个子文件夹,就像所附的图片一样, 当我运行我的make文件时,出现很多链接错误。 请一些身体帮助我。

enter image description here

enter image description here

enter image description here

制作文件:

# put your *.c source files here, make should handle the rest!
CSRCS = Wiring_Layer/firmware/hal/src/*.c vendor/SPL/src/*.c
# put your *.cpp source files here, make should handle the rest!
CCSRCS = Wiring_Layer/firmware/user/*.cpp  Wiring_Layer/firmware/wiring/src/*.cpp
# all the files will be generated with this name (main.elf, main.bin, main.hex, etc)
PROJ_NAME=elkrem

# Location of the Libraries folder from the STM32F0xx Standard Peripheral Library
STD_PERIPH_LIB=vendor

# Location of the linker scripts
LDSCRIPT_INC=Wiring_Layer/firmware/build/src

# that's it, no need to change anything below this line!

###################################################

CC=arm-none-eabi-gcc
CPP=arm-none-eabi-g++
GDB=arm-none-eabi-gdb
OBJCOPY=arm-none-eabi-objcopy
OBJDUMP=arm-none-eabi-objdump
SIZE=arm-none-eabi-size

CFLAGS  = -w -g -std=c99 -O0  
CFLAGS += -mlittle-endian -mcpu=cortex-m3 -mthumb
CFLAGS += -std=c++11 -felide-constructors -std=c++0x -DUSE_STDPERIPH_DRIVER -DSTM32F2XX 



LDFLAGS += -Wl,--gc-sections -Wl,-Map=$(PROJ_NAME).map


###################################################


ROOT=$(shell pwd)

CFLAGS += -Iinc
CFLAGS += -IWiring_Layer/firmware/build/inc
CFLAGS += -IWiring_Layer/firmware/hal/inc
CFLAGS += -IWiring_Layer/firmware/wiring/inc
CFLAGS += -I$(STD_PERIPH_LIB) 
CFLAGS += -I$(STD_PERIPH_LIB)/SPL/inc

STARTUP = Wiring_Layer/firmware/build/src/startup_stm32f2xx.s # add startup file to build


OBJS = $(CSRCS:.c=.o) $(CCSRCS:.cpp=.o) 
DEPS = $(CSRCS:.c=.d) 

###################################################$

.PHONY: all proj program  clean

all:  proj


proj:   $(PROJ_NAME).elf

wiring:
    $(CPP) $(CFLAGS) -c $(CCSRCS)

objs :  wiring 
    $(CC) $(CFLAGS) -c $(CSRCS)  


$(PROJ_NAME).elf: objs
    $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(STARTUP) -L$(LDSCRIPT_INC) -TElkrem_Linker.ld
    $(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex
    $(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin
    $(OBJDUMP) -St $(PROJ_NAME).elf >$(PROJ_NAME).lst
    $(SIZE) $(PROJ_NAME).elf


program: all


clean:
    find ./ -name '*~' | xargs rm -f    
    rm -f *.o
    rm -f *.d
    rm -f dirs
    rm -f $(PROJ_NAME).elf
    rm -f $(PROJ_NAME).hex
    rm -f $(PROJ_NAME).bin
    rm -f $(PROJ_NAME).map
    rm -f $(PROJ_NAME).lst

图片链接包含文件夹和子文件夹,并在命令窗口中显示结果

enter image description here

0 个答案:

没有答案