]> the.earth.li Git - esp8266-clock.git/blobdiff - Makefile
Update Makefile to link 2 separate ROMs
[esp8266-clock.git] / Makefile
index 3e0ffec47f9f85c27da9032c9a18f75dda516431..9fdad10ef1a7bda8eab00da780aab83deca2fe15 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,26 +8,26 @@ OBJDUMP = $(SDKDIR)/bin/xtensa-lx106-elf-objdump
 
 LIBS = -lc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lmain
 
-LD_SCRIPT = eagle.app.v6.ld
-
 CFLAGS = -Wall -Os -fno-inline-functions -mlongcalls -DICACHE_FLASH -I.
 LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static
 
 APP = clock
 OBJS = user_main.o max7219.o spi.o clock.o
 
-$(APP)-0x00000.bin: $(APP).elf
-       PATH=$$PATH:$(SDKDIR)/bin esptool.py elf2image $^ -o $(APP)-
+all: rom0.bin rom1.bin
+
+%.bin: %.elf
+       PATH=$$PATH:$(SDKDIR)/bin esptool.py elf2image $^ --version 2 -o $@
 
-$(APP).elf: $(APP)_app.a
-       $(LD) -T$(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(LIBS) $^ -Wl,--end-group -lgcc -o $@
+%.elf: $(APP)_app.a
+       $(LD) -T$(basename $@).ld $(LDFLAGS) -Wl,--start-group $(LIBS) $^ -Wl,--end-group -lgcc -o $@
        $(OBJDUMP) -h -j .data -j .rodata -j .bss -j .text -j .irom0.text $@
 
 $(APP)_app.a: project_config.h $(OBJS)
        $(AR) cru $@ $^
 
-flash: $(APP)-0x00000.bin $(APP)-0x10000.bin
-       $(SDKDIR)/bin/esptool.py write_flash 0 $(APP)-0x00000.bin 0x10000 $(APP)-0x10000.bin
+flash: rom0.bin rom1.bin
+       $(SDKDIR)/bin/esptool.py write_flash 0x2000 rom0.bin 0x42000 rom1.bin
 
 project_config.h:
        echo '#error "Edit this file to match your configuration."' > $@
@@ -35,4 +35,6 @@ project_config.h:
        echo '#define CFG_WIFI_PASSWORD "password"' >> $@
 
 clean:
-       rm -f $(OBJS) $(APP)_app.a $(APP).elf $(APP)-0x00000.bin $(APP)-0x10000.bin
+       rm -f $(OBJS) $(APP)_app.a $(APP).elf rom0.bin rom1.bin
+
+.PHONY: all clean