Permalink
Browse files

toolchain: add .bin target along with .elf

  • Loading branch information...
1 parent f855571 commit bfd0d251c81c99143b1f48e744a419b7efaf9510 @pchickey committed Mar 13, 2012
Showing with 9 additions and 1 deletion.
  1. +8 −0 rules.mk
  2. +1 −1 simple/Makefile
View
@@ -6,8 +6,15 @@ include $(TOP)/toolchain.mk
# $1: target_name
#
define gen-target
+
+.PHONY: $1
+$1: $1.elf $1.hex
+
$1.elf: $($1_objs)
$(LD) $(LDFLAGS) -T $(LDSCRIPT) -o $$@ $$^ $(LIBS)
+$1.hex: $1.elf
+ $(OBJCOPY) -O ihex $1.elf $1.hex
+
$(foreach lib,$($1_libs),
$(call gen-target-lib-depends,$1.elf,$(lib)))
@@ -17,6 +24,7 @@ $(call object-cflags,$(obj),$($1_cflags)))
clean_$1: $(addprefix clean_,$($1_libs))
-rm $($1_objs)
-rm $1.elf
+ -rm $1.hex
endef
# gen-target-lib-depends
View
@@ -10,7 +10,7 @@ simple_cflags := -I$(AT91LIB) \
-I$(AT91LIB)/peripherals \
-I$(AT91LIB)/boards/$(BOARD) \
-default: simple.elf
+default: simple
# Include rules.mk last in each Makefile
include ../rules.mk

0 comments on commit bfd0d25

Please sign in to comment.