From ab58e92b480996d57ba0b5773326c601d4e5c35e Mon Sep 17 00:00:00 2001 From: ficeto Date: Thu, 14 May 2015 15:49:17 +0300 Subject: [PATCH 01/11] add toolchain to ignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 4400c7eb4..44f4cda8b 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,5 @@ avr-toolchain-*.zip /hardware/tools/listComPorts.exe build/macosx/esptool-*-osx.zip + +build/macosx/dist/osx-xtensa-lx106-elf.tgz From 8e14cdf93e1be1011c381095be914b1bfe6bee1e Mon Sep 17 00:00:00 2001 From: ficeto Date: Thu, 14 May 2015 16:08:16 +0300 Subject: [PATCH 02/11] fix FSFile template --- hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h index d675da114..7a4563357 100755 --- a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h @@ -61,13 +61,15 @@ public: size_t bytesWritten = 0; while (true){ size_t available = src.available(); + if(!available) + return bytesWritten; size_t willWrite = (available < bufferSize) ? available : bufferSize; src.read(obuf, willWrite); size_t cb = write(obuf, willWrite); - bytesWritten += cb; if (cb != willWrite) { return bytesWritten; } + bytesWritten += cb; } return bytesWritten; } From 1683c55dbd404046db88e72a70e89c204616467a Mon Sep 17 00:00:00 2001 From: ficeto Date: Thu, 14 May 2015 16:28:55 +0300 Subject: [PATCH 03/11] make sure write return a positive or zero value --- hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp index f2517cf98..d94af10ac 100755 --- a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp +++ b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp @@ -162,7 +162,8 @@ int FSFile::available() { size_t FSFile::write(const uint8_t *buf, size_t size){ if (! _file) return 0; - return SPIFFS_write(&_filesystemStorageHandle, _file, (uint8_t *)buf, size); + int res = SPIFFS_write(&_filesystemStorageHandle, _file, (uint8_t *)buf, size); + return (res > 0)?res:0; } size_t FSFile::write(uint8_t val) { From 984eb3f3f2096c90e7b82341eb1d9c55168967c2 Mon Sep 17 00:00:00 2001 From: ficeto Date: Thu, 14 May 2015 16:31:34 +0300 Subject: [PATCH 04/11] cast it --- hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp index d94af10ac..ce722e7ec 100755 --- a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp +++ b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp @@ -163,7 +163,7 @@ int FSFile::available() { size_t FSFile::write(const uint8_t *buf, size_t size){ if (! _file) return 0; int res = SPIFFS_write(&_filesystemStorageHandle, _file, (uint8_t *)buf, size); - return (res > 0)?res:0; + return (res > 0)?(size_t)res:0; } size_t FSFile::write(uint8_t val) { From c53daa7df355d8b06adb087de8033fb57dabf77d Mon Sep 17 00:00:00 2001 From: ficeto Date: Thu, 14 May 2015 16:37:13 +0300 Subject: [PATCH 05/11] blah --- hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h index 7a4563357..460595cf3 100755 --- a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.h @@ -80,7 +80,7 @@ public: class FSClass { private: - bool _mounted; + bool _mounted = false; public: bool mount(); From cd9300ef9cf72eab720d0b7b8ebc70cbbe43151c Mon Sep 17 00:00:00 2001 From: ficeto Date: Thu, 14 May 2015 17:20:15 +0300 Subject: [PATCH 06/11] mount spiffs on boot --- hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c index 0170b4bcf..67c47514c 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c @@ -78,4 +78,5 @@ void init() { timer1_isr_init(); os_timer_setfn(µs_overflow_timer, (os_timer_func_t*) µs_overflow_tick, 0); os_timer_arm(µs_overflow_timer, 60000, REPEAT); + spiffs_mount(); } From 43323440ae0caa0bf0303a01359fe4217aa0f9ee Mon Sep 17 00:00:00 2001 From: ficeto Date: Thu, 14 May 2015 19:10:05 +0300 Subject: [PATCH 07/11] add flash frequency and mode options --- hardware/esp8266com/esp8266/boards.txt | 33 +++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/hardware/esp8266com/esp8266/boards.txt b/hardware/esp8266com/esp8266/boards.txt index 4190e6483..c95179c14 100644 --- a/hardware/esp8266com/esp8266/boards.txt +++ b/hardware/esp8266com/esp8266/boards.txt @@ -1,6 +1,8 @@ menu.UploadSpeed=Upload Speed menu.CpuFrequency=CPU Frequency -menu.FlashSize=Flash size +menu.FlashSize=Flash Size +menu.FlashFreq=Flash Frequency +menu.FlashMode=Flash Mode ############################################################## generic.name=Generic ESP8266 Module @@ -57,6 +59,35 @@ generic.menu.FlashSize.2M.build.flash_size=2M generic.menu.FlashSize.4M=4M generic.menu.FlashSize.4M.build.flash_size=4M +generic.menu.FlashSize.512K=512K +generic.menu.FlashSize.512K.build.flash_size=512K +generic.menu.FlashSize.256K=256K +generic.menu.FlashSize.256K.build.flash_size=256K +generic.menu.FlashSize.1M=1M +generic.menu.FlashSize.1M.build.flash_size=1M +generic.menu.FlashSize.2M=2M +generic.menu.FlashSize.2M.build.flash_size=2M +generic.menu.FlashSize.4M=4M +generic.menu.FlashSize.4M.build.flash_size=4M + +generic.menu.FlashFreq.40=40MHz +generic.menu.FlashFreq.40.build.flash_freq=40 +generic.menu.FlashFreq.20=20MHz +generic.menu.FlashFreq.20.build.flash_freq=20 +generic.menu.FlashFreq.26=26.7MHz +generic.menu.FlashFreq.26.build.flash_freq=26.7 +generic.menu.FlashFreq.80=80MHz +generic.menu.FlashFreq.80.build.flash_freq=80 + +generic.menu.FlashMode.qio=QIO +generic.menu.FlashMode.qio.build.flash_mode=qio +generic.menu.FlashMode.qout=QOUT +generic.menu.FlashMode.qout.build.flash_mode=qout +generic.menu.FlashMode.dio=DIO +generic.menu.FlashMode.dio.build.flash_mode=dio +generic.menu.FlashMode.dout=DOUT +generic.menu.FlashMode.dout.build.flash_mode=dout + ############################################################## modwifi.name=Olimex MOD-WIFI-ESP8266(-DEV) From 577ddce3a771ab9c2f2afc0cd6cf642b9cfdf634 Mon Sep 17 00:00:00 2001 From: ficeto Date: Thu, 14 May 2015 19:17:53 +0300 Subject: [PATCH 08/11] double --- hardware/esp8266com/esp8266/boards.txt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/hardware/esp8266com/esp8266/boards.txt b/hardware/esp8266com/esp8266/boards.txt index c95179c14..e598bb884 100644 --- a/hardware/esp8266com/esp8266/boards.txt +++ b/hardware/esp8266com/esp8266/boards.txt @@ -59,17 +59,6 @@ generic.menu.FlashSize.2M.build.flash_size=2M generic.menu.FlashSize.4M=4M generic.menu.FlashSize.4M.build.flash_size=4M -generic.menu.FlashSize.512K=512K -generic.menu.FlashSize.512K.build.flash_size=512K -generic.menu.FlashSize.256K=256K -generic.menu.FlashSize.256K.build.flash_size=256K -generic.menu.FlashSize.1M=1M -generic.menu.FlashSize.1M.build.flash_size=1M -generic.menu.FlashSize.2M=2M -generic.menu.FlashSize.2M.build.flash_size=2M -generic.menu.FlashSize.4M=4M -generic.menu.FlashSize.4M.build.flash_size=4M - generic.menu.FlashFreq.40=40MHz generic.menu.FlashFreq.40.build.flash_freq=40 generic.menu.FlashFreq.20=20MHz From fa880d992fb384b53372cb10d8b0e6bfd6a3f580 Mon Sep 17 00:00:00 2001 From: ficeto Date: Fri, 15 May 2015 02:22:00 +0300 Subject: [PATCH 09/11] fix reading bytes from incoming POST upload proper error and premature connection loss should be implemented to handle weird cases where we might not get the whole post content --- .../esp8266/cores/esp8266/Arduino.h | 2 +- .../cores/esp8266/spiffs/spiffs_config.h | 1 - .../ESP8266WebServer/src/ESP8266WebServer.h | 1 + .../ESP8266WebServer/src/Parsing.cpp | 46 ++++++++++++------- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h b/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h index bd5f79625..1170b6f4a 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h @@ -38,7 +38,7 @@ extern "C" { #include "pgmspace.h" #include "esp8266_peri.h" #include "twi.h" -#include "spiffs/spiffs.h" + //#include "spiffs/spiffs.h" void yield(void); diff --git a/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_config.h b/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_config.h index 3c55cf97f..095bef900 100755 --- a/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_config.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_config.h @@ -20,7 +20,6 @@ #include "stddef.h" #include "osapi.h" #include "ets_sys.h" -#include // ----------- >8 ------------ #define IRAM_ATTR __attribute__((section(".iram.text"))) #define STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed)) diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h index 8f70bd621..375d09600 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h @@ -83,6 +83,7 @@ protected: static const char* _responseCodeToString(int code); void _parseForm(WiFiClient& client, String boundary, uint32_t len); void _uploadWriteByte(uint8_t b); + uint8_t _uploadReadByte(WiFiClient& client); struct RequestHandler; struct RequestArgument { diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/Parsing.cpp b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/Parsing.cpp index d2f0ee762..40a58d24a 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/Parsing.cpp +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/Parsing.cpp @@ -214,12 +214,22 @@ void ESP8266WebServer::_uploadWriteByte(uint8_t b){ _currentUpload.buf[_currentUpload.currentSize++] = b; } +uint8_t ESP8266WebServer::_uploadReadByte(WiFiClient& client){ + int res = client.read(); + if(res == -1){ + while(!client.available()) + yield(); + res = client.read(); + } + return (uint8_t)res; +} + void ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){ #ifdef DEBUG DEBUG_OUTPUT.print("Parse Form: Boundary: "); DEBUG_OUTPUT.print(boundary); - DEBUG_OUTPUT.print("Length: "); + DEBUG_OUTPUT.print(" Length: "); DEBUG_OUTPUT.println(len); #endif String line; @@ -249,17 +259,17 @@ void ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t argFilename = argName.substring(nameStart+2, argName.length() - 1); argName = argName.substring(0, argName.indexOf('"')); argIsFile = true; - #ifdef DEBUG +#ifdef DEBUG DEBUG_OUTPUT.print("PostArg FileName: "); DEBUG_OUTPUT.println(argFilename); - #endif +#endif //use GET to set the filename if uploading using blob if (argFilename == "blob" && hasArg("filename")) argFilename = arg("filename"); } - #ifdef DEBUG +#ifdef DEBUG DEBUG_OUTPUT.print("PostArg Name: "); DEBUG_OUTPUT.println(argName); - #endif +#endif argType = "text/plain"; line = client.readStringUntil('\r'); client.readStringUntil('\n'); @@ -269,10 +279,10 @@ void ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t client.readStringUntil('\r'); client.readStringUntil('\n'); } - #ifdef DEBUG +#ifdef DEBUG DEBUG_OUTPUT.print("PostArg Type: "); DEBUG_OUTPUT.println(argType); - #endif +#endif if (!argIsFile){ while(1){ line = client.readStringUntil('\r'); @@ -281,20 +291,20 @@ void ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t if (argValue.length() > 0) argValue += "\n"; argValue += line; } - #ifdef DEBUG +#ifdef DEBUG DEBUG_OUTPUT.print("PostArg Value: "); DEBUG_OUTPUT.println(argValue); DEBUG_OUTPUT.println(); - #endif +#endif RequestArgument& arg = postArgs[postArgsLen++]; arg.key = argName; arg.value = argValue; if (line == ("--"+boundary+"--")){ - #ifdef DEBUG +#ifdef DEBUG DEBUG_OUTPUT.println("Done Parsing POST"); - #endif +#endif break; } } else { @@ -312,23 +322,23 @@ void ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t #endif if (_fileUploadHandler) _fileUploadHandler(); _currentUpload.status = UPLOAD_FILE_WRITE; - uint8_t argByte = client.read(); + uint8_t argByte = _uploadReadByte(client); readfile: while(argByte != 0x0D){ _uploadWriteByte(argByte); - argByte = client.read(); + argByte = _uploadReadByte(client); } - argByte = client.read(); + argByte = _uploadReadByte(client); if (argByte == 0x0A){ - argByte = client.read(); + argByte = _uploadReadByte(client); if ((char)argByte != '-'){ //continue reading the file _uploadWriteByte(0x0D); _uploadWriteByte(0x0A); goto readfile; } else { - argByte = client.read(); + argByte = _uploadReadByte(client); if ((char)argByte != '-'){ //continue reading the file _uploadWriteByte(0x0D); @@ -366,11 +376,13 @@ readfile: } else { _uploadWriteByte(0x0D); _uploadWriteByte(0x0A); + _uploadWriteByte((uint8_t)('-')); + _uploadWriteByte((uint8_t)('-')); uint32_t i = 0; while(i < boundary.length()){ _uploadWriteByte(endBuf[i++]); } - argByte = client.read(); + argByte = _uploadReadByte(client); goto readfile; } } else { From 17bfb12941654ad92f9a9a4343e1068c685c5109 Mon Sep 17 00:00:00 2001 From: ficeto Date: Fri, 15 May 2015 13:54:42 +0300 Subject: [PATCH 10/11] use WDT_RESET macro in spiffs_flashmem methods --- .../esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c b/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c index d2ad74cc0..3caaaa99e 100755 --- a/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c @@ -184,7 +184,7 @@ uint32_t flashmem_write_internal( const void *from, uint32_t toaddr, uint32_t si return 0; os_memcpy(apbuf, from, size); } - WRITE_PERI_REG(0x60000914, 0x73); + WDT_RESET(); r = spi_flash_write(toaddr, apbuf?(uint32 *)apbuf:(uint32 *)from, size); if(apbuf) os_free(apbuf); @@ -200,7 +200,7 @@ uint32_t flashmem_read_internal( void *to, uint32_t fromaddr, uint32_t size ) { fromaddr -= INTERNAL_FLASH_START_ADDRESS; SpiFlashOpResult r; - WRITE_PERI_REG(0x60000914, 0x73); + WDT_RESET(); r = spi_flash_read(fromaddr, (uint32 *)to, size); if(SPI_FLASH_RESULT_OK == r) return size; From c11d7d473f0be24e0c26972f7c97e83725a12af2 Mon Sep 17 00:00:00 2001 From: ficeto Date: Fri, 15 May 2015 15:36:09 +0300 Subject: [PATCH 11/11] add flash splits depending on the flash size --- hardware/esp8266com/esp8266/boards.txt | 9 +++++++++ .../cores/esp8266/spiffs/spiffs_flashmem.c | 1 + hardware/esp8266com/esp8266/platform.txt | 3 +-- .../{eagle.app.v6.ld => eagle.app.v6.common.ld} | 9 --------- hardware/tools/esp8266/sdk/ld/eagle.flash.1m.ld | 17 +++++++++++++++++ .../tools/esp8266/sdk/ld/eagle.flash.256k.ld | 17 +++++++++++++++++ hardware/tools/esp8266/sdk/ld/eagle.flash.2m.ld | 17 +++++++++++++++++ hardware/tools/esp8266/sdk/ld/eagle.flash.4m.ld | 17 +++++++++++++++++ .../tools/esp8266/sdk/ld/eagle.flash.512k.ld | 17 +++++++++++++++++ 9 files changed, 96 insertions(+), 11 deletions(-) rename hardware/tools/esp8266/sdk/ld/{eagle.app.v6.ld => eagle.app.v6.common.ld} (92%) create mode 100644 hardware/tools/esp8266/sdk/ld/eagle.flash.1m.ld create mode 100644 hardware/tools/esp8266/sdk/ld/eagle.flash.256k.ld create mode 100644 hardware/tools/esp8266/sdk/ld/eagle.flash.2m.ld create mode 100644 hardware/tools/esp8266/sdk/ld/eagle.flash.4m.ld create mode 100644 hardware/tools/esp8266/sdk/ld/eagle.flash.512k.ld diff --git a/hardware/esp8266com/esp8266/boards.txt b/hardware/esp8266com/esp8266/boards.txt index e598bb884..4d6c41515 100644 --- a/hardware/esp8266com/esp8266/boards.txt +++ b/hardware/esp8266com/esp8266/boards.txt @@ -23,6 +23,7 @@ generic.build.variant=generic generic.build.flash_mode=qio generic.build.flash_size=512K generic.build.flash_freq=40 +generic.build.flash_ld=eagle.flash.512k.ld generic.menu.CpuFrequency.80=80 MHz generic.menu.CpuFrequency.80.build.f_cpu=80000000L @@ -50,14 +51,19 @@ generic.menu.UploadSpeed.921600.upload.speed=921600 generic.menu.FlashSize.512K=512K generic.menu.FlashSize.512K.build.flash_size=512K +generic.menu.FlashSize.512K.build.flash_ld=eagle.flash.512k.ld generic.menu.FlashSize.256K=256K generic.menu.FlashSize.256K.build.flash_size=256K +generic.menu.FlashSize.256K.build.flash_ld=eagle.flash.256k.ld generic.menu.FlashSize.1M=1M generic.menu.FlashSize.1M.build.flash_size=1M +generic.menu.FlashSize.1M.build.flash_ld=eagle.flash.1m.ld generic.menu.FlashSize.2M=2M generic.menu.FlashSize.2M.build.flash_size=2M +generic.menu.FlashSize.2M.build.flash_ld=eagle.flash.2m.ld generic.menu.FlashSize.4M=4M generic.menu.FlashSize.4M.build.flash_size=4M +generic.menu.FlashSize.4M.build.flash_ld=eagle.flash.4m.ld generic.menu.FlashFreq.40=40MHz generic.menu.FlashFreq.40.build.flash_freq=40 @@ -97,6 +103,7 @@ modwifi.build.variant=generic modwifi.build.flash_mode=qio modwifi.build.flash_size=2M modwifi.build.flash_freq=40 +modwifi.build.flash_ld=eagle.flash.2m.ld modwifi.menu.CpuFrequency.80=80 MHz modwifi.menu.CpuFrequency.80.build.f_cpu=80000000L @@ -142,6 +149,7 @@ nodemcu.build.variant=nodemcu nodemcu.build.flash_mode=qio nodemcu.build.flash_size=4M nodemcu.build.flash_freq=40 +nodemcu.build.flash_ld=eagle.flash.4m.ld nodemcu.menu.CpuFrequency.80=80 MHz nodemcu.menu.CpuFrequency.80.build.f_cpu=80000000L @@ -188,6 +196,7 @@ nodemcu.menu.FlashSize.4M.build.flash_size=4M # wifio.build.flash_mode=qio # wifio.build.flash_size=512K # wifio.build.flash_freq=40 +# wifio.build.flash_ld=eagle.flash.512k.ld # # wifio.menu.CpuFrequency.80=80MHz # wifio.menu.CpuFrequency.80.build.f_cpu=80000000L diff --git a/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c b/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c index 3caaaa99e..156e2fac2 100755 --- a/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_flashmem.c @@ -1,4 +1,5 @@ #include "flashmem.h" +#include "esp8266_peri.h" // Based on NodeMCU platform_flash // https://github.com/nodemcu/nodemcu-firmware diff --git a/hardware/esp8266com/esp8266/platform.txt b/hardware/esp8266com/esp8266/platform.txt index cd09aff98..bc4b20927 100644 --- a/hardware/esp8266com/esp8266/platform.txt +++ b/hardware/esp8266com/esp8266/platform.txt @@ -20,8 +20,7 @@ compiler.c.flags=-c -Os -Wpointer-arith -Wno-implicit-function-declaration -Wl,- compiler.S.cmd=xtensa-lx106-elf-gcc compiler.S.flags=-c -g -x assembler-with-cpp -MMD -compiler.c.elf.ldscript=eagle.app.v6.ld -compiler.c.elf.flags=-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{compiler.c.elf.ldscript}" +compiler.c.elf.flags=-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" compiler.c.elf.cmd=xtensa-lx106-elf-gcc compiler.c.elf.libs=-lm -lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain -lpp -lsmartconfig diff --git a/hardware/tools/esp8266/sdk/ld/eagle.app.v6.ld b/hardware/tools/esp8266/sdk/ld/eagle.app.v6.common.ld similarity index 92% rename from hardware/tools/esp8266/sdk/ld/eagle.app.v6.ld rename to hardware/tools/esp8266/sdk/ld/eagle.app.v6.common.ld index bbfd7f03c..986b441ff 100644 --- a/hardware/tools/esp8266/sdk/ld/eagle.app.v6.ld +++ b/hardware/tools/esp8266/sdk/ld/eagle.app.v6.common.ld @@ -1,12 +1,5 @@ /* This linker script generated from xt-genldscripts.tpp for LSP . */ /* Linker Script for ld -N */ -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 = 0x5B000 -} PHDRS { @@ -20,8 +13,6 @@ PHDRS /* Default entry point: */ ENTRY(call_user_start) -PROVIDE ( _SPIFFS_start = 0x4026B000 ); -PROVIDE ( _SPIFFS_end = 0x4027B000 ); PROVIDE(_memmap_vecbase_reset = 0x40000000); /* Various memory-map dependent cache attribute settings: */ _memmap_cacheattr_wb_base = 0x00000110; diff --git a/hardware/tools/esp8266/sdk/ld/eagle.flash.1m.ld b/hardware/tools/esp8266/sdk/ld/eagle.flash.1m.ld new file mode 100644 index 000000000..1ffd7e678 --- /dev/null +++ b/hardware/tools/esp8266/sdk/ld/eagle.flash.1m.ld @@ -0,0 +1,17 @@ +/* Flash Split for 1M chips */ +/* irom0 428KB */ +/* spiffs 512KB */ +/* eeprom 20KB */ + +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 = 0x6B000 +} + +PROVIDE ( _SPIFFS_start = 0x4027B000 ); +PROVIDE ( _SPIFFS_end = 0x402FB000 ); + +INCLUDE "../ld/eagle.app.v6.common.ld" diff --git a/hardware/tools/esp8266/sdk/ld/eagle.flash.256k.ld b/hardware/tools/esp8266/sdk/ld/eagle.flash.256k.ld new file mode 100644 index 000000000..8ecddb8b6 --- /dev/null +++ b/hardware/tools/esp8266/sdk/ld/eagle.flash.256k.ld @@ -0,0 +1,17 @@ +/* Flash Split for 256K chips */ +/* irom0 108KB */ +/* spiffs 64KB */ +/* eeprom 20KB */ + +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 = 0x1B000 +} + +PROVIDE ( _SPIFFS_start = 0x4022B000 ); +PROVIDE ( _SPIFFS_end = 0x4023B000 ); + +INCLUDE "../ld/eagle.app.v6.common.ld" diff --git a/hardware/tools/esp8266/sdk/ld/eagle.flash.2m.ld b/hardware/tools/esp8266/sdk/ld/eagle.flash.2m.ld new file mode 100644 index 000000000..cd6af2770 --- /dev/null +++ b/hardware/tools/esp8266/sdk/ld/eagle.flash.2m.ld @@ -0,0 +1,17 @@ +/* Flash Split for 2M chips */ +/* irom0 960KB */ +/* spiffs 1004KB */ +/* eeprom 20KB */ + +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 = 0xF0000 +} + +PROVIDE ( _SPIFFS_start = 0x40300000 ); +PROVIDE ( _SPIFFS_end = 0x403FB000 ); + +INCLUDE "../ld/eagle.app.v6.common.ld" diff --git a/hardware/tools/esp8266/sdk/ld/eagle.flash.4m.ld b/hardware/tools/esp8266/sdk/ld/eagle.flash.4m.ld new file mode 100644 index 000000000..7df2fa8ad --- /dev/null +++ b/hardware/tools/esp8266/sdk/ld/eagle.flash.4m.ld @@ -0,0 +1,17 @@ +/* Flash Split for 4M chips */ +/* irom0 960KB */ +/* spiffs 3052KB */ +/* eeprom 20KB */ + +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 = 0xF0000 +} + +PROVIDE ( _SPIFFS_start = 0x40300000 ); +PROVIDE ( _SPIFFS_end = 0x405FB000 ); + +INCLUDE "../ld/eagle.app.v6.common.ld" diff --git a/hardware/tools/esp8266/sdk/ld/eagle.flash.512k.ld b/hardware/tools/esp8266/sdk/ld/eagle.flash.512k.ld new file mode 100644 index 000000000..05160fe95 --- /dev/null +++ b/hardware/tools/esp8266/sdk/ld/eagle.flash.512k.ld @@ -0,0 +1,17 @@ +/* Flash Split for 512K chips */ +/* irom0 364KB */ +/* spiffs 64KB */ +/* eeprom 20KB */ + +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 = 0x5B000 +} + +PROVIDE ( _SPIFFS_start = 0x4026B000 ); +PROVIDE ( _SPIFFS_end = 0x4027B000 ); + +INCLUDE "../ld/eagle.app.v6.common.ld"