From 38c84039a68f482883a99c211ac3b9f0e5280a29 Mon Sep 17 00:00:00 2001 From: MaBecker Date: Tue, 16 Oct 2018 21:10:46 +0200 Subject: [PATCH] ESP8266: switch to SDK 2.2.1 (fix #1207) --- ChangeLog | 3 +- scripts/provision.sh | 8 ++-- targets/esp8266/eagle.app.v6.new.1024.app1.ld | 32 +++++++++++++--- targets/esp8266/eagle.app.v6.new.1024.app2.ld | 37 +++++++++++++++---- targets/esp8266/eagle.app.v6.new.2048.ld | 35 ++++++++++++++---- targets/esp8266/espmissingincludes.h | 37 ------------------- 6 files changed, 88 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fdaf4a84..4ac749e7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -107,10 +107,11 @@ Ensure that setBusyIndicator updates output state after the very first initialisation. MDBT42Q: Add LED2 var in the Espruino interpreter, but don't use it for the bootloader ESP8266: release heap used by logDebug(true) (fix #1508) - ESP8266: remove SHA256 SHA512 (fix #1517) + ESP8266: remove SHA256 SHA512 (fix #1517) Ensure `Date.getTimezoneOffset()` returns the correct timezone offset (fix #1515) Search for and execute files '.boot0'/1/2/3 in Storage at boot time if they exist Pixl.js: reduce saved code area to 9 x 4kb to allow for extra features + ESP8266: switch to SDK 2.2.1 (fix #1207) 1v99 : Increase jslMatch error buffer size to handle "UNFINISHED TEMPLATE LITERAL" string (#1426) nRF5x: Make FlashWrite cope with flash writes > 4k diff --git a/scripts/provision.sh b/scripts/provision.sh index d0f3f85d6..1271e17b1 100755 --- a/scripts/provision.sh +++ b/scripts/provision.sh @@ -61,9 +61,9 @@ if [ "$FAMILY" = "ESP32" ]; then return 0 elif [ "$FAMILY" = "ESP8266" ]; then echo ESP8266 - if [ ! -d "esp_iot_sdk_v2.0.0.p1" ]; then - echo esp_iot_sdk_v2.0.0.p1 - curl -Ls http://s3.voneicken.com/esp_iot_sdk_v2.0.0.p1.tgx | tar Jxf - --no-same-owner + if [ ! -d "ESP8266_NONOS_SDK-2.2.1" ]; then + echo ESP8266_NONOS_SDK-2.2.1 + curl -Ls https://github.com/espruino/EspruinoBuildTools/raw/master/esp8266/ESP8266_NONOS_SDK-2.2.1.tgz| tar Jxf - --no-same-owner fi if ! type xtensa-lx106-elf-gcc 2> /dev/null > /dev/null; then echo installing xtensa-lx106-elf-gcc @@ -75,7 +75,7 @@ elif [ "$FAMILY" = "ESP8266" ]; then fi which xtensa-lx106-elf-gcc - export ESP8266_SDK_ROOT=`pwd`/esp_iot_sdk_v2.0.0.p1 + export ESP8266_SDK_ROOT=`pwd`/ESP8266_NONOS_SDK-2.2.1 export PATH=$PATH:`pwd`/xtensa-lx106-elf/bin/ return 0 elif [ "$FAMILY" = "LINUX" ]; then diff --git a/targets/esp8266/eagle.app.v6.new.1024.app1.ld b/targets/esp8266/eagle.app.v6.new.1024.app1.ld index e877da8c4..bd481789b 100644 --- a/targets/esp8266/eagle.app.v6.new.1024.app1.ld +++ b/targets/esp8266/eagle.app.v6.new.1024.app1.ld @@ -151,6 +151,31 @@ SECTIONS } >dram0_0_seg :dram0_0_bss_phdr /* __stack = 0x3ffc8000; */ + .irom0.text : ALIGN(4) + { + _irom0_text_start = ABSOLUTE(.); + + *libat.a:(.literal.* .text.*) + *libcrypto.a:(.literal.* .text.*) + *libespnow.a:(.literal.* .text.*) + *libjson.a:(.literal.* .text.*) + *liblwip.a:(.literal.* .text.*) + *libnet80211.a:(.literal.* .text.*) + *libsmartconfig.a:(.literal.* .text.*) + *libssl.a:(.literal.* .text.*) + *libupgrade.a:(.literal.* .text.*) + *libwpa.a:(.literal.* .text.*) + *libwpa2.a:(.literal.* .text.*) + *libwps.a:(.literal.* .text.*) + + *libmbedtls.a:(.literal.* .text.*) + + *libm.a:(.literal .text .literal.* .text.*) + + *(.irom0.literal .irom.literal .irom.literal2 .irom.text.literal .irom0.text .irom.text) + _irom0_text_end = ABSOLUTE(.); + } >irom0_0_seg :irom0_0_phdr + .text : ALIGN(4) { _stext = .; @@ -199,12 +224,7 @@ SECTIONS _lit4_end = ABSOLUTE(.); } >iram1_0_seg :iram1_0_phdr - .irom0.text : ALIGN(4) - { - _irom0_text_start = ABSOLUTE(.); - *(.irom0.literal .irom.literal .irom.literal2 .irom.text.literal .irom0.text .irom.text) - _irom0_text_end = ABSOLUTE(.); - } >irom0_0_seg :irom0_0_phdr + } /* get ROM code address */ diff --git a/targets/esp8266/eagle.app.v6.new.1024.app2.ld b/targets/esp8266/eagle.app.v6.new.1024.app2.ld index d72b5c698..46ea40f94 100644 --- a/targets/esp8266/eagle.app.v6.new.1024.app2.ld +++ b/targets/esp8266/eagle.app.v6.new.1024.app2.ld @@ -5,7 +5,7 @@ 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 = 0x40281010, len = 0x7C000 + irom0_0_seg : org = 0x40201010, len = 0x7C000 } PHDRS @@ -119,7 +119,7 @@ SECTIONS *(.xt_except_desc_end) *(.dynamic) *(.gnu.version_d) - . = ALIGN(4); /* this table MUST be 4-byte aligned */ + . = ALIGN(4); /* this table MUST be 4-byte aligned */ _bss_table_start = ABSOLUTE(.); LONG(_bss_start) LONG(_bss_end) @@ -151,6 +151,31 @@ SECTIONS } >dram0_0_seg :dram0_0_bss_phdr /* __stack = 0x3ffc8000; */ + .irom0.text : ALIGN(4) + { + _irom0_text_start = ABSOLUTE(.); + + *libat.a:(.literal.* .text.*) + *libcrypto.a:(.literal.* .text.*) + *libespnow.a:(.literal.* .text.*) + *libjson.a:(.literal.* .text.*) + *liblwip.a:(.literal.* .text.*) + *libnet80211.a:(.literal.* .text.*) + *libsmartconfig.a:(.literal.* .text.*) + *libssl.a:(.literal.* .text.*) + *libupgrade.a:(.literal.* .text.*) + *libwpa.a:(.literal.* .text.*) + *libwpa2.a:(.literal.* .text.*) + *libwps.a:(.literal.* .text.*) + + *libmbedtls.a:(.literal.* .text.*) + + *libm.a:(.literal .text .literal.* .text.*) + + *(.irom0.literal .irom.literal .irom.literal2 .irom.text.literal .irom0.text .irom.text) + _irom0_text_end = ABSOLUTE(.); + } >irom0_0_seg :irom0_0_phdr + .text : ALIGN(4) { _stext = .; @@ -199,12 +224,8 @@ SECTIONS _lit4_end = ABSOLUTE(.); } >iram1_0_seg :iram1_0_phdr - .irom0.text : ALIGN(4) - { - _irom0_text_start = ABSOLUTE(.); - *(.irom0.literal .irom.literal .irom.literal2 .irom.text.literal .irom0.text .irom.text) - _irom0_text_end = ABSOLUTE(.); - } >irom0_0_seg :irom0_0_phdr + + } /* get ROM code address */ diff --git a/targets/esp8266/eagle.app.v6.new.2048.ld b/targets/esp8266/eagle.app.v6.new.2048.ld index 13455bbf0..449d3e496 100644 --- a/targets/esp8266/eagle.app.v6.new.2048.ld +++ b/targets/esp8266/eagle.app.v6.new.2048.ld @@ -119,7 +119,7 @@ SECTIONS *(.xt_except_desc_end) *(.dynamic) *(.gnu.version_d) - . = ALIGN(4); /* this table MUST be 4-byte aligned */ + . = ALIGN(4); /* this table MUST be 4-byte aligned */ _bss_table_start = ABSOLUTE(.); LONG(_bss_start) LONG(_bss_end) @@ -151,6 +151,31 @@ SECTIONS } >dram0_0_seg :dram0_0_bss_phdr /* __stack = 0x3ffc8000; */ + .irom0.text : ALIGN(4) + { + _irom0_text_start = ABSOLUTE(.); + + *libat.a:(.literal.* .text.*) + *libcrypto.a:(.literal.* .text.*) + *libespnow.a:(.literal.* .text.*) + *libjson.a:(.literal.* .text.*) + *liblwip.a:(.literal.* .text.*) + *libnet80211.a:(.literal.* .text.*) + *libsmartconfig.a:(.literal.* .text.*) + *libssl.a:(.literal.* .text.*) + *libupgrade.a:(.literal.* .text.*) + *libwpa.a:(.literal.* .text.*) + *libwpa2.a:(.literal.* .text.*) + *libwps.a:(.literal.* .text.*) + + *libmbedtls.a:(.literal.* .text.*) + + *libm.a:(.literal .text .literal.* .text.*) + + *(.irom0.literal .irom.literal .irom.literal2 .irom.text.literal .irom0.text .irom.text) + _irom0_text_end = ABSOLUTE(.); + } >irom0_0_seg :irom0_0_phdr + .text : ALIGN(4) { _stext = .; @@ -199,14 +224,8 @@ SECTIONS _lit4_end = ABSOLUTE(.); } >iram1_0_seg :iram1_0_phdr - .irom0.text : ALIGN(4) - { - _irom0_text_start = ABSOLUTE(.); - *(.irom0.literal .irom.literal .irom.literal2 .irom.text.literal .irom0.text .irom.text) - _irom0_text_end = ABSOLUTE(.); - } >irom0_0_seg :irom0_0_phdr - } /* get ROM code address */ INCLUDE "../ld/eagle.rom.addr.v6.ld" + diff --git a/targets/esp8266/espmissingincludes.h b/targets/esp8266/espmissingincludes.h index 852690536..d76fa2df1 100644 --- a/targets/esp8266/espmissingincludes.h +++ b/targets/esp8266/espmissingincludes.h @@ -32,8 +32,6 @@ char *wifi_station_get_hostname(void); int atoi(const char *nptr); -void ets_install_putc1(void *routine); // necessary for #define os_xxx -> ets_xxx -void ets_isr_attach(int intr, void *handler, void *arg); void ets_isr_mask(unsigned intr); void ets_isr_unmask(unsigned intr); void ets_intr_lock(void); @@ -48,12 +46,9 @@ int ets_sprintf(char *str, const char *format, ...) __attribute__ ((format (pri int ets_str2macaddr(void *, void *); int ets_strcmp(const char *s1, const char *s2); char *ets_strcpy(char *dest, const char *src); -size_t ets_strlen(const char *s); -int ets_strncmp(const char *s1, const char *s2, int len); char *ets_strncpy(char *dest, const char *src, size_t n); char *ets_strstr(const char *haystack, const char *needle); -void ets_timer_arm_new(ETSTimer *a, int b, int c, int isMstimer); void ets_timer_disarm(ETSTimer *a); void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *fn, void *parg); @@ -62,36 +57,12 @@ void ets_update_cpu_frequency(int freqmhz); int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__((format(printf, 3, 4))); int os_printf_plus(const char *format, ...) __attribute__((format(printf, 1, 2))); -// memory allocation functions are "different" due to memory debugging functionality -// added in SDK 1.4.0 -#ifndef ESPSDK_1_3_0 -void vPortFree(void *ptr, char * file, int line); -void *pvPortMalloc(size_t xWantedSize, char * file, int line); -void *pvPortZalloc(size_t, char * file, int line); void *vPortMalloc(size_t xWantedSize); void pvPortFree(void *ptr); -void *pvPortRealloc(void *pv, size_t size, char * file, int line); -#else -void vPortFree(void *ptr); -void *pvPortMalloc(size_t xWantedSize); -void *pvPortZalloc(size_t); -void *vPortMalloc(size_t xWantedSize); -void pvPortFree(void *ptr); -void *pvPortRealloc(void *pv, size_t size); -#define os_realloc pvPortRealloc -void *pvPortRealloc(void* ptr, size_t size); -#endif -void uart_div_modify(int no, unsigned int freq); uint32 system_get_time(); int rand(void); void ets_bzero(void *s, size_t n); -void ets_delay_us(int ms); - -// disappeared in SDK 1.1.0: -#define os_timer_done ets_timer_done -#define os_timer_handler_isr ets_timer_handler_isr -#define os_timer_init ets_timer_init // This is not missing in SDK 1.1.0 but causes a parens error #undef PIN_FUNC_SELECT @@ -101,12 +72,4 @@ void ets_delay_us(int ms); |( (((FUNC&BIT2)<<2)|(FUNC&0x3))<