From 5104b4ced31cd2aa872d8353c89a72da42328a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sun, 26 Aug 2018 16:32:38 +0200 Subject: [PATCH] Support for 2MB boards with 1MB SPIFFS and 4 sectors for EEPROM --- code/eagle.flash.1m0m1s.ld | 2 +- code/eagle.flash.1m0m2s.ld | 6 +++--- code/eagle.flash.2m1m4s.ld | 20 ++++++++++++++++++++ code/eagle.flash.4m1m4s.ld | 2 +- code/eagle.flash.4m3m4e.ld | 2 +- code/eagle.flash.512k0m1s.ld | 2 +- code/espurna/utils.ino | 4 ---- code/ota.py | 2 +- code/platformio.ini | 30 ++++++++++++++++++++++++++++-- 9 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 code/eagle.flash.2m1m4s.ld diff --git a/code/eagle.flash.1m0m1s.ld b/code/eagle.flash.1m0m1s.ld index 046c3d87..4102c750 100644 --- a/code/eagle.flash.1m0m1s.ld +++ b/code/eagle.flash.1m0m1s.ld @@ -1,4 +1,4 @@ -/* Flash Split for 1M chips */ +/* Flash Split for 1M chips, no SPIFFS, 1 sector for EEPROM */ /* sketch 999KB */ /* eeprom 4KB */ /* reserved 16KB */ diff --git a/code/eagle.flash.1m0m2s.ld b/code/eagle.flash.1m0m2s.ld index bf07dccd..069f337d 100644 --- a/code/eagle.flash.1m0m2s.ld +++ b/code/eagle.flash.1m0m2s.ld @@ -1,4 +1,4 @@ -/* Flash Split for 1M chips, no SPIFFS */ +/* Flash Split for 1M chips, no SPIFFS, 2 sectors for EEPROM */ /* sketch 995KB */ /* eeprom 8KB */ /* reserved 16KB */ @@ -13,7 +13,7 @@ MEMORY PROVIDE ( _SPIFFS_start = 0x402FA000 ); PROVIDE ( _SPIFFS_end = 0x402FA000 ); -PROVIDE ( _SPIFFS_page = 0 ); -PROVIDE ( _SPIFFS_block = 0 ); +PROVIDE ( _SPIFFS_page = 0x0 ); +PROVIDE ( _SPIFFS_block = 0x0 ); INCLUDE "../ld/eagle.app.v6.common.ld" diff --git a/code/eagle.flash.2m1m4s.ld b/code/eagle.flash.2m1m4s.ld new file mode 100644 index 00000000..9d300dd1 --- /dev/null +++ b/code/eagle.flash.2m1m4s.ld @@ -0,0 +1,20 @@ +/* Flash Split for 2M chips, ~1M SPIFFS, 4 sectors for EEPROM */ +/* sketch 1019KB */ +/* spiffs 992KB */ +/* eeprom 16KB */ +/* reserved 16KB */ + +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 = 0x40201010, len = 0xfeff0 +} + +PROVIDE ( _SPIFFS_start = 0x40300000 ); +PROVIDE ( _SPIFFS_end = 0x403F8000 ); +PROVIDE ( _SPIFFS_page = 0x100 ); +PROVIDE ( _SPIFFS_block = 0x2000 ); + +INCLUDE "../ld/eagle.app.v6.common.ld" diff --git a/code/eagle.flash.4m1m4s.ld b/code/eagle.flash.4m1m4s.ld index 696adcdc..0812c369 100644 --- a/code/eagle.flash.4m1m4s.ld +++ b/code/eagle.flash.4m1m4s.ld @@ -1,4 +1,4 @@ -/* Flash Split for 4M chips */ +/* Flash Split for 4M chips, ~1M for SPIFFS, 4 sectors for EEPROM */ /* sketch 1019KB */ /* empty/ota? 2048KB */ /* spiffs 992KB */ diff --git a/code/eagle.flash.4m3m4e.ld b/code/eagle.flash.4m3m4e.ld index 6470d827..f25a3874 100644 --- a/code/eagle.flash.4m3m4e.ld +++ b/code/eagle.flash.4m3m4e.ld @@ -1,4 +1,4 @@ -/* Flash Split for 4M chips */ +/* Flash Split for 4M chips, ~3M for SPIFFS, 4 sectors for EEPROM */ /* sketch 1019KB */ /* spiffs 3040KB */ /* eeprom 16KB */ diff --git a/code/eagle.flash.512k0m1s.ld b/code/eagle.flash.512k0m1s.ld index e5a819d7..79d17352 100644 --- a/code/eagle.flash.512k0m1s.ld +++ b/code/eagle.flash.512k0m1s.ld @@ -1,4 +1,4 @@ -/* Flash Split for 512K chips */ +/* Flash Split for 512K chips, no SPIFFS, 1 sector for EEPROM */ /* sketch 487KB */ /* eeprom 4KB */ /* reserved 16KB */ diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index b07c9f7a..e2ea42db 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -52,10 +52,6 @@ String getCoreRevision() { #endif } -unsigned long maxSketchSpace() { - return (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; -} - // WTF // Calling ESP.getFreeHeap() is making the system crash on a specific // AiLight bulb, but anywhere else... diff --git a/code/ota.py b/code/ota.py index 17747b5e..90f6a702 100755 --- a/code/ota.py +++ b/code/ota.py @@ -209,7 +209,7 @@ def input_board(): # Choose board size of none before if board.get('size', 0) == 0: try: - board['size'] = int(input("Board memory size (1 for 1M, 4 for 4M): ")) + board['size'] = int(input("Board memory size (1 for 1M, 2 for 2M, 4 for 4M): ")) except ValueError: print("Wrong memory size") return None diff --git a/code/platformio.ini b/code/platformio.ini index 7ed939cd..97bb0aaf 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -41,6 +41,7 @@ debug_flags = -DDEBUG_ESP_CORE -DDEBUG_ESP_SSL -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP build_flags = -g -w -DMQTT_MAX_PACKET_SIZE=400 -DNO_GLOBAL_EEPROM ${sysenv.ESPURNA_FLAGS} -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH build_flags_512k = ${common.build_flags} -Wl,-Teagle.flash.512k0m1s.ld build_flags_1m0m = ${common.build_flags} -Wl,-Teagle.flash.1m0m1s.ld +build_flags_2m1m = ${common.build_flags} -Wl,-Teagle.flash.2m1m4s.ld build_flags_4m1m = ${common.build_flags} -Wl,-Teagle.flash.4m1m4s.ld build_flags_4m3m = ${common.build_flags} -Wl,-Teagle.flash.4m3m4s.ld @@ -55,6 +56,7 @@ upload_flags = --auth="${sysenv.ESPURNA_AUTH}" # ------------------------------------------------------------------------------ framework = arduino board_1m = esp01_1m +board_2m = esp_wroom_02 board_4m = esp12e flash_mode = dout monitor_speed = 115200 @@ -108,6 +110,17 @@ build_flags = ${common.build_flags_1m0m} -DESPURNA_CORE monitor_speed = ${common.monitor_speed} extra_scripts = ${common.extra_scripts} +[env:espurna-core-2MB] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_2m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_2m1m} -DESPURNA_CORE +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + [env:espurna-core-4MB] platform = ${common.platform} framework = ${common.framework} @@ -136,6 +149,19 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} extra_scripts = ${common.extra_scripts} +[env:esp8266-2m-ota] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_2m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_2m1m} -D${sysenv.ESPURNA_BOARD} +upload_speed = ${common.upload_speed} +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +extra_scripts = ${common.extra_scripts} + [env:esp8266-4m-ota] platform = ${common.platform} framework = ${common.framework} @@ -2529,7 +2555,7 @@ board = ${common.board_1m} board_build.flash_mode = ${common.flash_mode} lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m0m} -DALLTERCO_SHELLY1 +build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY1 monitor_speed = ${common.monitor_speed} extra_scripts = ${common.extra_scripts} @@ -2540,7 +2566,7 @@ board = ${common.board_1m} board_build.flash_mode = ${common.flash_mode} lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} -build_flags = ${common.build_flags_1m0m} -DALLTERCO_SHELLY1 +build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY1 upload_speed = ${common.upload_speed} upload_port = ${common.upload_port} upload_flags = ${common.upload_flags}