forked from esp8266/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatic stack location selection (SYS or HEAP), enable per library …
…AR-chive in arduino build system (esp8266#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
- Loading branch information
Showing
37 changed files
with
268 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
Oops, something went wrong.