Skip to content

Commit 6ed54ee

Browse files
committed
WIP: fixes from @igrr's review
1 parent 05b2aee commit 6ed54ee

File tree

8 files changed

+48
-22
lines changed

8 files changed

+48
-22
lines changed

cores/esp8266/cont.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
#define CONT_STACKSIZE 4096
2828
#endif
2929

30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
3034
typedef struct cont_ {
3135
void (*pc_ret)(void);
3236
unsigned* sp_ret;
@@ -74,4 +78,8 @@ int cont_get_free_stack(cont_t* cont);
7478
// continuation stack
7579
bool cont_can_yield(cont_t* cont);
7680

81+
#ifdef __cplusplus
82+
}
83+
#endif
84+
7785
#endif /* CONT_H_ */

cores/esp8266/core_esp8266_app_entry_noextra4k.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "cont.h"
1111
#include "coredecls.h"
1212

13-
// calls to this function must *always* be inlined
13+
// callers to this function must *always* be inlined
1414
void disable_extra4k_at_link_time (void)
1515
{
1616
/*
@@ -30,7 +30,6 @@ static cont_t g_cont __attribute__ ((aligned (16)));
3030

3131
extern "C" void ICACHE_RAM_ATTR app_entry_redefinable(void)
3232
{
33-
/* this is the default NONOS-SDK user's heap location */
3433
g_pcont = &g_cont;
3534

3635
/* Call the entry point of the SDK code. */

cores/esp8266/core_esp8266_postmortem.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333
extern void __real_system_restart_local();
3434

35-
extern cont_t* g_pcont;
36-
3735
// These will be pointers to PROGMEM const strings
3836
static const char* s_panic_file = 0;
3937
static int s_panic_line = 0;

cores/esp8266/coredecls.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ extern "C" {
88

99
// TODO: put declarations here, get rid of -Wno-implicit-function-declaration
1010

11+
#include <cont.h> // g_pcont declaration
12+
1113
extern bool timeshift64_is_set;
1214

1315
void esp_yield();

libraries/ESP8266WiFi/src/ESP8266WiFiSTA-WPS.cpp

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,48 @@
1+
/*
2+
ESP8266WiFiSTA-WPS.cpp - WiFi library for esp8266
3+
4+
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
5+
This file is part of the esp8266 core for Arduino environment.
6+
7+
This library is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU Lesser General Public
9+
License as published by the Free Software Foundation; either
10+
version 2.1 of the License, or (at your option) any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public
18+
License along with this library; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20+
21+
Reworked on 28 Dec 2015 by Markus Sattler
22+
23+
*/
24+
125

226
#include "ESP8266WiFi.h"
327
#include "ESP8266WiFiGeneric.h"
428
#include "ESP8266WiFiSTA.h"
529

6-
void wifi_wps_status_cb(wps_cb_status status);
7-
830
/**
931
* WPS config
1032
* so far only WPS_TYPE_PBC is supported (SDK 1.2.0)
1133
* @return ok
1234
*/
13-
bool beginWPSConfig(void) {
35+
bool ESP8266WiFiSTAClass::beginWPSConfig(void) {
36+
37+
// SYS ram is used by WPS, let's configure user stack inside user's HEAP
38+
disable_extra4k_at_link_time();
1439

1540
if(!WiFi.enableSTA(true)) {
1641
// enable STA failed
1742
return false;
1843
}
1944

20-
WiFi.disconnect();
45+
disconnect();
2146

2247
DEBUGV("wps begin\n");
2348

@@ -32,7 +57,7 @@ bool beginWPSConfig(void) {
3257
return false;
3358
}
3459

35-
if(!wifi_set_wps_cb((wps_st_cb_t) &wifi_wps_status_cb)) {
60+
if(!wifi_set_wps_cb((wps_st_cb_t) &WPSStatusCB)) {
3661
DEBUGV("wps cb failed\n");
3762
return false;
3863
}
@@ -52,7 +77,7 @@ bool beginWPSConfig(void) {
5277
* WPS callback
5378
* @param status wps_cb_status
5479
*/
55-
void wifi_wps_status_cb(wps_cb_status status) {
80+
void ESP8266WiFiSTAClass::WPSStatusCB(wps_cb_status status) {
5681
DEBUGV("wps cb status: %d\r\n", status);
5782
switch(status) {
5883
case WPS_CB_ST_SUCCESS:
@@ -81,4 +106,3 @@ void wifi_wps_status_cb(wps_cb_status status) {
81106

82107
esp_schedule(); // resume the beginWPSConfig function
83108
}
84-

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,19 @@ class ESP8266WiFiSTAClass {
8787

8888
protected:
8989

90-
static bool _useStaticIp;
90+
static bool _useStaticIp;
9191

9292
// ----------------------------------------------------------------------------------------------
9393
// ------------------------------------ STA remote configure -----------------------------------
9494
// ----------------------------------------------------------------------------------------------
9595

96-
public:
96+
protected:
97+
98+
static void WPSStatusCB(wps_cb_status status);
9799

98-
inline bool beginWPSConfig(void) __attribute__((always_inline))
99-
{
100-
disable_extra4k_at_link_time(); // this call must always be inlined
101-
return ::beginWPSConfig();
102-
}
100+
public:
103101

102+
bool beginWPSConfig(void);
104103
bool beginSmartConfig();
105104
bool stopSmartConfig();
106105
bool smartConfigDone();

libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,8 +1259,6 @@ bool WiFiClientSecure::loadPrivateKey(Stream& stream, size_t size) {
12591259
// SSL debugging which should focus on the WiFiClientBearSSL objects.
12601260

12611261
extern "C" {
1262-
#include <cont.h>
1263-
extern cont_t *g_pcont;
12641262
extern size_t br_esp8266_stack_proxy_usage();
12651263

12661264
void _BearSSLCheckStack(const char *fcn, const char *file, int line) {

libraries/esp8266/examples/extra4kchecker/extra4kchecker.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
#define USE_WPS 0 // try me with 0 or 1
1717

18-
extern cont_t* g_pcont;
19-
2018
void setup() {
2119

2220
Serial.begin(115200);

0 commit comments

Comments
 (0)