0
我有下面的MakefileMakefile中沒有運行臂無 - EABI-AR沒有連接所有.o文件
CC=arm-none-eabi-gcc
AR=arm-none-eabi-ar
vpath %.c src src/peripherals
vpath %.o out
CFLAGS = -g -O2 -Wall -DUSE_STDPERIPH_DRIVER
CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
CFLAGS += -ffreestanding -nostdlib
CFLAGS += -Iinc -Iinc/cmsis -Iinc/peripherals -Iinc/stm32f4xx
OUT_DIR=out
SRCS = misc.c stm32f4xx_adc.c stm32f4xx_can.c stm32f4xx_crc.c stm32f4xx_cryp.c stm32f4xx_cryp_aes.c \
stm32f4xx_cryp_des.c stm32f4xx_cryp_tdes.c stm32f4xx_dac.c stm32f4xx_dbgmcu.c stm32f4xx_dcmi.c stm32f4xx_dma.c \
stm32f4xx_exti.c stm32f4xx_flash.c stm32f4xx_fsmc.c stm32f4xx_gpio.c stm32f4xx_hash.c stm32f4xx_hash_md5.c \
stm32f4xx_hash_sha1.c stm32f4xx_i2c.c stm32f4xx_iwdg.c stm32f4xx_pwr.c stm32f4xx_rcc.c stm32f4xx_rng.c \
stm32f4xx_rtc.c stm32f4xx_sdio.c stm32f4xx_spi.c stm32f4xx_syscfg.c stm32f4xx_tim.c stm32f4xx_usart.c \
stm32f4xx_wwdg.c
OBJS = $(SRCS:.c=.o)
.PHONY: libstm32f4.a
all: libstm32f4.a
%.o : %.c
mkdir -p $(OUT_DIR)
$(CC) $(CFLAGS) -c -o $(OUT_DIR)/[email protected] $^
libstm32f4.a: $(OBJS)
$(AR) -r $(OUT_DIR)/[email protected] $(OUT_DIR)/$(OBJS)
clean:
rm -rf $(OUT_DIR)
但運行make,我的.o文件正在修建好的時候,但關鍵在那裏,無所事事的人打來電話,我正在弄得一團糟。
線
$(AR) -r $(OUT_DIR)/[email protected] $(OUT_DIR)/$(OBJS)
可能是我要去哪裏錯了,它的輸出是:
arm-none-eabi-ar -r out/libstm32f4.a out/misc.o stm32f4xx_adc.o stm32f4xx_can.o stm32f4xx_crc.o stm32f4xx_cryp.o stm32f4xx_cryp_aes.o stm32f4xx_cryp_des.o stm32f4xx_cryp_tdes.o stm32f4xx_dac.o stm32f4xx_dbgmcu.o stm32f4xx_dcmi.o stm32f4xx_dma.o stm32f4xx_exti.o stm32f4xx_flash.o stm32f4xx_fsmc.o stm32f4xx_gpio.o stm32f4xx_hash.o stm32f4xx_hash_md5.o stm32f4xx_hash_sha1.o stm32f4xx_i2c.o stm32f4xx_iwdg.o stm32f4xx_pwr.o stm32f4xx_rcc.o stm32f4xx_rng.o stm32f4xx_rtc.o stm32f4xx_sdio.o stm32f4xx_spi.o stm32f4xx_syscfg.o stm32f4xx_tim.o stm32f4xx_usart.o stm32f4xx_wwdg.o
arm-none-eabi-ar: creating out/libstm32f4.a
arm-none-eabi-ar: stm32f4xx_adc.o: No such file or directory
make: *** [libstm32f4.a] Error 1
時候,在這個看,出/ libstm32f4.a是正確的,但第二句話所有的* .o文件是完全錯誤的,只有out/misc.o被前綴out /文件夾,而不是其餘,導致錯誤?
如何修復我的Makefile以使其在./out/中查找.o文件?我正在使用
vpath %.o out
不正確,或者是我的arm-none-eabi-ar指令在Makefile中不正確?