mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-22 21:23:07 +03:00
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system (#5018)
Automatic stack location selection (SYS or HEAP), enable per library AR-chive in arduino build system * enable dot_a_linkage on internal libraries * add device tests * boards generator: deprecate --noextra4k/--allowWPS and fix documentation
This commit is contained in:
parent
9f67d83907
commit
85e68093e9
@ -27,6 +27,10 @@
|
|||||||
#define CONT_STACKSIZE 4096
|
#define CONT_STACKSIZE 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct cont_ {
|
typedef struct cont_ {
|
||||||
void (*pc_ret)(void);
|
void (*pc_ret)(void);
|
||||||
unsigned* sp_ret;
|
unsigned* sp_ret;
|
||||||
@ -45,6 +49,8 @@ typedef struct cont_ {
|
|||||||
unsigned* struct_start;
|
unsigned* struct_start;
|
||||||
} cont_t;
|
} cont_t;
|
||||||
|
|
||||||
|
extern cont_t* g_pcont;
|
||||||
|
|
||||||
// Initialize the cont_t structure before calling cont_run
|
// Initialize the cont_t structure before calling cont_run
|
||||||
void cont_init(cont_t*);
|
void cont_init(cont_t*);
|
||||||
|
|
||||||
@ -68,4 +74,8 @@ int cont_get_free_stack(cont_t* cont);
|
|||||||
// continuation stack
|
// continuation stack
|
||||||
bool cont_can_yield(cont_t* cont);
|
bool cont_can_yield(cont_t* cont);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* CONT_H_ */
|
#endif /* CONT_H_ */
|
||||||
|
36
cores/esp8266/core_esp8266_app_entry_noextra4k.cpp
Normal file
36
cores/esp8266/core_esp8266_app_entry_noextra4k.cpp
Normal file
@ -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 <c_types.h>
|
||||||
|
#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();
|
||||||
|
}
|
@ -48,7 +48,7 @@ extern void (*__init_array_end)(void);
|
|||||||
/* Not static, used in Esp.cpp */
|
/* Not static, used in Esp.cpp */
|
||||||
struct rst_info resetInfo;
|
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
|
* Placed into noinit section because we assign value to this variable
|
||||||
* before .bss is zero-filled, and need to preserve the value.
|
* 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
|
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
|
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
|
user's stack and disable the use of WPS.
|
||||||
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
|
app_entry() jumps to app_entry_custom() defined as "weakref" calling
|
||||||
generator script.
|
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:
|
References:
|
||||||
https://github.com/esp8266/Arduino/pull/4553
|
https://github.com/esp8266/Arduino/pull/4553
|
||||||
@ -188,31 +193,25 @@ void init_done() {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef NO_EXTRA_4K_HEAP
|
extern "C" void ICACHE_RAM_ATTR app_entry_redefinable(void) __attribute__((weak));
|
||||||
/* this is the default NONOS-SDK user's heap location */
|
extern "C" void ICACHE_RAM_ATTR app_entry_redefinable(void)
|
||||||
cont_t g_cont __attribute__ ((aligned (16)));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern "C" void ICACHE_RAM_ATTR app_entry(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,
|
/* Allocate continuation context on this SYS stack,
|
||||||
and save pointer to it. */
|
and save pointer to it. */
|
||||||
cont_t s_cont __attribute__((aligned(16)));
|
cont_t s_cont __attribute__((aligned(16)));
|
||||||
g_pcont = &s_cont;
|
g_pcont = &s_cont;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Call the entry point of the SDK code. */
|
/* Call the entry point of the SDK code. */
|
||||||
call_user_start();
|
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) {
|
extern "C" void user_init(void) {
|
||||||
struct rst_info *rtc_info_ptr = system_get_rst_info();
|
struct rst_info *rtc_info_ptr = system_get_rst_info();
|
||||||
memcpy((void *) &resetInfo, (void *) rtc_info_ptr, sizeof(resetInfo));
|
memcpy((void *) &resetInfo, (void *) rtc_info_ptr, sizeof(resetInfo));
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
extern void __real_system_restart_local();
|
extern void __real_system_restart_local();
|
||||||
|
|
||||||
extern cont_t* g_pcont;
|
|
||||||
|
|
||||||
// These will be pointers to PROGMEM const strings
|
// These will be pointers to PROGMEM const strings
|
||||||
static const char* s_panic_file = 0;
|
static const char* s_panic_file = 0;
|
||||||
static int s_panic_line = 0;
|
static int s_panic_line = 0;
|
||||||
|
@ -8,10 +8,15 @@ extern "C" {
|
|||||||
|
|
||||||
// TODO: put declarations here, get rid of -Wno-implicit-function-declaration
|
// TODO: put declarations here, get rid of -Wno-implicit-function-declaration
|
||||||
|
|
||||||
|
#include <cont.h> // g_pcont declaration
|
||||||
|
|
||||||
extern bool timeshift64_is_set;
|
extern bool timeshift64_is_set;
|
||||||
|
|
||||||
|
void esp_yield();
|
||||||
|
void esp_schedule();
|
||||||
void tune_timeshift64 (uint64_t now_us);
|
void tune_timeshift64 (uint64_t now_us);
|
||||||
void settimeofday_cb (void (*cb)(void));
|
void settimeofday_cb (void (*cb)(void));
|
||||||
|
void disable_extra4k_at_link_time (void) __attribute__((noinline));
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,6 @@ As of today you can:
|
|||||||
|
|
||||||
* increase available flash space by disabling floats in ``*printf`` functions
|
* 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 led pin ``LED_BUILTIN`` for the two generic boards
|
||||||
|
|
||||||
* change the default lwIP version (1.4 or 2)
|
* change the default lwIP version (1.4 or 2)
|
||||||
|
@ -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
|
* Using ``*printf()`` with floats is enabled by default. Some KBs of flash can
|
||||||
be saved by using the option ``--nofloat`` with the boards generator:
|
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)
|
* Use the debug level option ``NoAssert-NDEBUG`` (in the Tools menu)
|
||||||
|
|
||||||
`Read more <a05-board-generator.rst>`__.
|
`Read more <a05-board-generator.rst>`__.
|
||||||
|
|
||||||
Why can't I use WPS ?
|
About WPS
|
||||||
~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
WPS is disabled by default, this offers an extra 4KB in ram/heap. To enable
|
From release 2.4.2 and ahead, not using WPS will give an exra ~4.5KB in
|
||||||
WPS (and lose 4KB of useable ram), use this boards generator option:
|
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 <a05-board-generator.rst>`__.
|
`Read more <a05-board-generator.rst>`__.
|
||||||
|
|
||||||
|
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?
|
This Arduino library doesn't work on ESP. How do I make it work?
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -7,3 +7,4 @@ paragraph=With this library you can enable your sketch to be upgraded over netwo
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=This library implements a simple DNS server.
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Data Storage
|
category=Data Storage
|
||||||
url=http://arduino.cc/en/Reference/EEPROM
|
url=http://arduino.cc/en/Reference/EEPROM
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=This library allows programming 8-bit AVR ICSP targets via TCP over Wi
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient
|
url=https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=The library accepts HTTP post requests to the /update url, and updates
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=With this library you can connect to your ESP from Windows using a sho
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=http://www.xpablo.cz/?p=751#more-751
|
url=http://www.xpablo.cz/?p=751#more-751
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=The library supports HTTP GET and POST requests, provides argument par
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=With this library you can instantiate Servers, Clients and send/receiv
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
111
libraries/ESP8266WiFi/src/ESP8266WiFiSTA-WPS.cpp
Normal file
111
libraries/ESP8266WiFi/src/ESP8266WiFiSTA-WPS.cpp
Normal file
@ -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
|
||||||
|
}
|
@ -571,90 +571,6 @@ int32_t ESP8266WiFiSTAClass::RSSI(void) {
|
|||||||
// -------------------------------------------------- STA remote configure -----------------------------------------------
|
// -------------------------------------------------- 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::_smartConfigStarted = false;
|
||||||
bool ESP8266WiFiSTAClass::_smartConfigDone = false;
|
bool ESP8266WiFiSTAClass::_smartConfigDone = false;
|
||||||
|
|
||||||
|
@ -93,14 +93,7 @@ class ESP8266WiFiSTAClass {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifdef NO_EXTRA_4K_HEAP
|
|
||||||
bool beginWPSConfig(void);
|
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 beginSmartConfig();
|
||||||
bool stopSmartConfig();
|
bool stopSmartConfig();
|
||||||
bool smartConfigDone();
|
bool smartConfigDone();
|
||||||
|
@ -41,6 +41,7 @@ extern "C" {
|
|||||||
#include "lwip/netif.h"
|
#include "lwip/netif.h"
|
||||||
#include "include/ClientContext.h"
|
#include "include/ClientContext.h"
|
||||||
#include "c_types.h"
|
#include "c_types.h"
|
||||||
|
#include "coredecls.h"
|
||||||
|
|
||||||
namespace BearSSL {
|
namespace BearSSL {
|
||||||
|
|
||||||
@ -1259,14 +1260,12 @@ bool WiFiClientSecure::loadPrivateKey(Stream& stream, size_t size) {
|
|||||||
// SSL debugging which should focus on the WiFiClientBearSSL objects.
|
// SSL debugging which should focus on the WiFiClientBearSSL objects.
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <cont.h>
|
|
||||||
extern cont_t g_cont;
|
|
||||||
extern size_t br_esp8266_stack_proxy_usage();
|
extern size_t br_esp8266_stack_proxy_usage();
|
||||||
|
|
||||||
void _BearSSLCheckStack(const char *fcn, const char *file, int line) {
|
void _BearSSLCheckStack(const char *fcn, const char *file, int line) {
|
||||||
static int cnt = 0;
|
static int cnt = 0;
|
||||||
register uint32_t *sp asm("a1");
|
register uint32_t *sp asm("a1");
|
||||||
int freestack = 4 * (sp - g_cont.stack);
|
int freestack = 4 * (sp - g_pcont->stack);
|
||||||
int freeheap = ESP.getFreeHeap();
|
int freeheap = ESP.getFreeHeap();
|
||||||
static int laststack, lastheap, laststack2;
|
static int laststack, lastheap, laststack2;
|
||||||
if ((laststack != freestack) || (lastheap != freeheap) || (laststack2 != (int)br_esp8266_stack_proxy_usage())) {
|
if ((laststack != freestack) || (lastheap != freeheap) || (laststack2 != (int)br_esp8266_stack_proxy_usage())) {
|
||||||
|
@ -7,3 +7,4 @@ paragraph=The library sets up a Mesh Node which acts as a router, creating a Mes
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Data Processing
|
category=Data Processing
|
||||||
url=https://github.com/Links2004/Arduino/tree/esp8266/hardware/esp8266com/esp8266/libraries/ESP8266httpUpdate
|
url=https://github.com/Links2004/Arduino/tree/esp8266/hardware/esp8266com/esp8266/libraries/ESP8266httpUpdate
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=With this library you can use the Arduino Ethernet (shield or board) t
|
|||||||
category=Communication
|
category=Communication
|
||||||
url=http://www.arduino.cc/en/Reference/Ethernet
|
url=http://www.arduino.cc/en/Reference/Ethernet
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=GDB server stub helps debug crashes when JTAG isn't an option.
|
|||||||
category=Uncategorized
|
category=Uncategorized
|
||||||
url=https://github.com/espressif/esp-gdbstub
|
url=https://github.com/espressif/esp-gdbstub
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Data Processing
|
category=Data Processing
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=Once an SD memory card is connected to the SPI interfare of the Arduin
|
|||||||
category=Data Storage
|
category=Data Storage
|
||||||
url=http://www.arduino.cc/en/Reference/SD
|
url=http://www.arduino.cc/en/Reference/SD
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Signal Input/Output
|
category=Signal Input/Output
|
||||||
url=http://arduino.cc/en/Reference/SPI
|
url=http://arduino.cc/en/Reference/SPI
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Signal Input/Output
|
category=Signal Input/Output
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=This library can control a great number of servos.<br />It makes caref
|
|||||||
category=Device Control
|
category=Device Control
|
||||||
url=http://arduino.cc/en/Reference/Servo
|
url=http://arduino.cc/en/Reference/Servo
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Timing
|
category=Timing
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Signal Input/Output
|
category=Signal Input/Output
|
||||||
url=http://arduino.cc/en/Reference/Wire
|
url=http://arduino.cc/en/Reference/Wire
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -7,3 +7,4 @@ paragraph=
|
|||||||
category=Other
|
category=Other
|
||||||
url=
|
url=
|
||||||
architectures=esp8266
|
architectures=esp8266
|
||||||
|
dot_a_linkage=true
|
||||||
|
@ -25,7 +25,6 @@ build.vtable_flags=-DVTABLES_IN_FLASH
|
|||||||
|
|
||||||
build.float=-u _printf_float -u _scanf_float
|
build.float=-u _printf_float -u _scanf_float
|
||||||
build.led=
|
build.led=
|
||||||
build.noextra4kheap=
|
|
||||||
|
|
||||||
compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
|
compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
|
||||||
compiler.sdk.path={runtime.platform.path}/tools/sdk
|
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.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.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.cmd=xtensa-lx106-elf-gcc
|
||||||
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls
|
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.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.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
|
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}"
|
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
|
## 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
|
## 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
|
## Create eeprom
|
||||||
recipe.objcopy.eep.pattern=
|
recipe.objcopy.eep.pattern=
|
||||||
|
24
tests/device/test_stack_in_heap/test_stack_in_heap.ino
Normal file
24
tests/device/test_stack_in_heap/test_stack_in_heap.ino
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include <BSTest.h>
|
||||||
|
|
||||||
|
BS_ENV_DECLARE();
|
||||||
|
|
||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
#include <coredecls.h>
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
21
tests/device/test_stack_in_sys/test_stack_in_sys.ino
Normal file
21
tests/device/test_stack_in_sys/test_stack_in_sys.ino
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include <BSTest.h>
|
||||||
|
|
||||||
|
BS_ENV_DECLARE();
|
||||||
|
|
||||||
|
#include <cont.h>
|
||||||
|
|
||||||
|
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 ()
|
||||||
|
{
|
||||||
|
}
|
@ -1275,9 +1275,6 @@ def all_boards ():
|
|||||||
if nofloat:
|
if nofloat:
|
||||||
print(id + '.build.float=')
|
print(id + '.build.float=')
|
||||||
|
|
||||||
if noextra4kheap:
|
|
||||||
print(id + '.build.noextra4kheap=-DNO_EXTRA_4K_HEAP')
|
|
||||||
|
|
||||||
print('')
|
print('')
|
||||||
|
|
||||||
if boardsgen:
|
if boardsgen:
|
||||||
@ -1372,8 +1369,6 @@ def usage (name,ret):
|
|||||||
print(" --speed s - change default serial speed")
|
print(" --speed s - change default serial speed")
|
||||||
print(" --customspeed s - new serial speed for all boards")
|
print(" --customspeed s - new serial speed for all boards")
|
||||||
print(" --nofloat - disable float support in printf/scanf")
|
print(" --nofloat - disable float support in printf/scanf")
|
||||||
print(" --noextra4kheap - disable extra 4k heap (will enable WPS)")
|
|
||||||
print(" --allowWPS - synonym for --noextra4kheap")
|
|
||||||
print("")
|
print("")
|
||||||
print(" mandatory option (at least one):")
|
print(" mandatory option (at least one):")
|
||||||
print("")
|
print("")
|
||||||
@ -1417,7 +1412,6 @@ default_speed = '115'
|
|||||||
led_default = 2
|
led_default = 2
|
||||||
led_max = 16
|
led_max = 16
|
||||||
nofloat = False
|
nofloat = False
|
||||||
noextra4kheap = False
|
|
||||||
ldgen = False
|
ldgen = False
|
||||||
ldshow = False
|
ldshow = False
|
||||||
boardsgen = False
|
boardsgen = False
|
||||||
@ -1478,7 +1472,7 @@ for o, a in opts:
|
|||||||
nofloat=True
|
nofloat=True
|
||||||
|
|
||||||
elif o in ("--noextra4kheap", "--allowWPS"):
|
elif o in ("--noextra4kheap", "--allowWPS"):
|
||||||
noextra4kheap=True
|
print('option ' + o + ' is now deprecated, without effect, and will be removed')
|
||||||
|
|
||||||
elif o in ("--ldshow"):
|
elif o in ("--ldshow"):
|
||||||
ldshow = True
|
ldshow = True
|
||||||
|
@ -577,25 +577,11 @@ enum wps_cb_status {
|
|||||||
|
|
||||||
typedef void (*wps_st_cb_t)(int 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_enable(WPS_TYPE_t wps_type);
|
||||||
bool wifi_wps_disable(void);
|
bool wifi_wps_disable(void);
|
||||||
bool wifi_wps_start(void);
|
bool wifi_wps_start(void);
|
||||||
bool wifi_set_wps_cb(wps_st_cb_t cb);
|
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);
|
typedef void (*freedom_outside_cb_t)(uint8 status);
|
||||||
int wifi_register_send_pkt_freedom_cb(freedom_outside_cb_t cb);
|
int wifi_register_send_pkt_freedom_cb(freedom_outside_cb_t cb);
|
||||||
void wifi_unregister_send_pkt_freedom_cb(void);
|
void wifi_unregister_send_pkt_freedom_cb(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user