diff --git a/cores/esp8266/cont.h b/cores/esp8266/cont.h index 46daad1007..c3a36eba11 100644 --- a/cores/esp8266/cont.h +++ b/cores/esp8266/cont.h @@ -27,6 +27,10 @@ #define CONT_STACKSIZE 4096 #endif +#ifdef __cplusplus +extern "C" { +#endif + typedef struct cont_ { void (*pc_ret)(void); unsigned* sp_ret; @@ -45,6 +49,8 @@ typedef struct cont_ { unsigned* struct_start; } cont_t; +extern cont_t* g_pcont; + // Initialize the cont_t structure before calling cont_run void cont_init(cont_t*); @@ -68,4 +74,8 @@ int cont_get_free_stack(cont_t* cont); // continuation stack bool cont_can_yield(cont_t* cont); +#ifdef __cplusplus +} +#endif + #endif /* CONT_H_ */ diff --git a/cores/esp8266/core_esp8266_app_entry_noextra4k.cpp b/cores/esp8266/core_esp8266_app_entry_noextra4k.cpp new file mode 100644 index 0000000000..f2f9bffa32 --- /dev/null +++ b/cores/esp8266/core_esp8266_app_entry_noextra4k.cpp @@ -0,0 +1,36 @@ +/* + * This is the original app_entry() not providing extra 4K heap, but allowing + * the use of WPS. + * + * see comments in core_esp8266_main.cpp's app_entry() + * + */ + +#include +#include "cont.h" +#include "coredecls.h" + +void disable_extra4k_at_link_time (void) +{ + /* + * does nothing + * allows overriding the core_esp8266_main.cpp's app_entry() + * by this one below, at link time + * + */ +} + +/* the following code is linked only if a call to the above function is made somewhere */ + +extern "C" void call_user_start(); + +/* this is the default NONOS-SDK user's heap location */ +static cont_t g_cont __attribute__ ((aligned (16))); + +extern "C" void ICACHE_RAM_ATTR app_entry_redefinable(void) +{ + g_pcont = &g_cont; + + /* Call the entry point of the SDK code. */ + call_user_start(); +} diff --git a/cores/esp8266/core_esp8266_main.cpp b/cores/esp8266/core_esp8266_main.cpp index ba878b5679..fbccac508f 100644 --- a/cores/esp8266/core_esp8266_main.cpp +++ b/cores/esp8266/core_esp8266_main.cpp @@ -48,7 +48,7 @@ extern void (*__init_array_end)(void); /* Not static, used in Esp.cpp */ struct rst_info resetInfo; -/* Not static, used in core_esp8266_postmortem.c. +/* Not static, used in core_esp8266_postmortem.c and other places. * Placed into noinit section because we assign value to this variable * before .bss is zero-filled, and need to preserve the value. */ @@ -175,10 +175,15 @@ void init_done() { WPS beeing flawed by its poor security, or not beeing used by lots of users, it has been decided that we are still going to use that memory for - user's stack and disable the use of WPS, with an option to revert that - back at the user's discretion. This selection can be done with the - global define NO_EXTRA_4K_HEAP. An option has been added to the board - generator script. + user's stack and disable the use of WPS. + + app_entry() jumps to app_entry_custom() defined as "weakref" calling + itself a weak customizable function, allowing to use another one when + this is required (see core_esp8266_app_entry_noextra4k.cpp, used by WPS). + + (note: setting app_entry() itself as "weak" is not sufficient and always + ends up with the other "noextra4k" one linked, maybe because it has a + default ENTRY(app_entry) value in linker scripts). References: https://github.com/esp8266/Arduino/pull/4553 @@ -188,31 +193,25 @@ void init_done() { */ -#ifdef NO_EXTRA_4K_HEAP -/* this is the default NONOS-SDK user's heap location */ -cont_t g_cont __attribute__ ((aligned (16))); -#endif - -extern "C" void ICACHE_RAM_ATTR app_entry(void) +extern "C" void ICACHE_RAM_ATTR app_entry_redefinable(void) __attribute__((weak)); +extern "C" void ICACHE_RAM_ATTR app_entry_redefinable(void) { -#ifdef NO_EXTRA_4K_HEAP - - /* this is the default NONOS-SDK user's heap location */ - g_pcont = &g_cont; - -#else - /* Allocate continuation context on this SYS stack, and save pointer to it. */ cont_t s_cont __attribute__((aligned(16))); g_pcont = &s_cont; -#endif - /* Call the entry point of the SDK code. */ call_user_start(); } +static void ICACHE_RAM_ATTR app_entry_custom (void) __attribute__((weakref("app_entry_redefinable"))); + +extern "C" void ICACHE_RAM_ATTR app_entry (void) +{ + return app_entry_custom(); +} + extern "C" void user_init(void) { struct rst_info *rtc_info_ptr = system_get_rst_info(); memcpy((void *) &resetInfo, (void *) rtc_info_ptr, sizeof(resetInfo)); diff --git a/cores/esp8266/core_esp8266_postmortem.c b/cores/esp8266/core_esp8266_postmortem.c index e8e04f7756..52fbe59174 100644 --- a/cores/esp8266/core_esp8266_postmortem.c +++ b/cores/esp8266/core_esp8266_postmortem.c @@ -32,8 +32,6 @@ extern void __real_system_restart_local(); -extern cont_t* g_pcont; - // These will be pointers to PROGMEM const strings static const char* s_panic_file = 0; static int s_panic_line = 0; diff --git a/cores/esp8266/coredecls.h b/cores/esp8266/coredecls.h index 9e06419ca4..39cedf557c 100644 --- a/cores/esp8266/coredecls.h +++ b/cores/esp8266/coredecls.h @@ -8,10 +8,15 @@ extern "C" { // TODO: put declarations here, get rid of -Wno-implicit-function-declaration +#include // g_pcont declaration + extern bool timeshift64_is_set; +void esp_yield(); +void esp_schedule(); void tune_timeshift64 (uint64_t now_us); void settimeofday_cb (void (*cb)(void)); +void disable_extra4k_at_link_time (void) __attribute__((noinline)); #ifdef __cplusplus } diff --git a/doc/faq/a05-board-generator.rst b/doc/faq/a05-board-generator.rst index 4aea17df8c..d68b9b1d1f 100644 --- a/doc/faq/a05-board-generator.rst +++ b/doc/faq/a05-board-generator.rst @@ -48,8 +48,6 @@ As of today you can: * increase available flash space by disabling floats in ``*printf`` functions -* enable WPS which is now disabled by default (at the cost of a smaller heap by ~4KB) - * change led pin ``LED_BUILTIN`` for the two generic boards * change the default lwIP version (1.4 or 2) diff --git a/doc/faq/readme.rst b/doc/faq/readme.rst index 2ed3743a50..17d8309ca5 100644 --- a/doc/faq/readme.rst +++ b/doc/faq/readme.rst @@ -46,22 +46,29 @@ How can I get some extra KBs in flash ? * Using ``*printf()`` with floats is enabled by default. Some KBs of flash can be saved by using the option ``--nofloat`` with the boards generator: - ``./tools/boards.txt.py --nofloat --allgen`` + ``./tools/boards.txt.py --nofloat --boardsgen`` * Use the debug level option ``NoAssert-NDEBUG`` (in the Tools menu) `Read more `__. -Why can't I use WPS ? -~~~~~~~~~~~~~~~~~~~~~ +About WPS +~~~~~~~~~ -WPS is disabled by default, this offers an extra 4KB in ram/heap. To enable -WPS (and lose 4KB of useable ram), use this boards generator option: +From release 2.4.2 and ahead, not using WPS will give an exra ~4.5KB in +heap. -``./tools/boards.txt.py --allowWPS --allgen`` +In release 2.4.2 only, WPS is disabled by default and the board generator is +required to enable it: + +``./tools/boards.txt.py --allowWPS --boardsgen`` `Read more `__. +This manual selection is not needed starting from 2.5.0 (and in git +version). WPS is always available, and not using it will give an extra +~4.5KB compared to releases until 2.4.1 included. + This Arduino library doesn't work on ESP. How do I make it work? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/libraries/ArduinoOTA/library.properties b/libraries/ArduinoOTA/library.properties index 1c72335c81..18bf6a52fd 100644 --- a/libraries/ArduinoOTA/library.properties +++ b/libraries/ArduinoOTA/library.properties @@ -7,3 +7,4 @@ paragraph=With this library you can enable your sketch to be upgraded over netwo category=Communication url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/DNSServer/library.properties b/libraries/DNSServer/library.properties index 71f0ae5440..fc9f0f7fa1 100644 --- a/libraries/DNSServer/library.properties +++ b/libraries/DNSServer/library.properties @@ -7,3 +7,4 @@ paragraph=This library implements a simple DNS server. category=Communication url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/EEPROM/library.properties b/libraries/EEPROM/library.properties index 3a638c4a32..de05c4f3de 100644 --- a/libraries/EEPROM/library.properties +++ b/libraries/EEPROM/library.properties @@ -7,3 +7,4 @@ paragraph= category=Data Storage url=http://arduino.cc/en/Reference/EEPROM architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/ESP8266AVRISP/library.properties b/libraries/ESP8266AVRISP/library.properties index 70fa3cf8e5..59f581a546 100644 --- a/libraries/ESP8266AVRISP/library.properties +++ b/libraries/ESP8266AVRISP/library.properties @@ -7,3 +7,4 @@ paragraph=This library allows programming 8-bit AVR ICSP targets via TCP over Wi category=Communication url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/ESP8266HTTPClient/library.properties b/libraries/ESP8266HTTPClient/library.properties index a63eb5717b..af2cf8ddf8 100644 --- a/libraries/ESP8266HTTPClient/library.properties +++ b/libraries/ESP8266HTTPClient/library.properties @@ -7,3 +7,4 @@ paragraph= category=Communication url=https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/ESP8266HTTPUpdateServer/library.properties b/libraries/ESP8266HTTPUpdateServer/library.properties index 5fd9988715..23ced5a862 100644 --- a/libraries/ESP8266HTTPUpdateServer/library.properties +++ b/libraries/ESP8266HTTPUpdateServer/library.properties @@ -7,3 +7,4 @@ paragraph=The library accepts HTTP post requests to the /update url, and updates category=Communication url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/ESP8266NetBIOS/library.properties b/libraries/ESP8266NetBIOS/library.properties index 510f9937c9..b72e43dcf8 100644 --- a/libraries/ESP8266NetBIOS/library.properties +++ b/libraries/ESP8266NetBIOS/library.properties @@ -7,3 +7,4 @@ paragraph=With this library you can connect to your ESP from Windows using a sho category=Communication url=http://www.xpablo.cz/?p=751#more-751 architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/ESP8266WebServer/library.properties b/libraries/ESP8266WebServer/library.properties index 4dd12d3ba6..73e33ab14f 100644 --- a/libraries/ESP8266WebServer/library.properties +++ b/libraries/ESP8266WebServer/library.properties @@ -7,3 +7,4 @@ paragraph=The library supports HTTP GET and POST requests, provides argument par category=Communication url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/ESP8266WiFi/library.properties b/libraries/ESP8266WiFi/library.properties index 3db731e8ed..35aae4ccf8 100644 --- a/libraries/ESP8266WiFi/library.properties +++ b/libraries/ESP8266WiFi/library.properties @@ -7,3 +7,4 @@ paragraph=With this library you can instantiate Servers, Clients and send/receiv category=Communication url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA-WPS.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA-WPS.cpp new file mode 100644 index 0000000000..c7a92765be --- /dev/null +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA-WPS.cpp @@ -0,0 +1,111 @@ +/* + ESP8266WiFiSTA-WPS.cpp - WiFi library for esp8266 + + Copyright (c) 2014 Ivan Grokhotkov. All rights reserved. + This file is part of the esp8266 core for Arduino environment. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Reworked on 28 Dec 2015 by Markus Sattler + + */ + + +#include "ESP8266WiFi.h" +#include "ESP8266WiFiGeneric.h" +#include "ESP8266WiFiSTA.h" +#include "coredecls.h" // disable_extra4k_at_link_time() + +static void wifi_wps_status_cb(wps_cb_status status); + +/** + * WPS config + * so far only WPS_TYPE_PBC is supported (SDK 1.2.0) + * @return ok + */ +bool ESP8266WiFiSTAClass::beginWPSConfig(void) { + + // SYS ram is used by WPS, let's configure user stack inside user's HEAP + disable_extra4k_at_link_time(); + + if(!WiFi.enableSTA(true)) { + // enable STA failed + return false; + } + + disconnect(); + + DEBUGV("wps begin\n"); + + if(!wifi_wps_disable()) { + DEBUGV("wps disable failed\n"); + return false; + } + + // so far only WPS_TYPE_PBC is supported (SDK 1.2.0) + if(!wifi_wps_enable(WPS_TYPE_PBC)) { + DEBUGV("wps enable failed\n"); + return false; + } + + if(!wifi_set_wps_cb((wps_st_cb_t) &wifi_wps_status_cb)) { + DEBUGV("wps cb failed\n"); + return false; + } + + if(!wifi_wps_start()) { + DEBUGV("wps start failed\n"); + return false; + } + + esp_yield(); + // will return here when wifi_wps_status_cb fires + + return true; +} + +/** + * WPS callback + * @param status wps_cb_status + */ +void wifi_wps_status_cb(wps_cb_status status) { + DEBUGV("wps cb status: %d\r\n", status); + switch(status) { + case WPS_CB_ST_SUCCESS: + if(!wifi_wps_disable()) { + DEBUGV("wps disable failed\n"); + } + wifi_station_connect(); + break; + case WPS_CB_ST_FAILED: + DEBUGV("wps FAILED\n"); + break; + case WPS_CB_ST_TIMEOUT: + DEBUGV("wps TIMEOUT\n"); + break; + case WPS_CB_ST_WEP: + DEBUGV("wps WEP\n"); + break; + case WPS_CB_ST_UNK: + DEBUGV("wps UNKNOWN\n"); + if(!wifi_wps_disable()) { + DEBUGV("wps disable failed\n"); + } + break; + } + // TODO user function to get status + + esp_schedule(); // resume the beginWPSConfig function +} diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp index 730b52886a..5f2c2c3b05 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp @@ -571,90 +571,6 @@ int32_t ESP8266WiFiSTAClass::RSSI(void) { // -------------------------------------------------- STA remote configure ----------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------- -#ifdef NO_EXTRA_4K_HEAP -/* NO_EXTRA_4K_HEAP's description in cores/esp8266/core_esp8266_main.cpp */ - -void wifi_wps_status_cb(wps_cb_status status); - -/** - * WPS config - * so far only WPS_TYPE_PBC is supported (SDK 1.2.0) - * @return ok - */ -bool ESP8266WiFiSTAClass::beginWPSConfig(void) { - - if(!WiFi.enableSTA(true)) { - // enable STA failed - return false; - } - - disconnect(); - - DEBUGV("wps begin\n"); - - if(!wifi_wps_disable()) { - DEBUGV("wps disable failed\n"); - return false; - } - - // so far only WPS_TYPE_PBC is supported (SDK 1.2.0) - if(!wifi_wps_enable(WPS_TYPE_PBC)) { - DEBUGV("wps enable failed\n"); - return false; - } - - if(!wifi_set_wps_cb((wps_st_cb_t) &wifi_wps_status_cb)) { - DEBUGV("wps cb failed\n"); - return false; - } - - if(!wifi_wps_start()) { - DEBUGV("wps start failed\n"); - return false; - } - - esp_yield(); - // will return here when wifi_wps_status_cb fires - - return true; -} - -/** - * WPS callback - * @param status wps_cb_status - */ -void wifi_wps_status_cb(wps_cb_status status) { - DEBUGV("wps cb status: %d\r\n", status); - switch(status) { - case WPS_CB_ST_SUCCESS: - if(!wifi_wps_disable()) { - DEBUGV("wps disable failed\n"); - } - wifi_station_connect(); - break; - case WPS_CB_ST_FAILED: - DEBUGV("wps FAILED\n"); - break; - case WPS_CB_ST_TIMEOUT: - DEBUGV("wps TIMEOUT\n"); - break; - case WPS_CB_ST_WEP: - DEBUGV("wps WEP\n"); - break; - case WPS_CB_ST_UNK: - DEBUGV("wps UNKNOWN\n"); - if(!wifi_wps_disable()) { - DEBUGV("wps disable failed\n"); - } - break; - } - // TODO user function to get status - - esp_schedule(); // resume the beginWPSConfig function -} - -#endif // NO_EXTRA_4K_HEAP - bool ESP8266WiFiSTAClass::_smartConfigStarted = false; bool ESP8266WiFiSTAClass::_smartConfigDone = false; diff --git a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h index f94ba0a4d3..58b76ef5ee 100644 --- a/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h +++ b/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h @@ -85,7 +85,7 @@ class ESP8266WiFiSTAClass { protected: - static bool _useStaticIp; + static bool _useStaticIp; // ---------------------------------------------------------------------------------------------- // ------------------------------------ STA remote configure ----------------------------------- @@ -93,14 +93,7 @@ class ESP8266WiFiSTAClass { public: -#ifdef NO_EXTRA_4K_HEAP bool beginWPSConfig(void); -#else - inline bool beginWPSConfig(void) __attribute__((always_inline)) { - return WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool(); - } -#endif - bool beginSmartConfig(); bool stopSmartConfig(); bool smartConfigDone(); diff --git a/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp b/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp index 890d86c8e3..f946ae6ef1 100644 --- a/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp +++ b/libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp @@ -41,6 +41,7 @@ extern "C" { #include "lwip/netif.h" #include "include/ClientContext.h" #include "c_types.h" +#include "coredecls.h" namespace BearSSL { @@ -1259,14 +1260,12 @@ bool WiFiClientSecure::loadPrivateKey(Stream& stream, size_t size) { // SSL debugging which should focus on the WiFiClientBearSSL objects. extern "C" { -#include - extern cont_t g_cont; extern size_t br_esp8266_stack_proxy_usage(); void _BearSSLCheckStack(const char *fcn, const char *file, int line) { static int cnt = 0; register uint32_t *sp asm("a1"); - int freestack = 4 * (sp - g_cont.stack); + int freestack = 4 * (sp - g_pcont->stack); int freeheap = ESP.getFreeHeap(); static int laststack, lastheap, laststack2; if ((laststack != freestack) || (lastheap != freeheap) || (laststack2 != (int)br_esp8266_stack_proxy_usage())) { diff --git a/libraries/ESP8266WiFiMesh/library.properties b/libraries/ESP8266WiFiMesh/library.properties index 5dc4dec11a..70dff32590 100644 --- a/libraries/ESP8266WiFiMesh/library.properties +++ b/libraries/ESP8266WiFiMesh/library.properties @@ -7,3 +7,4 @@ paragraph=The library sets up a Mesh Node which acts as a router, creating a Mes category=Communication url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/ESP8266httpUpdate/library.properties b/libraries/ESP8266httpUpdate/library.properties index 94a8499b89..f94d2102fe 100644 --- a/libraries/ESP8266httpUpdate/library.properties +++ b/libraries/ESP8266httpUpdate/library.properties @@ -7,3 +7,4 @@ paragraph= category=Data Processing url=https://github.com/Links2004/Arduino/tree/esp8266/hardware/esp8266com/esp8266/libraries/ESP8266httpUpdate architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/Ethernet/library.properties b/libraries/Ethernet/library.properties index 17fcae1003..00320f2acc 100644 --- a/libraries/Ethernet/library.properties +++ b/libraries/Ethernet/library.properties @@ -7,3 +7,4 @@ paragraph=With this library you can use the Arduino Ethernet (shield or board) t category=Communication url=http://www.arduino.cc/en/Reference/Ethernet architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/GDBStub/library.properties b/libraries/GDBStub/library.properties index 0ede834fdd..28a69deef6 100644 --- a/libraries/GDBStub/library.properties +++ b/libraries/GDBStub/library.properties @@ -7,3 +7,4 @@ paragraph=GDB server stub helps debug crashes when JTAG isn't an option. category=Uncategorized url=https://github.com/espressif/esp-gdbstub architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/Hash/library.properties b/libraries/Hash/library.properties index 81c8bba77d..82ce85b1d9 100644 --- a/libraries/Hash/library.properties +++ b/libraries/Hash/library.properties @@ -7,3 +7,4 @@ paragraph= category=Data Processing url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/SD/library.properties b/libraries/SD/library.properties index 40891c831a..42a1602564 100644 --- a/libraries/SD/library.properties +++ b/libraries/SD/library.properties @@ -7,3 +7,4 @@ paragraph=Once an SD memory card is connected to the SPI interfare of the Arduin category=Data Storage url=http://www.arduino.cc/en/Reference/SD architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/SPI/library.properties b/libraries/SPI/library.properties index 46f7d47f33..950045187f 100644 --- a/libraries/SPI/library.properties +++ b/libraries/SPI/library.properties @@ -7,3 +7,4 @@ paragraph= category=Signal Input/Output url=http://arduino.cc/en/Reference/SPI architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/SPISlave/library.properties b/libraries/SPISlave/library.properties index 50d81f3fb8..bca1281dd2 100644 --- a/libraries/SPISlave/library.properties +++ b/libraries/SPISlave/library.properties @@ -7,3 +7,4 @@ paragraph= category=Signal Input/Output url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/Servo/library.properties b/libraries/Servo/library.properties index d19ef5886d..df32b66167 100644 --- a/libraries/Servo/library.properties +++ b/libraries/Servo/library.properties @@ -7,3 +7,4 @@ paragraph=This library can control a great number of servos.
It makes caref category=Device Control url=http://arduino.cc/en/Reference/Servo architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/Ticker/library.properties b/libraries/Ticker/library.properties index 9261ad22dd..a759351e4c 100644 --- a/libraries/Ticker/library.properties +++ b/libraries/Ticker/library.properties @@ -7,3 +7,4 @@ paragraph= category=Timing url= architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/Wire/library.properties b/libraries/Wire/library.properties index 19eb0f43a7..c8f4ae1d85 100644 --- a/libraries/Wire/library.properties +++ b/libraries/Wire/library.properties @@ -7,3 +7,4 @@ paragraph= category=Signal Input/Output url=http://arduino.cc/en/Reference/Wire architectures=esp8266 +dot_a_linkage=true diff --git a/libraries/esp8266/library.properties b/libraries/esp8266/library.properties index 15b1a31486..6e1cc8aded 100644 --- a/libraries/esp8266/library.properties +++ b/libraries/esp8266/library.properties @@ -7,3 +7,4 @@ paragraph= category=Other url= architectures=esp8266 +dot_a_linkage=true diff --git a/platform.txt b/platform.txt index 05a0b1ae12..b0e4b1936e 100644 --- a/platform.txt +++ b/platform.txt @@ -25,7 +25,6 @@ build.vtable_flags=-DVTABLES_IN_FLASH build.float=-u _printf_float -u _scanf_float build.led= -build.noextra4kheap= compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/ compiler.sdk.path={runtime.platform.path}/tools/sdk @@ -33,7 +32,7 @@ compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core" compiler.c.cmd=xtensa-lx106-elf-gcc -compiler.c.flags=-c {compiler.warning_flags} {build.noextra4kheap} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections +compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections compiler.S.cmd=xtensa-lx106-elf-gcc compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls @@ -44,7 +43,7 @@ compiler.c.elf.cmd=xtensa-lx106-elf-gcc compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc compiler.cpp.cmd=xtensa-lx106-elf-g++ -compiler.cpp.flags=-c {compiler.warning_flags} {build.noextra4kheap} -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections +compiler.cpp.flags=-c {compiler.warning_flags} -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections compiler.as.cmd=xtensa-lx106-elf-as @@ -92,10 +91,10 @@ recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" ## Create archives -recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/arduino.ar" "{object_file}" +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" ## Combine gc-sections, archives, and objects -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" -Wl,-Map "-Wl,{build.path}/{build.project_name}.map" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{build.path}/arduino.ar" {compiler.c.elf.libs} -Wl,--end-group "-L{build.path}" +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" -Wl,-Map "-Wl,{build.path}/{build.project_name}.map" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{archive_file_path}" {compiler.c.elf.libs} -Wl,--end-group "-L{build.path}" ## Create eeprom recipe.objcopy.eep.pattern= diff --git a/tests/device/test_stack_in_heap/test_stack_in_heap.ino b/tests/device/test_stack_in_heap/test_stack_in_heap.ino new file mode 100644 index 0000000000..02cb11e9f1 --- /dev/null +++ b/tests/device/test_stack_in_heap/test_stack_in_heap.ino @@ -0,0 +1,24 @@ +#include + +BS_ENV_DECLARE(); + +#include +#include + +void setup() +{ + Serial.begin(115200); + BS_RUN(Serial); +} + +TEST_CASE("stack in user's HEAP ram", "[bs]") +{ + bool sysstack = (((unsigned long)g_pcont) >> 16) == 0x3fff; + CHECK(!sysstack); +} + +void loop () +{ + // WPS I link you ! + WiFi.beginWPSConfig(); +} diff --git a/tests/device/test_stack_in_sys/test_stack_in_sys.ino b/tests/device/test_stack_in_sys/test_stack_in_sys.ino new file mode 100644 index 0000000000..6a1595c5ad --- /dev/null +++ b/tests/device/test_stack_in_sys/test_stack_in_sys.ino @@ -0,0 +1,21 @@ +#include + +BS_ENV_DECLARE(); + +#include + +void setup() +{ + Serial.begin(115200); + BS_RUN(Serial); +} + +TEST_CASE("stack in SYS ram", "[bs]") +{ + bool sysstack = (((unsigned long)g_pcont) >> 16) == 0x3fff; + CHECK(sysstack); +} + +void loop () +{ +} diff --git a/tools/boards.txt.py b/tools/boards.txt.py index bac65d0435..1a3715259f 100755 --- a/tools/boards.txt.py +++ b/tools/boards.txt.py @@ -1275,9 +1275,6 @@ def all_boards (): if nofloat: print(id + '.build.float=') - if noextra4kheap: - print(id + '.build.noextra4kheap=-DNO_EXTRA_4K_HEAP') - print('') if boardsgen: @@ -1372,8 +1369,6 @@ def usage (name,ret): print(" --speed s - change default serial speed") print(" --customspeed s - new serial speed for all boards") print(" --nofloat - disable float support in printf/scanf") - print(" --noextra4kheap - disable extra 4k heap (will enable WPS)") - print(" --allowWPS - synonym for --noextra4kheap") print("") print(" mandatory option (at least one):") print("") @@ -1417,7 +1412,6 @@ def usage (name,ret): led_default = 2 led_max = 16 nofloat = False -noextra4kheap = False ldgen = False ldshow = False boardsgen = False @@ -1478,7 +1472,7 @@ def usage (name,ret): nofloat=True elif o in ("--noextra4kheap", "--allowWPS"): - noextra4kheap=True + print('option ' + o + ' is now deprecated, without effect, and will be removed') elif o in ("--ldshow"): ldshow = True diff --git a/tools/sdk/include/user_interface.h b/tools/sdk/include/user_interface.h index d2a4152ef7..a7733a9548 100644 --- a/tools/sdk/include/user_interface.h +++ b/tools/sdk/include/user_interface.h @@ -577,25 +577,11 @@ enum wps_cb_status { typedef void (*wps_st_cb_t)(int status); -#ifdef NO_EXTRA_4K_HEAP -/* check cores/esp8266/core_esp8266_main.cpp for comments about this */ - bool wifi_wps_enable(WPS_TYPE_t wps_type); bool wifi_wps_disable(void); bool wifi_wps_start(void); bool wifi_set_wps_cb(wps_st_cb_t cb); -#else - -bool WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool (); -#define wifi_wps_enable(...) WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool() -#define wifi_wps_disable() WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool() -#define wifi_wps_start() WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool() -#define wifi_set_wps_cb(...) WPS_is_unavailable_in_this_configuration__Please_check_FAQ_or_board_generator_tool() - -#endif - - typedef void (*freedom_outside_cb_t)(uint8 status); int wifi_register_send_pkt_freedom_cb(freedom_outside_cb_t cb); void wifi_unregister_send_pkt_freedom_cb(void);