-
Notifications
You must be signed in to change notification settings - Fork 13.3k
optionally allow WPS #4889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optionally allow WPS #4889
Changes from 8 commits
3fddf2a
e346d06
852b6a8
24e2aa7
a962930
69a185b
9614781
5439698
a049162
b2220de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,11 +156,62 @@ void init_done() { | |
| * Peripherals (except for SPI0 and UART0) are not initialized. | ||
| * This function does not return. | ||
| */ | ||
| /* | ||
| A bit of explanation for this entry point: | ||
|
|
||
| SYS is the RTOS task/context used by the upperlying system to run its | ||
| administrative tasks (at least WLAN and lwip's receive callbacks and | ||
| Ticker). NONOS-SDK is designed to run users's non-threaded code in | ||
| another specific task/context with its own stack in BSS. | ||
|
|
||
| Some clever fellows found that the SYS stack was a large and quite unused | ||
| piece of ram that we could use for the user stack, and proposed to use it | ||
| to store the user stack instead of using the users' main memory, thus | ||
| saving around 4KB on ram/heap. | ||
|
|
||
| A problem arose later, which is that this stack is heavily used by the | ||
| system for some features. One of these features is WPS. We still don't | ||
| know if other features are using this, or if this memory is going to be | ||
| used in future releases. | ||
|
|
||
| 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 | ||
| the users'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 by using | ||
| the board generator script. This could be also done by setting up a new | ||
| option in the IDE's Tools menu. | ||
|
|
||
| The behavior is controlled by the globally NO_EXTRA_4K_HEAP define below. | ||
|
|
||
|
||
| References: | ||
| https://github.com/esp8266/Arduino/pull/4553 | ||
| https://github.com/esp8266/Arduino/pull/4622 | ||
| https://github.com/esp8266/Arduino/issues/4779 | ||
| https://github.com/esp8266/Arduino/pull/4889 | ||
|
|
||
| */ | ||
|
|
||
| #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) | ||
| { | ||
| /* Allocate continuation context on this stack, and save pointer to it. */ | ||
| #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(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,22 @@ entering an issue report, please perform initial troubleshooting. | |
|
|
||
| `Read more <a02-my-esp-crashes.rst>`__. | ||
|
|
||
| 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`` | ||
|
|
||
| Why can't I use WPS ? | ||
| ~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| WPS is disabled by default, this offers an extra 4KB in ram/heap. To enable | ||
| WPS (and loose 4KB of useable ram), use this boards generator option: | ||
|
||
|
|
||
| ``./tools/boards.txt.py --allowWPS --allgen`` | ||
|
|
||
| This Arduino library doesn't work on ESP. How do I make it work? | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -571,6 +571,9 @@ 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); | ||
|
|
||
| /** | ||
|
|
@@ -650,7 +653,7 @@ void wifi_wps_status_cb(wps_cb_status status) { | |
| esp_schedule(); // resume the beginWPSConfig function | ||
| } | ||
|
|
||
|
|
||
| #endif // NO_EXTRA_4K_HEAP | ||
|
|
||
| bool ESP8266WiFiSTAClass::_smartConfigStarted = false; | ||
| bool ESP8266WiFiSTAClass::_smartConfigDone = false; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
|
|
||
| #include "ESP8266WiFiType.h" | ||
| #include "ESP8266WiFiGeneric.h" | ||
| #include "user_interface.h" | ||
|
|
||
|
|
||
| class ESP8266WiFiSTAClass { | ||
|
|
@@ -92,7 +93,13 @@ 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(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -575,13 +575,27 @@ enum wps_cb_status { | |
| WPS_CB_ST_UNK, | ||
| }; | ||
|
|
||
| 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); | ||
|
|
||
| typedef void (*wps_st_cb_t)(int status); | ||
| 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); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RTOS task/context -> SDK task context
There is confusion about RTOS and NONOS, I'd prefer to not add to that.