Skip to content

Commit f0436d7

Browse files
committed
Merge branch 'bugfix/wrong_flash_size_at_bin_start' into 'release/v2.2.0.0_esp8266'
fix: Fixed an issue that flash size is set incorrectly on esp8266 See merge request application/esp-at!1467
2 parents c964081 + 48d3e7c commit f0436d7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/esp_at_factory_bin_combine.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import argparse
2828

2929
ESP_FLASH_MODE = {"QIO": 0, "QOUT": 1, "DIO": 2, "DOUT": 3, "FAST_READ": 4, "SLOW_READ": 5}
30-
ESP_FLASH_SIZE = {"1MB": 0, "2MB": 1, "4MB": 2, "8MB": 3, "16MB": 4}
30+
ESP_FLASH_SIZE = {"ESP8266": {"1MB": 2, "2MB": 3, "4MB": 4, "8MB": 8, "16MB": 9}, "DEFAULT": {"1MB": 0, "2MB": 1, "4MB": 2, "8MB": 3, "16MB": 4}}
3131
ESP_BIN_SIZE = {"1MB": 1024*1024, "2MB": 2*1024*1024, "4MB": 4*1024*1024, "8MB": 8*1024*1024, "16MB": 16*1024*1024}
3232
ESP_FLASH_SPEED = {"40M": 0, "26M": 1, "20M": 2, "80M": 0x0F}
3333

@@ -52,7 +52,12 @@ def esp32_at_combine_bin(module, flash_mode, flash_size, flash_speed, build_dir,
5252
bootloader_addr = bin_list['bootloader.bin']
5353
bin_data[bootloader_addr + 2] = ESP_FLASH_MODE[flash_mode] # Flash mode DIO
5454
# 0x20 Flash size 4MB, speed 40MHz
55-
bin_data[bootloader_addr + 3] = (ESP_FLASH_SIZE[flash_size] << 4) | ESP_FLASH_SPEED[flash_speed]
55+
56+
idf_target = os.environ.get('ESP_AT_PROJECT_PLATFORM').split('_', 1)[1].upper()
57+
if idf_target == 'ESP8266':
58+
bin_data[bootloader_addr + 3] = (ESP_FLASH_SIZE['ESP8266'][flash_size] << 4) | ESP_FLASH_SPEED[flash_speed]
59+
else:
60+
bin_data[bootloader_addr + 3] = (ESP_FLASH_SIZE['DEFAULT'][flash_size] << 4) | ESP_FLASH_SPEED[flash_speed]
5661

5762
if parameter_file != None:
5863
with open(parameter_file) as f:

0 commit comments

Comments
 (0)