Skip to content

Commit a7cd3a1

Browse files
committed
Allow reverting SDK by using boards.txt.py
This commit allows switching SDK firmware: Some boards show erratic behavior (radio connection is quickly lost), with an unknown cause, when using nonos-sdk-pre-v3 (shipped with release 2.5.0). These boards work well with previous nonos-sdk-2.2.1 firmware. Current firmware, which has brought long awaited fixes (WiFi sleep modes), stays as default. To switch: ./tools/boards.txt.py --sdk=NONOSDK221 --allgen (default) ./tools/boards.txt.py --sdk=NONOSDK3V0 --allgen BREAKING for external build systems: new directories to add lib: tools/sdk/lib/<version>/lib include: tools/sdk/lib/<version>/include Fix esp8266#5736
1 parent c9ce966 commit a7cd3a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+9297
-189
lines changed

libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,13 @@ int32_t ESP8266WiFiGenericClass::channel(void) {
249249
* @param type sleep_type_t
250250
* @return bool
251251
*/
252+
#ifdef NONOSDK221
253+
bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenInterval) {
254+
(void)type;
255+
(void)listenInterval;
256+
return false;
257+
}
258+
#else // !defined(NONOSDK221)
252259
bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenInterval) {
253260

254261
/**
@@ -315,6 +322,7 @@ bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenI
315322
}
316323
return ret;
317324
}
325+
#endif // !defined(NONOSDK221)
318326

319327
/**
320328
* get Sleep mode
@@ -499,15 +507,23 @@ bool ESP8266WiFiGenericClass::forceSleepWake() {
499507
* @return interval
500508
*/
501509
uint8_t ESP8266WiFiGenericClass::getListenInterval () {
510+
#ifdef NONOSDK221
511+
return 0;
512+
#else
502513
return wifi_get_listen_interval();
514+
#endif
503515
}
504516

505517
/**
506518
* Get sleep level of modem sleep and light sleep
507519
* @return true if max level
508520
*/
509521
bool ESP8266WiFiGenericClass::isSleepLevelMax () {
522+
#ifdef NONOSDK221
523+
return false;
524+
#else
510525
return wifi_get_sleep_level() == MAX_SLEEP_T;
526+
#endif
511527
}
512528

513529

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
138138
}
139139

140140
conf.threshold.rssi = -127;
141+
#ifndef NONOSDK221
141142
conf.open_and_wep_mode_disable = !(_useInsecureWEP || *conf.password == 0);
143+
#endif
142144

143145
if(bssid) {
144146
conf.bssid_set = 1;

platform.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,22 @@ build.stdcpp_lib=-lstdc++
3030
build.float=-u _printf_float -u _scanf_float
3131
build.led=
3232

33+
# build.sdk: available: NONOSDK221 NONOSDK3V0 NONOSDK3V1
34+
build.sdk=NONOSDK3V0
35+
3336
compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
3437
compiler.sdk.path={runtime.platform.path}/tools/sdk
38+
3539
compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf
36-
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"
40+
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/lib/{build.sdk}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core"
3741

3842
compiler.c.cmd=xtensa-lx106-elf-gcc
3943
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 {build.exception_flags}
4044

4145
compiler.S.cmd=xtensa-lx106-elf-gcc
4246
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls
4347

44-
compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-L{compiler.libc.path}/lib" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read
48+
compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/lib/{build.sdk}" "-L{compiler.sdk.path}/ld" "-L{compiler.libc.path}/lib" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read
4549

4650
compiler.c.elf.cmd=xtensa-lx106-elf-gcc
4751
compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 {build.stdcpp_lib} -lm -lc -lgcc

tools/boards.txt.py

+19-7
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,8 @@ def all_boards ():
14041404

14051405
if nofloat:
14061406
print(id + '.build.float=')
1407+
if not sdk == sdkdefault:
1408+
print(id + '.build.sdk=' + sdk)
14071409

14081410
print('')
14091411

@@ -1498,12 +1500,13 @@ def usage (name,ret):
14981500
print("usage: %s [options]" % name)
14991501
print("")
15001502
print(" -h, --help")
1501-
print(" --lwip - preferred default lwIP version (default %d)" % lwip)
1502-
print(" --led - preferred default builtin led for generic boards (default %d)" % led_default)
1503-
print(" --board b - board to modify:")
1504-
print(" --speed s - change default serial speed")
1505-
print(" --customspeed s - new serial speed for all boards")
1506-
print(" --nofloat - disable float support in printf/scanf")
1503+
print(" --lwip - preferred default lwIP version (default %d)" % lwip)
1504+
print(" --led - preferred default builtin led for generic boards (default %d)" % led_default)
1505+
print(" --board <b> - board to modify:")
1506+
print(" --speed <s> - change default serial speed")
1507+
print(" --customspeed <s> - new serial speed for all boards")
1508+
print(" --nofloat - disable float support in printf/scanf")
1509+
print(" --sdk <sdkdir> - default: %s" % sdkdefault)
15071510
print("")
15081511
print(" mandatory option (at least one):")
15091512
print("")
@@ -1542,6 +1545,8 @@ def usage (name,ret):
15421545
################################################################
15431546
# entry point
15441547

1548+
sdkdefault = 'NONOSDK3V0'
1549+
sdk = sdkdefault
15451550
lwip = 2
15461551
default_speed = '115'
15471552
led_default = 2
@@ -1563,6 +1568,7 @@ def usage (name,ret):
15631568
try:
15641569
opts, args = getopt.getopt(sys.argv[1:], "h",
15651570
[ "help", "lwip=", "led=", "speed=", "board=", "customspeed=", "nofloat",
1571+
"sdk=",
15661572
"noextra4kheap", "allowWPS",
15671573
"ld", "ldgen", "boards", "boardsgen", "package", "packagegen", "doc", "docgen",
15681574
"allgen"] )
@@ -1607,10 +1613,16 @@ def usage (name,ret):
16071613
elif o in ("--nofloat"):
16081614
nofloat=True
16091615

1616+
elif o in ("--sdk"):
1617+
if not os.path.isdir('tools/sdk/lib/' + a):
1618+
print('cannot find sdk directory tools/sdk/lib/' + a + '/')
1619+
sys.exit(1)
1620+
sdk = a
1621+
16101622
elif o in ("--noextra4kheap", "--allowWPS"):
16111623
print('option ' + o + ' is now deprecated, without effect, and will be removed')
16121624

1613-
elif o in ("--ldshow"):
1625+
elif o in ("--ld"):
16141626
ldshow = True
16151627

16161628
elif o in ("--ldgen"):

tools/sdk/include/at_custom.h

-180
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)