From 8d2bcaf3cdf5f908dd44bf822b65d807c8215bcc Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky <pfalcon@users.sourceforge.net> Date: Sun, 3 Apr 2016 15:40:53 +0300 Subject: [PATCH] esp8266: Minimize gap between Inst/DataRAM segments and FlashROM segment. With .rodata being in FlashROM now, gap can be much smaller now. InstRAM can be max 32K, and with segment headers, that already makes it more than 32K. Then there's some .data still, and the next Flash page boundary is 0x9000. That figure should be more or less future-proof. TODO: Refactor makeimg to take FlashROM segment offset from file name. --- esp8266/Makefile | 4 ++-- esp8266/esp8266.ld | 2 +- esp8266/makeimg.py | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/esp8266/Makefile b/esp8266/Makefile index 3bb63dd87..6790d5f74 100644 --- a/esp8266/Makefile +++ b/esp8266/Makefile @@ -150,7 +150,7 @@ $(BUILD)/frozen.c: $(wildcard $(SCRIPTDIR)/*) $(CONFVARS_FILE) deploy: $(BUILD)/firmware-combined.bin $(ECHO) "Writing $< to the board" #$(Q)esptool.py --port $(PORT) write_flash 0 $< - $(Q)esptool.py --port $(PORT) --baud $(BAUD) write_flash --flash_size=8m 0 $(BUILD)/firmware.elf-0x00000.bin 0x10000 $(BUILD)/firmware.elf-0x10000.bin + $(Q)esptool.py --port $(PORT) --baud $(BAUD) write_flash --flash_size=8m 0 $(BUILD)/firmware.elf-0x00000.bin 0x9000 $(BUILD)/firmware.elf-0x0[1-f]000.bin reset: echo -e "\r\nimport pyb; pyb.hard_reset()\r\n" >$(PORT) @@ -158,7 +158,7 @@ reset: $(BUILD)/firmware-combined.bin: $(BUILD)/firmware.elf $(ECHO) "Create $@" $(Q)esptool.py elf2image $^ - $(Q)$(PYTHON) makeimg.py $(BUILD)/firmware.elf-0x00000.bin $(BUILD)/firmware.elf-0x10000.bin $@ + $(Q)$(PYTHON) makeimg.py $(BUILD)/firmware.elf-0x00000.bin $(BUILD)/firmware.elf-0x0[1-f]000.bin $@ $(BUILD)/firmware.elf: $(OBJ) $(ECHO) "LINK $@" diff --git a/esp8266/esp8266.ld b/esp8266/esp8266.ld index 87a0e5488..a74e2d25d 100644 --- a/esp8266/esp8266.ld +++ b/esp8266/esp8266.ld @@ -5,7 +5,7 @@ MEMORY dport0_0_seg : org = 0x3ff00000, len = 0x10 dram0_0_seg : org = 0x3ffe8000, len = 0x14000 iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40210000, len = 0x80000 + irom0_0_seg : org = 0x40209000, len = 0x80000 } /* define the top of RAM */ diff --git a/esp8266/makeimg.py b/esp8266/makeimg.py index 1ac681cb7..e63f956bd 100644 --- a/esp8266/makeimg.py +++ b/esp8266/makeimg.py @@ -1,5 +1,7 @@ import sys +SEGS_MAX_SIZE = 0x9000 + assert len(sys.argv) == 4 with open(sys.argv[3], 'wb') as fout: @@ -9,7 +11,7 @@ with open(sys.argv[3], 'wb') as fout: fout.write(data_flash) print('flash ', len(data_flash)) - pad = b'\xff' * (0x10000 - len(data_flash)) + pad = b'\xff' * (SEGS_MAX_SIZE - len(data_flash)) fout.write(pad) print('padding ', len(pad)) @@ -18,4 +20,4 @@ with open(sys.argv[3], 'wb') as fout: fout.write(data_rom) print('irom0text', len(data_rom)) - print('total ', 0x10000 + len(data_rom)) + print('total ', SEGS_MAX_SIZE + len(data_rom)) -- GitLab