diff --git a/cpu/avr/Makefile.avr b/cpu/avr/Makefile.avr index bc94010a2..4897fa645 100644 --- a/cpu/avr/Makefile.avr +++ b/cpu/avr/Makefile.avr @@ -220,12 +220,12 @@ symbols.c: cp ${CONTIKI}/tools/empty-symbols.h symbols.h # Generic rules for .hex, .eep and .sz (size) file: -%.$(TARGET).hex: %.$(TARGET) +%.$(TARGET)$(CUSTOM_SUFFIX).hex: %.$(TARGET)$(CUSTOM_SUFFIX) $(OBJCOPY) -j .text -j .data -O ihex $< $@ -%.$(TARGET).eep: %.$(TARGET) +%.$(TARGET)$(CUSTOM_SUFFIX).eep: %.$(TARGET)$(CUSTOM_SUFFIX) $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ --change-section-lma .eeprom=0 -O ihex $< $@ -%.$(TARGET).sz: %.$(TARGET) +%.$(TARGET)$(CUSTOM_SUFFIX).sz: %.$(TARGET)$(CUSTOM_SUFFIX) $(ELF_SIZE) $< diff --git a/examples/osd/.gitignore b/examples/osd/.gitignore index 179e9fe4c..22114c685 100644 --- a/examples/osd/.gitignore +++ b/examples/osd/.gitignore @@ -2,3 +2,5 @@ *.eep *.osd-merkur-128 *.osd-merkur-256 +*.osd-merkur-256.0 +*.osd-merkur-256.1 diff --git a/examples/osd/ota-update/Makefile b/examples/osd/ota-update/Makefile index b2e2dbc6e..a533469db 100644 --- a/examples/osd/ota-update/Makefile +++ b/examples/osd/ota-update/Makefile @@ -2,7 +2,6 @@ SKETCH=sketch EXE=ota - all: $(EXE) CONTIKI=../../.. @@ -39,11 +38,4 @@ APPS += arduino json-resource json #time include $(CONTIKI)/Makefile.include include $(CONTIKI)/apps/arduino/Makefile.include -avr-size: $(EXE).$(TARGET).sz - -flash: $(EXE).$(TARGET).u # $(EXE).$(TARGET).eu - -.PHONY: flash avr-size -.PRECIOUS: $(EXE).$(TARGET).hex $(EXE).$(TARGET).eep - AVRDUDE_PORT=/dev/ttyUSB1 diff --git a/platform/osd-merkur-256/Makefile.osd-merkur-256 b/platform/osd-merkur-256/Makefile.osd-merkur-256 index e88400b15..aa3dc61d9 100644 --- a/platform/osd-merkur-256/Makefile.osd-merkur-256 +++ b/platform/osd-merkur-256/Makefile.osd-merkur-256 @@ -99,6 +99,8 @@ else TEXT_SECTION_START=0x1ef00 endif +CUSTOM_SUFFIX=.$(BOOTLOADER_PARTITION) + LDFLAGS += -Wl,--defsym,bootloader_get_mac=$(BOOTLOADER_GET_MAC) \ -Wl,--defsym,_bootloader_write_page_to_flash=$(BOOTLOADER_WRITE_PAGE_TO_FLASH) \ -Wl,--defsym,bootloader_get_part_count=$(BOOTLOADER_GET_PART_COUNT) \ @@ -123,3 +125,31 @@ MODULES += core/net/mac core/net core/net/mac/sicslowmac \ # core/net/ipv6 core/net/ipv4 core/net/ip \ # core/net/rime \ # core/net/rpl \ + + +CUSTOM_RULE_LINK=1 + +%.$(TARGET)$(CUSTOM_SUFFIX): %.co $(PROJECT_OBJECTFILES) \ + $(PROJECT_LIBRARIES) contiki-$(TARGET).a + $(TRACE_LD) + $(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \ + ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ + +%: %.$(TARGET) + +%: %.$(TARGET)$(CUSTOM_SUFFIX) + @ + +%.$(TARGET)$(CUSTOM_SUFFIX)-combined.hex: %.$(TARGET)$(CUSTOM_SUFFIX).hex + $(CONTIKI)/tools/genbackupisr.py $< > $@ + +flash: $(EXE).$(TARGET)$(CUSTOM_SUFFIX)-combined.u + +avr-size: $(EXE).$(TARGET)$(CUSTOM_SUFFIX).sz + +.PHONY: flash avr-size + +.PRECIOUS: %.$(TARGET)$(CUSTOM_SUFFIX) \ + $(EXE).$(TARGET)$(CUSTOM_SUFFIX).hex \ + $(EXE).$(TARGET)$(CUSTOM_SUFFIX).eep \ + $(EXE).$(TARGET)$(CUSTOM_SUFFIX)-combined.hex diff --git a/examples/osd/ota-update/genbackupisr.py b/tools/genbackupisr.py similarity index 69% rename from examples/osd/ota-update/genbackupisr.py rename to tools/genbackupisr.py index ef5096398..2bfe5ae6c 100755 --- a/examples/osd/ota-update/genbackupisr.py +++ b/tools/genbackupisr.py @@ -10,6 +10,5 @@ import intelhex ihex = intelhex.IntelHex (sys.argv [1]) bin = ihex.tobinstr () [:0x200] -hex2 = intelhex.IntelHex () -hex2.puts (0x1ed00, bin) -hex2.tofile ("out.hex", format="hex") +ihex.puts (0x1ed00, bin) +ihex.tofile (sys.stdout, format="hex")