cc2538: Generate .hex output

ELF files generated by GCC make SmartRF Flash Programmer 2 crash (only the TI
format is supported by this tool for ELFs), and binary files are not very
appropriate because they are gapless, so generate Intel HEX files since these
are very well supported by most programming tools while still flexible.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
This commit is contained in:
Benoît Thébaudeau 2013-10-31 16:25:27 +01:00
parent a6227e1e3e
commit 974850cdf2

View file

@ -27,7 +27,7 @@ ifdef NODEID
endif endif
### CPU-dependent cleanup files ### CPU-dependent cleanup files
CLEAN += symbols.c symbols.h *.d *.elf CLEAN += symbols.c symbols.h *.d *.elf *.hex
### CPU-dependent directories ### CPU-dependent directories
CONTIKI_CPU_DIRS = . dev usb CONTIKI_CPU_DIRS = . dev usb
@ -54,7 +54,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES)
CONTIKI_SOURCEFILES += $(USB_CORE_SOURCEFILES) $(USB_ARCH_SOURCEFILES) CONTIKI_SOURCEFILES += $(USB_CORE_SOURCEFILES) $(USB_ARCH_SOURCEFILES)
### Don't treat the .elf as intermediate ### Don't treat the .elf as intermediate
.PRECIOUS: %.elf %.bin .PRECIOUS: %.elf %.hex %.bin
### Always re-build ieee-addr.o in case the command line passes a new NODEID ### Always re-build ieee-addr.o in case the command line passes a new NODEID
FORCE: FORCE:
@ -70,12 +70,15 @@ CUSTOM_RULE_LINK=1
$(TRACE_LD) $(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} -o $@ $(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} -o $@
%.hex: %.elf
$(OBJCOPY) -O ihex $< $@
%.bin: %.elf %.bin: %.elf
$(OBJCOPY) $(OBJCOPY_FLAGS) $< $@ $(OBJCOPY) $(OBJCOPY_FLAGS) $< $@
### We don't really need the .bin for the .$(TARGET) but let's make sure it ### We don't really need the .hex and .bin for the .$(TARGET) but let's make
### gets built ### sure they get built
%.$(TARGET): %.elf %.bin %.$(TARGET): %.elf %.hex %.bin
cp $< $@ cp $< $@
### This rule is used to generate the correct linker script ### This rule is used to generate the correct linker script