1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-25 20:02:37 +03:00

Revert to nonos-sdk 2.2.1, new sdk-switching option in IDE menu for generic board only (#5763)

This commit allows switching SDK firmware:

nonos-sdk-pre-v3 shipped with release 2.5.0 has issues:

    * Some boards show erratic behavior (radio connection is quickly lost), with an unknown cause.
      These boards work well with previous nonos-sdk-2.2.1 firmware (#5736)

    * Overall performances seem to have decreased (#5513)

This PR restores sdk2.2.1 (as in core-2.4.2).

SDK-pre-3.0 - which has brought long awaited fixes (WiFi sleep modes) - is still available through a menu option available only with generic board.

BREAKING

    * new define `-DNONOSDK221=1` or `-DNONOSDK3V0=1`

    * for external build systems: new library directory: `tools/sdk/lib/<version>/lib`

    * PIO: variable `PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3` is needed for sdk-pre-v3.


Fix #5736
This commit is contained in:
david gauchard 2019-02-19 13:10:49 +01:00 committed by GitHub
parent 9790e1cb7c
commit 7745e99046
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 74 additions and 191 deletions

View File

@ -20,6 +20,7 @@ menu.vt=VTables
menu.exception=Exceptions
menu.led=Builtin Led
menu.wipe=Erase Flash
menu.sdk=Espressif FW
##############################################################
generic.name=Generic ESP8266 Module
@ -349,6 +350,10 @@ generic.menu.led.14=14
generic.menu.led.14.build.led=-DLED_BUILTIN=14
generic.menu.led.15=15
generic.menu.led.15.build.led=-DLED_BUILTIN=15
generic.menu.sdk.nonosdk221=nonos-sdk 2.2.1
generic.menu.sdk.nonosdk221.build.sdk=NONOSDK221
generic.menu.sdk.nonosdk3v0=nonos-sdk pre-3
generic.menu.sdk.nonosdk3v0.build.sdk=NONOSDK3V0
generic.menu.ip.lm2f=v2 Lower Memory
generic.menu.ip.lm2f.build.lwip_include=lwip2/include
generic.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat

View File

@ -249,6 +249,13 @@ int32_t ESP8266WiFiGenericClass::channel(void) {
* @param type sleep_type_t
* @return bool
*/
#ifdef NONOSDK221
bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenInterval) {
(void)type;
(void)listenInterval;
return false;
}
#else // !defined(NONOSDK221)
bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenInterval) {
/**
@ -315,6 +322,7 @@ bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenI
}
return ret;
}
#endif // !defined(NONOSDK221)
/**
* get Sleep mode
@ -499,7 +507,11 @@ bool ESP8266WiFiGenericClass::forceSleepWake() {
* @return interval
*/
uint8_t ESP8266WiFiGenericClass::getListenInterval () {
#ifdef NONOSDK221
return 0;
#else
return wifi_get_listen_interval();
#endif
}
/**
@ -507,7 +519,11 @@ uint8_t ESP8266WiFiGenericClass::getListenInterval () {
* @return true if max level
*/
bool ESP8266WiFiGenericClass::isSleepLevelMax () {
#ifdef NONOSDK221
return false;
#else
return wifi_get_sleep_level() == MAX_SLEEP_T;
#endif
}

View File

@ -138,7 +138,9 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
}
conf.threshold.rssi = -127;
#ifndef NONOSDK221
conf.open_and_wep_mode_disable = !(_useInsecureWEP || *conf.password == 0);
#endif
if(bssid) {
conf.bssid_set = 1;

View File

@ -34,9 +34,11 @@ build.stdcpp_lib=-lstdc++
build.float=-u _printf_float -u _scanf_float
build.led=
build.sdk=NONOSDK221
compiler.path={runtime.tools.xtensa-lx106-elf-gcc.path}/bin/
compiler.sdk.path={runtime.platform.path}/tools/sdk
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"
@ -46,7 +48,7 @@ compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implici
compiler.S.cmd=xtensa-lx106-elf-gcc
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls
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
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
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 {build.stdcpp_lib} -lm -lc -lgcc
@ -88,13 +90,13 @@ recipe.hooks.core.prebuild.2.pattern="{runtime.tools.python}" "{runtime.tools.ma
recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld"
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.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} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -D{build.sdk}=1 -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} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.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} {build.flash_flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -D{build.sdk}=1 -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} {build.flash_flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile S files
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} {build.flash_flags} {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} -D{build.sdk}=1 -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} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"

View File

@ -129,6 +129,7 @@ endif
FLAGS += $(DEBUG) -Wall -coverage $(OPTZ) -fno-common -g $(M32)
FLAGS += -DHTTPCLIENT_1_1_COMPATIBLE=0
FLAGS += -DLWIP_IPV6=0
FLAGS += -DNONOSDK221=1
FLAGS += $(MKFLAGS)
CXXFLAGS += -std=c++11 $(FLAGS)
CFLAGS += -std=c99 $(FLAGS)

View File

@ -70,6 +70,7 @@ boards = collections.OrderedDict([
'flashmode_menu',
'512K', '1M', '2M', '4M', '8M', '16M',
'led',
'sdk',
],
'desc': [ 'These modules come in different form factors and pinouts. See the page at ESP8266 community wiki for more info: `ESP8266 Module Family <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`__.',
'',
@ -1326,6 +1327,18 @@ def led (default,max):
]))
return { 'led': led }
################################################################
# sdk selection
def sdk ():
return { 'sdk': collections.OrderedDict([
('.menu.sdk.nonosdk221', 'nonos-sdk 2.2.1'),
('.menu.sdk.nonosdk221.build.sdk', 'NONOSDK221'),
('.menu.sdk.nonosdk3v0', 'nonos-sdk pre-3'),
('.menu.sdk.nonosdk3v0.build.sdk', 'NONOSDK3V0'),
])
}
################################################################
def all_boards ():
@ -1344,6 +1357,7 @@ def all_boards ():
macros.update(all_flash_map())
macros.update(all_debug())
macros.update(led(led_default, led_max))
macros.update(sdk())
print('#')
print('# Do not create pull-requests for this file only, CI will not accept them.')
@ -1367,6 +1381,7 @@ def all_boards ():
print('menu.exception=Exceptions')
print('menu.led=Builtin Led')
print('menu.wipe=Erase Flash')
print('menu.sdk=Espressif FW')
print('')
for id in boards:
@ -1498,12 +1513,12 @@ def usage (name,ret):
print("usage: %s [options]" % name)
print("")
print(" -h, --help")
print(" --lwip - preferred default lwIP version (default %d)" % lwip)
print(" --led - preferred default builtin led for generic boards (default %d)" % led_default)
print(" --board b - board to modify:")
print(" --speed s - change default serial speed")
print(" --customspeed s - new serial speed for all boards")
print(" --nofloat - disable float support in printf/scanf")
print(" --lwip - preferred default lwIP version (default %d)" % lwip)
print(" --led - preferred default builtin led for generic boards (default %d)" % led_default)
print(" --board <b> - board to modify:")
print(" --speed <s> - change default serial speed")
print(" --customspeed <s> - new serial speed for all boards")
print(" --nofloat - disable float support in printf/scanf")
print("")
print(" mandatory option (at least one):")
print("")
@ -1610,7 +1625,7 @@ for o, a in opts:
elif o in ("--noextra4kheap", "--allowWPS"):
print('option ' + o + ' is now deprecated, without effect, and will be removed')
elif o in ("--ldshow"):
elif o in ("--ld"):
ldshow = True
elif o in ("--ldgen"):

View File

@ -131,6 +131,21 @@ env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])
flatten_cppdefines = env.Flatten(env['CPPDEFINES'])
#
# SDK
#
if "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3" in flatten_cppdefines:
env.Append(
CPPDEFINES=[("NONOSDK3V0", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK3V0"),]
)
# PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221 (default)
else:
env.Append(
CPPDEFINES=[("NONOSDK221", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK221"),]
)
#
# lwIP
#

View File

@ -1,180 +0,0 @@
/*
* ESPRESSIF MIT License
*
* Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
*
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
* it is free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef CUSTOM_AT_H_
#define CUSTOM_AT_H_
#include "c_types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
char *at_cmdName;
int8_t at_cmdLen;
void (*at_testCmd)(uint8_t id);
void (*at_queryCmd)(uint8_t id);
void (*at_setupCmd)(uint8_t id, char *pPara);
void (*at_exeCmd)(uint8_t id);
}at_funcationType;
typedef void (*at_custom_uart_rx_intr)(uint8* data,int32 len);
typedef void (*at_custom_response_func_type)(const char *str);
typedef void (*at_fake_uart_tx_func_type)(const uint8*data,uint32 length);
extern uint8 at_customLinkMax;
/**
* @brief Response "OK" to uart.
* @param None
* @retval None
*/
void at_response_ok(void);
/**
* @brief Response "ERROR" to uart.
* @param None
* @retval None
*/
void at_response_error(void);
/**
* @brief Response string.
* It is equivalent to at_port_print,if not call at_register_response_func or call at_register_response_func(NULL);
* It will run custom response function,if call at_register_response_func and parameter is not NULL.
* @param string
* @retval None
*/
void at_response(const char *str);
/**
* @brief register custom response function.
* @param response_func: the function that will run when call at_response
* @retval None
*/
void at_register_response_func(at_custom_response_func_type response_func);
/**
* @brief Task of process command or txdata.
* @param custom_at_cmd_array: the array of at cmd that custom defined
* cmd_num : the num of at cmd that custom defined
* @retval None
*/
void at_cmd_array_regist(at_funcationType *custom_at_cmd_array,uint32 cmd_num);
/**
* @brief get digit form at cmd line.the maybe alter pSrc
* @param p_src: at cmd line string
* result:the buffer to be placed result
* err : err num
* @retval TRUE:
* FALSE:
*/
bool at_get_next_int_dec(char **p_src,int*result,int* err);
/**
* @brief get string form at cmd line.the maybe alter pSrc
* @param p_dest: the buffer to be placed result
* p_src: at cmd line string
* max_len :max len of string excepted to get
* @retval None
*/
int32 at_data_str_copy(char *p_dest, char **p_src, int32 max_len);
/**
* @brief initialize at module
* @param None
* @retval None
*/
void at_init(void);
/**
* @brief print string to at port
* @param string
* @retval None
*/
void at_port_print(const char *str);
/**
* @brief print custom information when AT+GMR
* @param string
* @retval None
*/
void at_set_custom_info(char* info);
/**
* @brief if current at command is processing,you can call at_enter_special_state,
* then if other comamnd coming,it will return busy.
* @param None
* @retval None
*/
void at_enter_special_state(void);
/**
* @brief
* @param None
* @retval None
*/
void at_leave_special_state(void);
/**
* @brief get at version
* @param None
* @retval at version
* bit24~31: at main version
* bit23~16: at sub version
* bit15~8 : at test version
* bit7~0 : customized version
*/
uint32 at_get_version(void);
/**
* @brief register custom uart rx interrupt function
* @param rx_func: custom uart rx interrupt function.
* If rx_func is non-void,when rx interrupt comming,it will call rx_func(data,len),
* data is the buffer of data,len is the length of data.Otherwise,it will run AT rx function.
* @retval None
*/
void at_register_uart_rx_intr(at_custom_uart_rx_intr rx_func);
/**
* @brief notify at module that has receive data
* @param data: data buffer.
* @param length: data length
* @retval data len,if ok len == length
*/
uint32 at_fake_uart_rx(uint8* data,uint32 length);
/**
* @brief enable fake uart,and register fake uart tx
* @param enable: enable fake uart.
* @param at_fake_uart_tx_func:
* @retval data len,if ok len == length
*/
bool at_fake_uart_enable(bool enable,at_fake_uart_tx_func_type at_fake_uart_tx_func);
/**
* @brief set at escape character
* @param ch: escape character.
* @retval TRUE,if set ok,otherwize FALSE.
*/
bool at_set_escape_character(uint8 ch);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -253,7 +253,9 @@ struct station_config {
// with both ssid[] and bssid[] matched. Please check about this.
uint8 bssid[6];
wifi_fast_scan_threshold_t threshold;
#ifndef NONOSDK221
bool open_and_wep_mode_disable; // Can connect to open/wep router by default.
#endif
};
bool wifi_station_get_config(struct station_config *config);
@ -432,6 +434,8 @@ typedef enum {
MODEM_SLEEP_T
} sleep_type_t;
#ifndef NONOSDK221
typedef enum {
MIN_SLEEP_T,
MAX_SLEEP_T
@ -443,6 +447,8 @@ sleep_level_t wifi_get_sleep_level(void);
bool wifi_set_listen_interval(uint8 interval);
uint8 wifi_get_listen_interval(void);
#endif
bool wifi_set_sleep_type(sleep_type_t type);
sleep_type_t wifi_get_sleep_type(void);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
v2.1.0-10-g509eae8

Binary file not shown.

Binary file not shown.

Binary file not shown.