1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Makefile.include: add %.hex and %.bin rules

Replace HEXFILE rule by a rule for each type.
HACK: Adding '-Oformat' after OFLAGS overwrite the value in flags.
This commit is contained in:
cladmi 2018-03-27 11:55:08 +02:00 committed by Gaëtan Harter
parent 42d1e1ad0b
commit 70c5079b16
2 changed files with 8 additions and 4 deletions

View File

@ -317,6 +317,7 @@ BASELIBS += $(APPDEPS)
ELFFILE ?= $(BINDIR)/$(APPLICATION).elf
HEXFILE ?= $(ELFFILE:.elf=.hex)
BINFILE ?= $(ELFFILE:.elf=.bin)
# variables used to compile and link c++
CPPMIX ?= $(if $(wildcard *.cpp),1,)
@ -355,8 +356,11 @@ $(BINDIR)/$(APPLICATION_MODULE).a: FORCE
print-size: $(ELFFILE)
$(Q)$(SIZE) $<
$(HEXFILE): $(ELFFILE)
$(Q)$(OBJCOPY) $(OFLAGS) $< $@
%.hex: %.elf
$(Q)$(OBJCOPY) $(OFLAGS) -Oihex $< $@
%.bin: %.elf
$(Q)$(OBJCOPY) $(OFLAGS) -Obinary $< $@
endif # BUILD_IN_DOCKER

View File

@ -27,9 +27,9 @@ else
export OBJCOPY ?= gobjcopy
export OFLAGS ?= -O ihex
else
# If gobjcopy is not available, just create an empty file. The hexfile
# If gobjcopy is not available, just do nothing. The hexfile
# is not used for native anyways.
export OBJCOPY ?= touch
export OBJCOPY ?= true
export OFLAGS =
endif
endif