Build firmware executables as *.elf file

This commit is contained in:
Uwe Bonnes 2020-04-20 17:36:21 +02:00
parent dd022fcb44
commit a09104c281
5 changed files with 18 additions and 11 deletions

1
.gitignore vendored
View File

@ -16,4 +16,5 @@ tags
*.b#*
blackmagic_upgrade
*.exe
*.elf
.vscode

View File

@ -67,7 +67,11 @@ CFLAGS += $(OPT_FLAGS)
LDFLAGS += $(OPT_FLAGS)
ifndef TARGET
TARGET=blackmagic
ifdef PC_HOSTED
TARGET = blackmagic
else
TARGET = blackmagic.elf
endif
endif
ifdef NO_OWN_LL
@ -96,19 +100,21 @@ $(TARGET): include/version.h $(OBJ)
@echo " AS $<"
$(Q)$(CC) $(CFLAGS) -c $< -o $@
%.bin: %
ifndef PC_HOSTED
%.bin: %.elf
@echo " OBJCOPY $@"
$(Q)$(OBJCOPY) -O binary $^ $@
%.hex: %
%.hex: %.elf
@echo " OBJCOPY $@"
$(Q)$(OBJCOPY) -O ihex $^ $@
endif
.PHONY: clean host_clean all_platforms FORCE
clean: host_clean
$(Q)echo " CLEAN"
-$(Q)$(RM) *.o *.d *~ blackmagic $(HOSTFILES)
-$(Q)$(RM) *.o *.d *.elf *~ $(TARGET) $(HOSTFILES)
-$(Q)$(RM) platforms/*/*.o platforms/*/*.d mapfile include/version.h
all_platforms:

View File

@ -30,7 +30,7 @@ SRC += cdcacm.c \
all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex
blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o
blackmagic_dfu.elf: usbdfu.o dfucore.o dfu_f1.o
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS_BOOT)

View File

@ -37,18 +37,18 @@ SRC += cdcacm.c \
stlink_common.c \
ifeq ($(ST_BOOTLOADER), 1)
all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex
all: blackmagic.bin
else
all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade.bin dfu_upgrade.hex
endif
blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o stlink_common.o
blackmagic_dfu.elf: usbdfu.o dfucore.o dfu_f1.o stlink_common.o
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS_BOOT)
dfu_upgrade: dfu_upgrade.o dfucore.o dfu_f1.o stlink_common.o
dfu_upgrade.elf: dfu_upgrade.o dfucore.o dfu_f1.o stlink_common.o
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS)
host_clean:
-$(Q)$(RM) blackmagic.bin blackmagic_dfu blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade dfu_upgrade.bin dfu_upgrade.hex
-$(Q)$(RM) *.bin *elf *hex

View File

@ -31,11 +31,11 @@ SRC += cdcacm.c \
all: blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade.bin dfu_upgrade.hex
blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o platform_common.o
blackmagic_dfu.elf: usbdfu.o dfucore.o dfu_f1.o platform_common.o
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS_BOOT)
dfu_upgrade: dfu_upgrade.o dfucore.o dfu_f1.o platform_common.o
dfu_upgrade.elf: dfu_upgrade.o dfucore.o dfu_f1.o platform_common.o
@echo " LD $@"
$(Q)$(CC) $^ -o $@ $(LDFLAGS)