From a1cfbeeed62b986f4f1781be6c53cbfd65036b81 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 May 2015 19:40:00 +0300 Subject: [PATCH 01/16] Update esptool to 0.4.4 --- build/build.xml | 34 ++++++++++---------- build/linux/esptool-0.4.3-linux64.zip.sha | 1 - build/linux/esptool-0.4.4-linux64.tar.gz.sha | 1 + build/macosx/esptool-0.4.3-osx.zip.sha | 1 - build/macosx/esptool-0.4.4-osx.tar.gz.sha | 1 + build/windows/esptool-0.4.3-win32.zip.sha | 1 - build/windows/esptool-0.4.4-win32.zip.sha | 1 + 7 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 build/linux/esptool-0.4.3-linux64.zip.sha create mode 100644 build/linux/esptool-0.4.4-linux64.tar.gz.sha delete mode 100644 build/macosx/esptool-0.4.3-osx.zip.sha create mode 100644 build/macosx/esptool-0.4.4-osx.tar.gz.sha delete mode 100644 build/windows/esptool-0.4.3-win32.zip.sha create mode 100644 build/windows/esptool-0.4.4-win32.zip.sha diff --git a/build/build.xml b/build/build.xml index f401fade4..95c401670 100644 --- a/build/build.xml +++ b/build/build.xml @@ -397,14 +397,14 @@ - - - - + + + + - - + + @@ -670,14 +670,14 @@ - - - - + + + + - - + + @@ -924,13 +924,13 @@ - - - + + + - - + + diff --git a/build/linux/esptool-0.4.3-linux64.zip.sha b/build/linux/esptool-0.4.3-linux64.zip.sha deleted file mode 100644 index cafdd1a92..000000000 --- a/build/linux/esptool-0.4.3-linux64.zip.sha +++ /dev/null @@ -1 +0,0 @@ -f183d52557a50dd362fcb4d45ffd6612b328e465 diff --git a/build/linux/esptool-0.4.4-linux64.tar.gz.sha b/build/linux/esptool-0.4.4-linux64.tar.gz.sha new file mode 100644 index 000000000..18f5fabdd --- /dev/null +++ b/build/linux/esptool-0.4.4-linux64.tar.gz.sha @@ -0,0 +1 @@ +65e4b3c4a26e7960536f8f2a19c5d65a13fe8025 diff --git a/build/macosx/esptool-0.4.3-osx.zip.sha b/build/macosx/esptool-0.4.3-osx.zip.sha deleted file mode 100644 index e53e8f92d..000000000 --- a/build/macosx/esptool-0.4.3-osx.zip.sha +++ /dev/null @@ -1 +0,0 @@ -544070e40abd3a81cad554020be86157674f9794 diff --git a/build/macosx/esptool-0.4.4-osx.tar.gz.sha b/build/macosx/esptool-0.4.4-osx.tar.gz.sha new file mode 100644 index 000000000..0cf3a3d4a --- /dev/null +++ b/build/macosx/esptool-0.4.4-osx.tar.gz.sha @@ -0,0 +1 @@ +26c53e32887b0c41dab861df93a60d1688e7762b diff --git a/build/windows/esptool-0.4.3-win32.zip.sha b/build/windows/esptool-0.4.3-win32.zip.sha deleted file mode 100644 index 7fc401038..000000000 --- a/build/windows/esptool-0.4.3-win32.zip.sha +++ /dev/null @@ -1 +0,0 @@ -10eb2292bb20accceb7389ab91fa40afd5b1fb70 diff --git a/build/windows/esptool-0.4.4-win32.zip.sha b/build/windows/esptool-0.4.4-win32.zip.sha new file mode 100644 index 000000000..9fea4d2e5 --- /dev/null +++ b/build/windows/esptool-0.4.4-win32.zip.sha @@ -0,0 +1 @@ +2d1beb3fb3af8b16bca15b7cd6f61aec10cc52cb From 141c4a0147746150a67fa5331e5d80f969313a1b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 May 2015 20:06:24 +0300 Subject: [PATCH 02/16] Make platform.txt compatible with board manager package --- hardware/esp8266com/esp8266/platform.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hardware/esp8266com/esp8266/platform.txt b/hardware/esp8266com/esp8266/platform.txt index a408813f4..a776b7e9c 100644 --- a/hardware/esp8266com/esp8266/platform.txt +++ b/hardware/esp8266com/esp8266/platform.txt @@ -6,12 +6,15 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification name=ESP8266 Modules -version=1.6.1 +version=1.6.4 -compiler.tools.path={runtime.platform.path}/tools/ -compiler.path={compiler.tools.path}xtensa-lx106-elf/bin/ -compiler.sdk.path={compiler.tools.path}sdk/ +#board-manager-package-compat-begin +runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf-gcc +runtime.tools.esptool.path={runtime.platform.path}/tools +#board-manager-package-compat-end +compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/ +compiler.sdk.path={runtime.platform.path}/tools/sdk/ compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" compiler.c.cmd=xtensa-lx106-elf-gcc @@ -33,7 +36,6 @@ compiler.ar.cmd=xtensa-lx106-elf-ar compiler.ar.flags=cru compiler.elf2hex.cmd=esptool - compiler.elf2hex.flags= compiler.size.cmd=xtensa-lx106-elf-size @@ -74,7 +76,7 @@ recipe.objcopy.eep.pattern= ## Create hex #recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" -recipe.objcopy.hex.pattern="{compiler.tools.path}{compiler.esptool.cmd}" -eo "{build.path}/{build.project_name}.elf" -bo "{build.path}/{build.project_name}_00000.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bs .data -bs .rodata -bc -ec -eo "{build.path}/{build.project_name}.elf" -es .irom0.text "{build.path}/{build.project_name}_10000.bin" -ec +recipe.objcopy.hex.pattern="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{build.path}/{build.project_name}.elf" -bo "{build.path}/{build.project_name}_00000.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bs .data -bs .rodata -bc -ec -eo "{build.path}/{build.project_name}.elf" -es .irom0.text "{build.path}/{build.project_name}_10000.bin" -ec ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" @@ -86,9 +88,8 @@ recipe.size.regex=^(?:\.text|\.data|\.rodata|\.irom0\.text|)\s+([0-9]+).* tools.esptool.cmd=esptool tools.esptool.cmd.windows=esptool.exe -tools.esptool.path={runtime.platform.path}/tools tools.esptool.upload.protocol=esp tools.esptool.upload.params.verbose=-vv tools.esptool.upload.params.quiet= -tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" -ca 0x00000 -cf "{build.path}/{build.project_name}_00000.bin" -ca 0x10000 -cf "{build.path}/{build.project_name}_10000.bin" +tools.esptool.upload.pattern="{runtime.tools.esptool.path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" -ca 0x00000 -cf "{build.path}/{build.project_name}_00000.bin" -ca 0x10000 -cf "{build.path}/{build.project_name}_10000.bin" From 469427c7466d0ba6b357dd73e639cc3b12b73b2a Mon Sep 17 00:00:00 2001 From: ficeto Date: Mon, 18 May 2015 21:45:00 +0300 Subject: [PATCH 03/16] fix buffer and block size --- hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp | 6 ++++++ hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp b/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp index af6d99468..cb5533690 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp +++ b/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp @@ -175,6 +175,12 @@ uint32_t EspClass::getFlashChipSize(void) return (2_MB); case 0x4: // 32 MBit (4MB) return (4_MB); + case 0x5: // 64 MBit (8MB) + return (8_MB); + case 0x6: // 128 MBit (16MB) + return (16_MB); + case 0x7: // 256 MBit (32MB) + return (32_MB); default: // fail? return 0; } diff --git a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp index 0399e4fce..34c4b43fa 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp +++ b/hardware/esp8266com/esp8266/cores/esp8266/FileSystem.cpp @@ -23,7 +23,7 @@ #include "spiffs/spiffs_esp8266.h" #define LOGICAL_PAGE_SIZE 256 -#define LOGICAL_BLOCK_SIZE 512 +#define LOGICAL_BLOCK_SIZE (INTERNAL_FLASH_SECTOR_SIZE * 1) // These addresses are defined in the linker script. @@ -64,7 +64,7 @@ int FSClass::_mountInternal(){ SPIFFS_API_DBG_V("FSClass::_mountInternal: start:%x, size:%d Kb\n", cfg.phys_addr, cfg.phys_size / 1024); - _work.reset(new uint8_t[LOGICAL_BLOCK_SIZE]); + _work.reset(new uint8_t[2*LOGICAL_PAGE_SIZE]); _fdsSize = 32 * _maxOpenFiles; _fds.reset(new uint8_t[_fdsSize]); _cacheSize = (32 + LOGICAL_PAGE_SIZE) * _maxOpenFiles; From d6b5beb424e115ae85ddfd29e2289893faa15827 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 May 2015 21:52:15 +0300 Subject: [PATCH 04/16] Fix tools path --- hardware/esp8266com/esp8266/platform.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hardware/esp8266com/esp8266/platform.txt b/hardware/esp8266com/esp8266/platform.txt index a776b7e9c..c2cfa053e 100644 --- a/hardware/esp8266com/esp8266/platform.txt +++ b/hardware/esp8266com/esp8266/platform.txt @@ -8,10 +8,8 @@ name=ESP8266 Modules version=1.6.4 -#board-manager-package-compat-begin -runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf-gcc +runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf runtime.tools.esptool.path={runtime.platform.path}/tools -#board-manager-package-compat-end compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/ compiler.sdk.path={runtime.platform.path}/tools/sdk/ @@ -88,8 +86,9 @@ recipe.size.regex=^(?:\.text|\.data|\.rodata|\.irom0\.text|)\s+([0-9]+).* tools.esptool.cmd=esptool tools.esptool.cmd.windows=esptool.exe +tools.esptool.path={runtime.platform.path}/tools tools.esptool.upload.protocol=esp tools.esptool.upload.params.verbose=-vv tools.esptool.upload.params.quiet= -tools.esptool.upload.pattern="{runtime.tools.esptool.path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" -ca 0x00000 -cf "{build.path}/{build.project_name}_00000.bin" -ca 0x10000 -cf "{build.path}/{build.project_name}_10000.bin" +tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" -ca 0x00000 -cf "{build.path}/{build.project_name}_00000.bin" -ca 0x10000 -cf "{build.path}/{build.project_name}_10000.bin" From 81d038f1bc7305359e3cc18db23765a4a4e2d4c8 Mon Sep 17 00:00:00 2001 From: ficeto Date: Mon, 18 May 2015 22:34:34 +0300 Subject: [PATCH 05/16] add method to get the actual size of the flash --- hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp | 5 +++++ hardware/esp8266com/esp8266/cores/esp8266/Esp.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp b/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp index cb5533690..67e6a41af 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp +++ b/hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp @@ -158,6 +158,11 @@ uint32_t EspClass::getFlashChipId(void) return spi_flash_get_id(); } +uint32_t EspClass::getFlashChipRealSize(void) +{ + return (1 << ((spi_flash_get_id() >> 16) & 0xFF)); +} + uint32_t EspClass::getFlashChipSize(void) { uint32_t data; diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Esp.h b/hardware/esp8266com/esp8266/cores/esp8266/Esp.h index 9750dd312..5e356459e 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Esp.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/Esp.h @@ -90,6 +90,9 @@ class EspClass { uint8_t getCpuFreqMHz(void); uint32_t getFlashChipId(void); + //gets the actual chip size based on the flash id + uint32_t getFlashChipRealSize(void); + //gets the size of the flash as set by the compiler uint32_t getFlashChipSize(void); uint32_t getFlashChipSpeed(void); FlashMode_t getFlashChipMode(void); From d69c3782e34385cec069b63258d6122af570df74 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 May 2015 22:51:19 +0300 Subject: [PATCH 06/16] add script for board manager package generation --- build/build_board_manager_package.sh | 121 +++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100755 build/build_board_manager_package.sh diff --git a/build/build_board_manager_package.sh b/build/build_board_manager_package.sh new file mode 100755 index 000000000..592dc2994 --- /dev/null +++ b/build/build_board_manager_package.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +ver=`git describe --tags` +outdir=esp8266-$ver +srcdir=../hardware/esp8266com/esp8266/ +mkdir -p $outdir +cp -R $srcdir/* $outdir/ +cat $srcdir/platform.txt | \ +gsed 's/runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-lx106-elf//g' | \ +gsed 's/runtime.tools.esptool.path={runtime.platform.path}\/tools//g' | \ +gsed 's/tools.esptool.path={runtime.platform.path}\/tools/tools.esptool.path=\{runtime.tools.esptool.path\}/g' \ + > $outdir/platform.txt + +zip -r $outdir.zip $outdir +sha=`shasum -a 256 $outdir.zip | cut -f 1 -d ' '` +size=`/bin/ls -l $outdir.zip | awk '{print $5}'` +echo Size: $size +echo SHA-256: $sha + +scp $outdir.zip dl:apps/download_files/download/ + + +cat << EOF > package_esp8266com_index.json +{ + "packages": [ { + "name":"esp8266", + "maintainer":"ESP8266 Community", + "websiteURL":"https://github.com/esp8266/Arduino", + "email":"ivan@esp8266.com", + "help":{ + "online":"http://esp8266.com" + }, + + "platforms": [ { + "name":"esp8266", + "architecture":"esp8266", + "version":"$ver", + "category":"ESP8266", + "url":"http://arduino.esp8266.com/$outdir.zip", + "archiveFileName":"$outdir.zip", + "checksum":"SHA-256:$sha", + "size":"$size", + "help":{ + "online":"http://esp8266.com" + }, + "boards":[ { + "name":"Generic ESP8266 Module" + } + ], + "toolsDependencies":[ { + "packager":"esp8266", + "name":"esptool", + "version":"0.4.3" + }, + { + "packager":"esp8266", + "name":"xtensa-lx106-elf-gcc", + "version":"1.20.0-26-gb404fb9" + } ] + } ], + + "tools": [ { + "name":"esptool", + "version":"0.4.3", + "systems": [ + { + "host":"i686-mingw32", + "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-win32.zip", + "archiveFileName":"esptool-0.4.4-win32.zip", + "checksum":"SHA-256:bc52165c847b194d8f079add982eae1c4b4466784bff8c8494241de602a003b3", + "size":"17262" + }, + { + "host":"x86_64-apple-darwin", + "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-osx.tar.gz", + "archiveFileName":"esptool-0.4.4-osx.tar.gz", + "checksum":"SHA-256:bb2a58c3583f9dcb0d3e7611531a0f3a29c21a4a1c442987bb29d07408824dfe", + "size":"12145" + }, + { + "host":"x86_64-pc-linux-gnu", + "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-linux64.tar.gz", + "archiveFileName":"esptool-0.4.4-linux64.tar.gz", + "checksum":"SHA-256:beedf89db0bdce0bf6034232d86edebcfed0966ff1501545aca9cfbba1f92593", + "size":"12513" + } + ] + }, + { + "name":"xtensa-lx106-elf-gcc", + "version":"1.20.0-26-gb404fb9", + "systems": [ + { + "host":"i686-mingw32", + "url":"http://arduino.esp8266.com/win32-xtensa-lx106-elf.tar.gz", + "archiveFileName":"win32-xtensa-lx106-elf.tar.gz", + "checksum":"SHA-256:5e3de7c20007bf13587907ccf026b0e9bc736a99a022ed020c70b834d01ba512", + "size":"128052524" + }, + { + "host":"x86_64-apple-darwin", + "url":"http://arduino.esp8266.com/osx-xtensa-lx106-elf.tar.gz", + "archiveFileName":"osx-xtensa-lx106-elf.tar.gz", + "checksum":"SHA-256:540be2ca32637584463a4a4d04717f6c79c7355e336b8c3578b0947218cf92b9", + "size":"35189446" + }, + { + "host":"x86_64-pc-linux-gnu", + "url":"http://arduino.esp8266.com/linux64-xtensa-lx106-elf.tar.gz", + "archiveFileName":"linux64-xtensa-lx106-elf.tar.gz", + "checksum":"SHA-256:46f057fbd8b320889a26167daf325038912096d09940b2a95489db92431473b7", + "size":"30262903" + } + ] + } ] + } ] +} +EOF + +scp package_esp8266com_index.json dl:apps/download_files/download + From 07ecca192552a0864b863af5c33289f0e6adbd49 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 May 2015 22:52:14 +0300 Subject: [PATCH 07/16] Fix issue with min/max fix #263 --- hardware/esp8266com/esp8266/cores/esp8266/Arduino.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h b/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h index dbc003b1d..767ea4f28 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h +++ b/hardware/esp8266com/esp8266/cores/esp8266/Arduino.h @@ -112,8 +112,6 @@ void timer1_write(uint32_t ticks); //maximum ticks 8388607 #undef abs #endif -#define min(a,b) ((a)<(b)?(a):(b)) -#define max(a,b) ((a)>(b)?(a):(b)) #define abs(x) ((x)>0?(x):-(x)) #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) @@ -215,6 +213,9 @@ void loop(void); #include "Esp.h" #include "debug.h" +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) + uint16_t makeWord(uint16_t w); uint16_t makeWord(byte h, byte l); From e32345dc0cc8a1e1cbe7d972e3560f9f4b198a56 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 May 2015 23:16:31 +0300 Subject: [PATCH 08/16] Update windows toolchain --- build/build_board_manager_package.sh | 4 ++-- build/windows/dist/win32-xtensa-lx106-elf.tgz.sha | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/build_board_manager_package.sh b/build/build_board_manager_package.sh index 592dc2994..8bbb2602f 100755 --- a/build/build_board_manager_package.sh +++ b/build/build_board_manager_package.sh @@ -94,8 +94,8 @@ cat << EOF > package_esp8266com_index.json "host":"i686-mingw32", "url":"http://arduino.esp8266.com/win32-xtensa-lx106-elf.tar.gz", "archiveFileName":"win32-xtensa-lx106-elf.tar.gz", - "checksum":"SHA-256:5e3de7c20007bf13587907ccf026b0e9bc736a99a022ed020c70b834d01ba512", - "size":"128052524" + "checksum":"SHA-256:1561ec85cc58cab35cc48bfdb0d0087809f89c043112a2c36b54251a13bf781f", + "size":"153807368" }, { "host":"x86_64-apple-darwin", diff --git a/build/windows/dist/win32-xtensa-lx106-elf.tgz.sha b/build/windows/dist/win32-xtensa-lx106-elf.tgz.sha index 442763385..8aaf25716 100644 --- a/build/windows/dist/win32-xtensa-lx106-elf.tgz.sha +++ b/build/windows/dist/win32-xtensa-lx106-elf.tgz.sha @@ -1 +1 @@ -7ec8f2ffdf65dc51262fccfa7a68d9ae885c06c2 +07b7d398cc0ca9e863073a6558668fa0a510b8cd From ec3e6d5deb5ee589deed051d1274dddb3ef1ce82 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 May 2015 23:44:10 +0300 Subject: [PATCH 09/16] use versioned names for toolchain and fix build mkdir tools folder on windows and linux --- build/build.xml | 16 ++++++++++------ build/build_board_manager_package.sh | 16 ++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/build/build.xml b/build/build.xml index 95c401670..20bac52d4 100644 --- a/build/build.xml +++ b/build/build.xml @@ -390,8 +390,8 @@ - - + + @@ -663,9 +663,11 @@ + + - - + + @@ -914,10 +916,12 @@ + + - - + + diff --git a/build/build_board_manager_package.sh b/build/build_board_manager_package.sh index 8bbb2602f..d006cba0f 100755 --- a/build/build_board_manager_package.sh +++ b/build/build_board_manager_package.sh @@ -50,7 +50,7 @@ cat << EOF > package_esp8266com_index.json "toolsDependencies":[ { "packager":"esp8266", "name":"esptool", - "version":"0.4.3" + "version":"0.4.4" }, { "packager":"esp8266", @@ -61,7 +61,7 @@ cat << EOF > package_esp8266com_index.json "tools": [ { "name":"esptool", - "version":"0.4.3", + "version":"0.4.4", "systems": [ { "host":"i686-mingw32", @@ -92,22 +92,22 @@ cat << EOF > package_esp8266com_index.json "systems": [ { "host":"i686-mingw32", - "url":"http://arduino.esp8266.com/win32-xtensa-lx106-elf.tar.gz", - "archiveFileName":"win32-xtensa-lx106-elf.tar.gz", + "url":"http://arduino.esp8266.com/win32-xtensa-lx106-elf-gb404fb9.tar.gz", + "archiveFileName":"win32-xtensa-lx106-elf-gb404fb9.tar.gz", "checksum":"SHA-256:1561ec85cc58cab35cc48bfdb0d0087809f89c043112a2c36b54251a13bf781f", "size":"153807368" }, { "host":"x86_64-apple-darwin", - "url":"http://arduino.esp8266.com/osx-xtensa-lx106-elf.tar.gz", - "archiveFileName":"osx-xtensa-lx106-elf.tar.gz", + "url":"http://arduino.esp8266.com/osx-xtensa-lx106-elf-gb404fb9.tar.gz", + "archiveFileName":"osx-xtensa-lx106-elf-gb404fb9.tar.gz", "checksum":"SHA-256:540be2ca32637584463a4a4d04717f6c79c7355e336b8c3578b0947218cf92b9", "size":"35189446" }, { "host":"x86_64-pc-linux-gnu", - "url":"http://arduino.esp8266.com/linux64-xtensa-lx106-elf.tar.gz", - "archiveFileName":"linux64-xtensa-lx106-elf.tar.gz", + "url":"http://arduino.esp8266.com/linux64-xtensa-lx106-elf-gb404fb9.tar.gz", + "archiveFileName":"linux64-xtensa-lx106-elf-gb404fb9.tar.gz", "checksum":"SHA-256:46f057fbd8b320889a26167daf325038912096d09940b2a95489db92431473b7", "size":"30262903" } From 0efc787b54643ca03cfa8782263c9f41927732a6 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 19 May 2015 00:06:07 +0300 Subject: [PATCH 10/16] Rename hashes to match toolchain archives --- ...x106-elf.tgz.sha => linux64-xtensa-lx106-elf-gb404fb9.tgz.sha} | 0 ...sa-lx106-elf.tgz.sha => osx-xtensa-lx106-elf-gb404fb9.tgz.sha} | 0 ...-lx106-elf.tgz.sha => win32-xtensa-lx106-elf-gb404fb9.tgz.sha} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename build/linux/dist/{linux64-xtensa-lx106-elf.tgz.sha => linux64-xtensa-lx106-elf-gb404fb9.tgz.sha} (100%) rename build/macosx/dist/{osx-xtensa-lx106-elf.tgz.sha => osx-xtensa-lx106-elf-gb404fb9.tgz.sha} (100%) rename build/windows/dist/{win32-xtensa-lx106-elf.tgz.sha => win32-xtensa-lx106-elf-gb404fb9.tgz.sha} (100%) diff --git a/build/linux/dist/linux64-xtensa-lx106-elf.tgz.sha b/build/linux/dist/linux64-xtensa-lx106-elf-gb404fb9.tgz.sha similarity index 100% rename from build/linux/dist/linux64-xtensa-lx106-elf.tgz.sha rename to build/linux/dist/linux64-xtensa-lx106-elf-gb404fb9.tgz.sha diff --git a/build/macosx/dist/osx-xtensa-lx106-elf.tgz.sha b/build/macosx/dist/osx-xtensa-lx106-elf-gb404fb9.tgz.sha similarity index 100% rename from build/macosx/dist/osx-xtensa-lx106-elf.tgz.sha rename to build/macosx/dist/osx-xtensa-lx106-elf-gb404fb9.tgz.sha diff --git a/build/windows/dist/win32-xtensa-lx106-elf.tgz.sha b/build/windows/dist/win32-xtensa-lx106-elf-gb404fb9.tgz.sha similarity index 100% rename from build/windows/dist/win32-xtensa-lx106-elf.tgz.sha rename to build/windows/dist/win32-xtensa-lx106-elf-gb404fb9.tgz.sha From 56ed566e51e9dc41b6dfc3df3525487b49896e6c Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 19 May 2015 00:35:00 +0300 Subject: [PATCH 11/16] Update README.md [ci skip] --- README.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bf6cba3b3..e45a9461f 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,20 @@ Arduino-compatible IDE with ESP8266 support =========================================== +![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg) + This project brings support for ESP8266 chip to the Arduino environment. ESP8266WiFi library bundled with this project has the same interface as the WiFi Shield library, making it easy to re-use existing code and libraries. -### Downloads ### +### Installing with Boards Manager ### -| OS | Build status | Latest release | Alpha Version | -| --- | ------------ | -------------- | --------------- | -| Linux | [![Linux build status](http://img.shields.io/travis/igrr/Arduino.svg)](https://travis-ci.org/igrr/Arduino) | [arduino-1.6.1-linux64.tar.xz](../../releases/download/1.6.1-esp8266-1/arduino-1.6.1-linux64.tar.xz) | | -| Windows | [![Windows build status](http://img.shields.io/appveyor/ci/igrr/Arduino.svg)](https://ci.appveyor.com/project/igrr/Arduino) | [arduino-1.6.1-p1-windows.zip](https://github.com/igrr/Arduino/releases/download/1.6.1-esp8266-1/arduino-1.6.1-p1-windows.zip) | [appveyor 64Bit Build](https://ci.appveyor.com/project/igrr/Arduino/build/artifacts) | -| OS X | | [arduino-1.6.1-macosx-java-latest-signed.zip](../../releases/download/1.6.1-esp8266-1/arduino-1.6.1-macosx-java-latest-signed.zip) | | +Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux x64. +- Install Arduino 1.6.4 from the [Arduino website](http://www.arduino.cc/en/main/software). +- Start Arduino and open Perferences window. +- Enter ```http://arduino.esp8266.com/package_esp8266com_index.json``` into *Additional Board Manager URLs* field. You can add multiple URLs, separating them with commas. +- Open Boards Manager from Tools > Board menu and install *esp8266* platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation). -### Building from source ### +### Building latest version from source ### ``` $ git clone https://github.com/esp8266/Arduino.git $ cd Arduino/build @@ -20,8 +22,9 @@ $ ant dist ``` ### Supported boards ### -- [Wifio](http://wifio.cc) - Generic esp8266 modules (without auto-reset support) +- NodeMCU +- Olimex MOD-WIFI-ESP8266 ### Things that work ### From 39469f62491299b54bcac00cc26df99b11675679 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 19 May 2015 01:31:10 +0300 Subject: [PATCH 12/16] temporary fix of min/max --- .../esp8266/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.h b/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.h index a3926a406..9a412ebb1 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.h +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.h @@ -28,6 +28,8 @@ #define WIFICLIENTMULTI_H_ #include "ESP8266WiFi.h" +#undef min +#undef max #include //#define DEBUG_WIFI_MULTI(...) os_printf( __VA_ARGS__ ) From 545ffdeb87c44bb54fb4678eabb932edd73ca72e Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 19 May 2015 09:23:47 +0300 Subject: [PATCH 13/16] Fix case in WiFiMulti example --- .../ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino b/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino index 5a1057893..70803254d 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WiFi/examples/WiFiMulti/WiFiMulti.ino @@ -6,15 +6,15 @@ #include #include -ESP8266WiFiMulti WiFiMulti = ESP8266WiFiMulti(); +ESP8266WiFiMulti wifiMulti; void setup() { Serial.begin(115200); delay(10); - WiFiMulti.addAP("ssid_from_AP_1", "your_password_for_AP_1"); - WiFiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2"); - WiFiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3"); + wifiMulti.addAP("ssid_from_AP_1", "your_password_for_AP_1"); + wifiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2"); + wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3"); Serial.println("Connecting Wifi..."); if(wifiMulti.run() == WL_CONNECTED) { From 9764c9614b93e713ccb57de9e392594c173ff34f Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 19 May 2015 09:25:40 +0300 Subject: [PATCH 14/16] Add 32-bit linux tools --- README.md | 2 +- build/build_board_manager_package.sh | 44 ++++++++++++++++++---------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e45a9461f..99c9de21b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This project brings support for ESP8266 chip to the Arduino environment. ESP8266 ### Installing with Boards Manager ### -Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux x64. +Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit). - Install Arduino 1.6.4 from the [Arduino website](http://www.arduino.cc/en/main/software). - Start Arduino and open Perferences window. diff --git a/build/build_board_manager_package.sh b/build/build_board_manager_package.sh index d006cba0f..3d6ba517f 100755 --- a/build/build_board_manager_package.sh +++ b/build/build_board_manager_package.sh @@ -64,25 +64,32 @@ cat << EOF > package_esp8266com_index.json "version":"0.4.4", "systems": [ { - "host":"i686-mingw32", - "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-win32.zip", - "archiveFileName":"esptool-0.4.4-win32.zip", - "checksum":"SHA-256:bc52165c847b194d8f079add982eae1c4b4466784bff8c8494241de602a003b3", - "size":"17262" + "host":"i686-mingw32", + "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-win32.zip", + "archiveFileName":"esptool-0.4.4-win32.zip", + "checksum":"SHA-256:bc52165c847b194d8f079add982eae1c4b4466784bff8c8494241de602a003b3", + "size":"17262" }, { - "host":"x86_64-apple-darwin", - "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-osx.tar.gz", - "archiveFileName":"esptool-0.4.4-osx.tar.gz", - "checksum":"SHA-256:bb2a58c3583f9dcb0d3e7611531a0f3a29c21a4a1c442987bb29d07408824dfe", - "size":"12145" + "host":"x86_64-apple-darwin", + "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-osx.tar.gz", + "archiveFileName":"esptool-0.4.4-osx.tar.gz", + "checksum":"SHA-256:bb2a58c3583f9dcb0d3e7611531a0f3a29c21a4a1c442987bb29d07408824dfe", + "size":"12145" }, { - "host":"x86_64-pc-linux-gnu", - "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-linux64.tar.gz", - "archiveFileName":"esptool-0.4.4-linux64.tar.gz", - "checksum":"SHA-256:beedf89db0bdce0bf6034232d86edebcfed0966ff1501545aca9cfbba1f92593", - "size":"12513" + "host":"x86_64-pc-linux-gnu", + "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-linux64.tar.gz", + "archiveFileName":"esptool-0.4.4-linux64.tar.gz", + "checksum":"SHA-256:beedf89db0bdce0bf6034232d86edebcfed0966ff1501545aca9cfbba1f92593", + "size":"12513" + }, + { + "host":"i686-pc-linux-gnu", + "url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-linux32.tar.gz", + "archiveFileName":"esptool-0.4.4-linux32.tar.gz", + "checksum":"SHA-256:4aa81b97a470641771cf371e5d470ac92d3b177adbe8263c4aae66e607b67755", + "size":"12044" } ] }, @@ -110,6 +117,13 @@ cat << EOF > package_esp8266com_index.json "archiveFileName":"linux64-xtensa-lx106-elf-gb404fb9.tar.gz", "checksum":"SHA-256:46f057fbd8b320889a26167daf325038912096d09940b2a95489db92431473b7", "size":"30262903" + }, + { + "host":"i686-pc-linux-gnu", + "url":"http://arduino.esp8266.com/linux32-xtensa-lx106-elf.tar.gz", + "archiveFileName":"linux32-xtensa-lx106-elf.tar.gz", + "checksum":"SHA-256:b24817819f0078fb05895a640e806e0aca9aa96b47b80d2390ac8e2d9ddc955a", + "size":"32734156" } ] } ] From 88e3e409af8184e735093f10479414b0e3f732ee Mon Sep 17 00:00:00 2001 From: ficeto Date: Tue, 19 May 2015 14:06:34 +0300 Subject: [PATCH 15/16] Make the web server not waste heap added some helper methods as well --- .../ESP8266WebServer/src/ESP8266WebServer.cpp | 20 ++++++++++++++++++- .../ESP8266WebServer/src/ESP8266WebServer.h | 11 +++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp index 391cc556c..054929971 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp @@ -101,7 +101,8 @@ void ESP8266WebServer::handleClient() #endif // Wait for data from client to become available - while(client.connected() && !client.available()){ + uint16_t maxWait = HTTP_MAX_DATA_WAIT; + while(client.connected() && !client.available() && maxWait--){ delay(1); } @@ -136,7 +137,12 @@ void ESP8266WebServer::send(int code, const char* content_type, String content) if (!content_type) content_type = "text/html"; + + String len(content.length()); sendHeader("Content-Type", content_type, true); + sendHeader("Content-Length", len.c_str()); + sendHeader("Connection", "close"); + sendHeader("Access-Control-Allow-Origin", "*"); response += _responseHeaders; response += "\r\n"; @@ -145,6 +151,14 @@ void ESP8266WebServer::send(int code, const char* content_type, String content) sendContent(response); } +void ESP8266WebServer::send(int code, char* content_type, String content) { + send(code, (const char*)content_type, content); +} + +void ESP8266WebServer::send(int code, String content_type, String content) { + send(code, (const char*)content_type.c_str(), content); +} + void ESP8266WebServer::sendContent(String content) { size_t size_to_send = content.length(); size_t size_sent = 0; @@ -158,6 +172,10 @@ void ESP8266WebServer::sendContent(String content) { break; } } + uint16_t maxWait = HTTP_MAX_CLOSE_WAIT; + while(_currentClient.connected() && maxWait--) { + delay(1); + } } String ESP8266WebServer::arg(const char* name) { diff --git a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h index d957e15ba..9f2b16480 100644 --- a/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h +++ b/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/ESP8266WebServer.h @@ -31,6 +31,8 @@ enum HTTPUploadStatus { UPLOAD_FILE_START, UPLOAD_FILE_WRITE, UPLOAD_FILE_END }; #define HTTP_DOWNLOAD_UNIT_SIZE 1460 #define HTTP_UPLOAD_BUFLEN 2048 +#define HTTP_MAX_DATA_WAIT 1000 //ms to wait for the client to send the request +#define HTTP_MAX_CLOSE_WAIT 2000 //ms to wait for the client to close the connection typedef struct { HTTPUploadStatus status; @@ -73,6 +75,8 @@ public: // content_type - HTTP content type, like "text/plain" or "image/png" // content - actual content body void send(int code, const char* content_type = NULL, String content = String("")); + void send(int code, char* content_type, String content); + void send(int code, String content_type, String content); void sendHeader(String name, String value, bool first = false); void sendContent(String content); @@ -87,7 +91,12 @@ template size_t streamFile(T &file, String contentType){ head += "\r\n\r\n"; _currentClient.print(head); head = String(); - return _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE); + size_t res = _currentClient.write(file, HTTP_DOWNLOAD_UNIT_SIZE); + uint16_t maxWait = HTTP_MAX_CLOSE_WAIT; + while(_currentClient.connected() && maxWait--) { + delay(1); + } + return res; } protected: From 09bb75874deb95c22b4c09e63b842fc1f89eebc3 Mon Sep 17 00:00:00 2001 From: ficeto Date: Tue, 19 May 2015 15:30:46 +0300 Subject: [PATCH 16/16] better analogRead --- .../esp8266/core_esp8266_wiring_analog.c | 27 +++---------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_analog.c b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_analog.c index bb5151018..53451b713 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_analog.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_analog.c @@ -21,34 +21,13 @@ #include "wiring_private.h" #include "pins_arduino.h" +extern uint16_t readvdd33(void); + void analogReference(uint8_t mode) {} extern int __analogRead(uint8_t pin) { if(pin == 17){ - //return system_adc_read(); - uint8_t i; - uint16_t data[8]; - - rom_i2c_writeReg_Mask(0x6C,2,0,5,5,1); - - ESP8266_REG(0xD5C) |= (1 << 21); - while ((ESP8266_REG(0xD50) & (7 << 24)) > 0); - ESP8266_REG(0xD50) &= ~(1 << 1); - ESP8266_REG(0xD50) |= (1 << 1); - delayMicroseconds(2); - while ((ESP8266_REG(0xD50) & (7 << 24)) > 0); - - read_sar_dout(data); - rom_i2c_writeReg_Mask(0x6C,2,0,5,5,1); - - while ((ESP8266_REG(0xD50) & (7 << 24)) > 0); - ESP8266_REG(0xD5C) &= ~(1 << 21); - ESP8266_REG(0xD60) |= (1 << 0); - ESP8266_REG(0xD60) &= ~(1 << 0); - - uint16_t tout = 0; - for (i = 0; i < 8; i++) tout += data[i]; - return tout >> 4;//tout is 10 bits fraction + return readvdd33() >> 2; // readvdd33 is 12 bit } return digitalRead(pin) * 1023; }