From d769d8335c8124058c65eec60fa2c52928f1168f Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 20 Oct 2012 21:29:52 +0200 Subject: digital/ucoolib: add binary files build --- digital/ucoolib/build/arch.mk | 31 +++++++++++++++++++++++++++++++ digital/ucoolib/build/stm32f4.mk | 1 + digital/ucoolib/build/top.mk | 5 ++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/digital/ucoolib/build/arch.mk b/digital/ucoolib/build/arch.mk index 1d035047..75b9eaa6 100644 --- a/digital/ucoolib/build/arch.mk +++ b/digital/ucoolib/build/arch.mk @@ -79,6 +79,37 @@ $1_EXTRA_CLEAN += $$($1_PROGS:%=%.$1.lst) endef +# Define binary rules. +define arch_bin_rules + +hex: hex.$1 +srec: srec.$1 +bin: bin.$1 +all.$1: hex.$1 + +.PHONY: hex.$1 srec.$1 bin.$1 + +hex.$1: $$($1_PROGS:%=%.$1.hex) +srec.$1: $$($1_PROGS:%=%.$1.srec) +bin.$1: $$($1_PROGS:%=%.$1.bin) + +%.$1.hex: %.$1$$($1_ELF_SUFFIX) + @echo "HEX [$1] $$@" + $$Q$$($1_OBJCOPY) -O ihex $$< $$@ +%.$1.srec: %.$1$$($1_ELF_SUFFIX) + @echo "SREC [$1] $$@" + $$Q$$($1_OBJCOPY) -O srec $$< $$@ +%.$1.bin: %.$1$$($1_ELF_SUFFIX) + @echo "BIN [$1] $$@" + $$Q$$($1_OBJCOPY) -O binary $$< $$@ + +$1_EXTRA_CLEAN += $$($1_PROGS:%=%.$1.hex) \ + $$($1_PROGS:%=%.$1.srec) \ + $$($1_PROGS:%=%.$1.bin) + +endef + + # Define size report rules. define arch_size_rules diff --git a/digital/ucoolib/build/stm32f4.mk b/digital/ucoolib/build/stm32f4.mk index fca60c89..c22358ad 100644 --- a/digital/ucoolib/build/stm32f4.mk +++ b/digital/ucoolib/build/stm32f4.mk @@ -31,5 +31,6 @@ stm32f4_ELF_SUFFIX = .elf $(eval $(call arch_build_rules,stm32f4)) $(eval $(call arch_lst_rules,stm32f4)) +$(eval $(call arch_bin_rules,stm32f4)) $(eval $(call arch_size_rules,stm32f4)) $(eval $(call arch_misc_rules,stm32f4)) diff --git a/digital/ucoolib/build/top.mk b/digital/ucoolib/build/top.mk index adb4e950..7ac77351 100644 --- a/digital/ucoolib/build/top.mk +++ b/digital/ucoolib/build/top.mk @@ -30,11 +30,14 @@ Q = @ all: lst: size: +hex: +srec: +bin: clean: rmdir $(OBJDIR) 2> /dev/null || true -.PHONY: all lst size clean +.PHONY: all lst size hex srec bin clean # Modules and sources setup. -- cgit v1.2.3