Skip to content

Commit 8d2bcaf

Browse files
committed
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.
1 parent 9698a60 commit 8d2bcaf

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

esp8266/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ $(BUILD)/frozen.c: $(wildcard $(SCRIPTDIR)/*) $(CONFVARS_FILE)
150150
deploy: $(BUILD)/firmware-combined.bin
151151
$(ECHO) "Writing $< to the board"
152152
#$(Q)esptool.py --port $(PORT) write_flash 0 $<
153-
$(Q)esptool.py --port $(PORT) --baud $(BAUD) write_flash --flash_size=8m 0 $(BUILD)/firmware.elf-0x00000.bin 0x10000 $(BUILD)/firmware.elf-0x10000.bin
153+
$(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
154154

155155
reset:
156156
echo -e "\r\nimport pyb; pyb.hard_reset()\r\n" >$(PORT)
157157

158158
$(BUILD)/firmware-combined.bin: $(BUILD)/firmware.elf
159159
$(ECHO) "Create $@"
160160
$(Q)esptool.py elf2image $^
161-
$(Q)$(PYTHON) makeimg.py $(BUILD)/firmware.elf-0x00000.bin $(BUILD)/firmware.elf-0x10000.bin $@
161+
$(Q)$(PYTHON) makeimg.py $(BUILD)/firmware.elf-0x00000.bin $(BUILD)/firmware.elf-0x0[1-f]000.bin $@
162162

163163
$(BUILD)/firmware.elf: $(OBJ)
164164
$(ECHO) "LINK $@"

esp8266/esp8266.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ MEMORY
55
dport0_0_seg : org = 0x3ff00000, len = 0x10
66
dram0_0_seg : org = 0x3ffe8000, len = 0x14000
77
iram1_0_seg : org = 0x40100000, len = 0x8000
8-
irom0_0_seg : org = 0x40210000, len = 0x80000
8+
irom0_0_seg : org = 0x40209000, len = 0x80000
99
}
1010

1111
/* define the top of RAM */

esp8266/makeimg.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import sys
22

3+
SEGS_MAX_SIZE = 0x9000
4+
35
assert len(sys.argv) == 4
46

57
with open(sys.argv[3], 'wb') as fout:
@@ -9,7 +11,7 @@
911
fout.write(data_flash)
1012
print('flash ', len(data_flash))
1113

12-
pad = b'\xff' * (0x10000 - len(data_flash))
14+
pad = b'\xff' * (SEGS_MAX_SIZE - len(data_flash))
1315
fout.write(pad)
1416
print('padding ', len(pad))
1517

@@ -18,4 +20,4 @@
1820
fout.write(data_rom)
1921
print('irom0text', len(data_rom))
2022

21-
print('total ', 0x10000 + len(data_rom))
23+
print('total ', SEGS_MAX_SIZE + len(data_rom))

0 commit comments

Comments
 (0)