Skip to content

Commit ce5b99b

Browse files
committed
Flash blank.bin automatically for NONOS SDK and RTOS SDK // Resolve #62 Resolve #133
1 parent ab839a2 commit ce5b99b

File tree

2 files changed

+52
-16
lines changed

2 files changed

+52
-16
lines changed

builder/frameworks/esp8266-nonos-sdk.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,6 @@
9999
"airkiss", "at", "c", "crypto", "driver", "espnow", "gcc", "json", "lwip",
100100
"main", "mbedtls", "mesh", "net80211", "phy", "pp", "pwm", "smartconfig",
101101
"ssl", "upgrade", "wpa", "wpa2", "wps"
102-
],
103-
104-
FLASH_EXTRA_IMAGES=[
105-
("0x00000", join("$BUILD_DIR", "eagle.flash.bin")),
106-
("0x10000", join("$BUILD_DIR", "eagle.irom0text.bin")),
107-
("0x1fc000" if env.BoardConfig().get(
108-
"upload.maximum_size", 0) < 4194304 else "0x3fc000",
109-
join(FRAMEWORK_DIR, "bin", "esp_init_data_default.bin"))
110102
]
111103
)
112104

@@ -117,6 +109,32 @@
117109
LDSCRIPT_PATH=join(FRAMEWORK_DIR, "ld", "eagle.app.v6.ld")
118110
)
119111

112+
board_flash_size = int(env.BoardConfig().get("upload.maximum_size", 0))
113+
if board_flash_size > 8388608:
114+
init_data_flash_address = 0xffc000 # for 16 MB
115+
elif board_flash_size > 4194304:
116+
init_data_flash_address = 0x7fc000 # for 8 MB
117+
elif board_flash_size > 2097152:
118+
init_data_flash_address = 0x3fc000 # for 4 MB
119+
elif board_flash_size > 1048576:
120+
init_data_flash_address = 0x1fc000 # for 2 MB
121+
elif board_flash_size > 524288:
122+
init_data_flash_address = 0xfc000 # for 1 MB
123+
else:
124+
init_data_flash_address = 0x7c000 # for 512 kB
125+
126+
env.Append(
127+
FLASH_EXTRA_IMAGES=[
128+
("0x00000", join("$BUILD_DIR", "eagle.flash.bin")),
129+
("0x10000", join("$BUILD_DIR", "eagle.irom0text.bin")),
130+
(hex(init_data_flash_address),
131+
join(FRAMEWORK_DIR, "bin", "esp_init_data_default.bin")),
132+
(hex(init_data_flash_address + 0x2000),
133+
join(FRAMEWORK_DIR, "bin", "blank.bin"))
134+
]
135+
)
136+
137+
120138
#
121139
# Target: Build Driver Library
122140
#

builder/frameworks/esp8266-rtos-sdk.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,6 @@
9999
"cirom", "crypto", "driver", "espconn", "espnow", "freertos", "gcc",
100100
"json", "hal", "lwip", "main", "mesh", "mirom", "net80211", "nopoll",
101101
"phy", "pp", "pwm", "smartconfig", "spiffs", "ssl", "wpa", "wps"
102-
],
103-
104-
FLASH_EXTRA_IMAGES=[
105-
("0x00000", join("$BUILD_DIR", "eagle.flash.bin")),
106-
("0x10000", join("$BUILD_DIR", "eagle.irom0text.bin")),
107-
("0x1fc000" if env.BoardConfig().get(
108-
"upload.maximum_size", 0) < 4194304 else "0x3fc000",
109-
join(FRAMEWORK_DIR, "bin", "esp_init_data_default.bin"))
110102
]
111103
)
112104

@@ -117,6 +109,32 @@
117109
LDSCRIPT_PATH=join(FRAMEWORK_DIR, "ld", "eagle.app.v6.ld"),
118110
)
119111

112+
# Extra flash images
113+
board_flash_size = int(env.BoardConfig().get("upload.maximum_size", 0))
114+
if board_flash_size > 8388608:
115+
init_data_flash_address = 0xffc000 # for 16 MB
116+
elif board_flash_size > 4194304:
117+
init_data_flash_address = 0x7fc000 # for 8 MB
118+
elif board_flash_size > 2097152:
119+
init_data_flash_address = 0x3fc000 # for 4 MB
120+
elif board_flash_size > 1048576:
121+
init_data_flash_address = 0x1fc000 # for 2 MB
122+
elif board_flash_size > 524288:
123+
init_data_flash_address = 0xfc000 # for 1 MB
124+
else:
125+
init_data_flash_address = 0x7c000 # for 512 kB
126+
127+
env.Append(
128+
FLASH_EXTRA_IMAGES=[
129+
("0x00000", join("$BUILD_DIR", "eagle.flash.bin")),
130+
("0x20000", join("$BUILD_DIR", "eagle.irom0text.bin")),
131+
(hex(init_data_flash_address),
132+
join(FRAMEWORK_DIR, "bin", "esp_init_data_default.bin")),
133+
(hex(init_data_flash_address + 0x2000),
134+
join(FRAMEWORK_DIR, "bin", "blank.bin"))
135+
]
136+
)
137+
120138
#
121139
# Target: Build Driver Library
122140
#

0 commit comments

Comments
 (0)