中级会员
- 积分
- 262
- 金钱
- 262
- 注册时间
- 2020-1-10
- 在线时间
- 29 小时
|
楼主 |
发表于 2021-7-8 11:22:18
|
显示全部楼层
makefile (格式可以忽略)
CORESS_COMPILE ?= arm-linux-gnueabihf-
TARGET_NAME ?= led_bsp
ELF ?= $(TARGET_NAME).elf
BIN ?= $(TARGET_NAME).bin
DIS ?= $(TARGET_NAME).dis
CC := $(CORESS_COMPILE)gcc
LD := $(CORESS_COMPILE)ld
OBJCOPY := $(CORESS_COMPILE)objcopy
OBJDUMP := $(CORESS_COMPILE)objdump
FLAGS := -Wall -g -nostdlib
CFLAGS := -std=c99
INCDIRS := imx6ull \
bsp/clk \
bsp/led \
common/delay
SRCDIRS := main \
bsp/clk \
bsp/led \
common/delay
INCLUDE := $(patsubst %, -I %, $(INCDIRS))
SFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.S))
CFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.c))
SFILENDIR := $(notdir $(SFILES))
CFILENDIR := $(notdir $(CFILES))
SOBJS := $(patsubst %, obj/%, $(SFILENDIR:.S=.o))
COBJS := $(patsubst %, obj/%, $(CFILENDIR:.c=.o))
OBJS := $(SOBJS) $(COBJS)
$(BIN) : $(OBJS)
$(LD) -Timx6ull.lds -o $(ELF) $^
$(OBJCOPY) -O binary -S $(ELF) $@
$(OBJDUMP) -D -m arm $(ELF) > $(DIS)
$(SOBJS): obj/%.o : %.S
$(CC) -Wall -nostdlib -c -O2 $(INCLUDE) -o $@ $<
$(COBJS): obj/%.o : %.c
$(CC) -Wall -nostdlib -c -O2 $(INCLUDE) -o $@ $<
.PHONY : clean
clean:
rm -rf $(OBJS) $(ELF) $(BIN) $(DIS) |
|