Skip to content
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

Added NONOS SDK 3.0.0 ~ 3.0.5 (again) #8736

Merged
merged 12 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ generic.menu.sdk.nonosdk221=nonos-sdk 2.2.1 (legacy)
generic.menu.sdk.nonosdk221.build.sdk=NONOSDK221
generic.menu.sdk.nonosdk3v0=nonos-sdk pre-3 (180626 known issues)
generic.menu.sdk.nonosdk3v0.build.sdk=NONOSDK3V0
generic.menu.sdk.nonosdk300=nonos-sdk 3.0.0
generic.menu.sdk.nonosdk300.build.sdk=NONOSDK300
generic.menu.sdk.nonosdk301=nonos-sdk 3.0.1
generic.menu.sdk.nonosdk301.build.sdk=NONOSDK301
generic.menu.sdk.nonosdk302=nonos-sdk 3.0.2
generic.menu.sdk.nonosdk302.build.sdk=NONOSDK302
generic.menu.sdk.nonosdk303=nonos-sdk 3.0.3
generic.menu.sdk.nonosdk303.build.sdk=NONOSDK303
generic.menu.sdk.nonosdk304=nonos-sdk 3.0.4
generic.menu.sdk.nonosdk304.build.sdk=NONOSDK304
generic.menu.sdk.nonosdk305=nonos-sdk 3.0.5
generic.menu.sdk.nonosdk305.build.sdk=NONOSDK305
mcspr marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down Expand Up @@ -710,6 +722,18 @@ esp8285.menu.sdk.nonosdk221=nonos-sdk 2.2.1 (legacy)
esp8285.menu.sdk.nonosdk221.build.sdk=NONOSDK221
esp8285.menu.sdk.nonosdk3v0=nonos-sdk pre-3 (180626 known issues)
esp8285.menu.sdk.nonosdk3v0.build.sdk=NONOSDK3V0
esp8285.menu.sdk.nonosdk300=nonos-sdk 3.0.0
esp8285.menu.sdk.nonosdk300.build.sdk=NONOSDK300
esp8285.menu.sdk.nonosdk301=nonos-sdk 3.0.1
esp8285.menu.sdk.nonosdk301.build.sdk=NONOSDK301
esp8285.menu.sdk.nonosdk302=nonos-sdk 3.0.2
esp8285.menu.sdk.nonosdk302.build.sdk=NONOSDK302
esp8285.menu.sdk.nonosdk303=nonos-sdk 3.0.3
esp8285.menu.sdk.nonosdk303.build.sdk=NONOSDK303
esp8285.menu.sdk.nonosdk304=nonos-sdk 3.0.4
esp8285.menu.sdk.nonosdk304.build.sdk=NONOSDK304
esp8285.menu.sdk.nonosdk305=nonos-sdk 3.0.5
esp8285.menu.sdk.nonosdk305.build.sdk=NONOSDK305
esp8285.menu.ip.lm2f=v2 Lower Memory
esp8285.menu.ip.lm2f.build.lwip_include=lwip2/include
esp8285.menu.ip.lm2f.build.lwip_lib=-llwip2-536-feat
Expand Down
70 changes: 70 additions & 0 deletions cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,77 @@ extern "C" void flashinit (void);
uint32_t __flashindex;
#endif

#if (NONOSDK >= (0x30000))

extern "C" void ICACHE_FLASH_ATTR user_pre_init(void)
{
uint32_t rf_cal = 0;
uint32_t phy_data = 0;
uint32_t system_parameter = 0;

switch (system_get_flash_size_map())
{
case FLASH_SIZE_2M:
rf_cal = 0x3b000;
phy_data = 0x3c000;
system_parameter = 0x3d000;
break;
case FLASH_SIZE_4M_MAP_256_256:
rf_cal = 0x7b000;
phy_data = 0x7c000;
system_parameter = 0x7d000;
break;
case FLASH_SIZE_8M_MAP_512_512:
rf_cal = 0xfb000;
phy_data = 0xfc000;
system_parameter = 0xfd000;
break;
case FLASH_SIZE_16M_MAP_512_512:
case FLASH_SIZE_16M_MAP_1024_1024:
rf_cal = 0x1fb000;
phy_data = 0x1fc000;
system_parameter = 0x1fd000;
break;
case FLASH_SIZE_32M_MAP_512_512:
case FLASH_SIZE_32M_MAP_1024_1024:
case FLASH_SIZE_32M_MAP_2048_2048:
rf_cal = 0x3fb000;
phy_data = 0x3fc000;
system_parameter = 0x3fd000;
break;
case FLASH_SIZE_64M_MAP_1024_1024:
rf_cal = 0x7fb000;
phy_data = 0x7fc000;
system_parameter = 0x7fd000;
break;
case FLASH_SIZE_128M_MAP_1024_1024:
rf_cal = 0xffb000;
phy_data = 0xffc000;
system_parameter = 0xffd000;
break;
}

extern uint32_t user_rf_cal_sector_set(void);
user_rf_cal_sector_set();

const partition_item_t at_partition_table[] =
{
{ SYSTEM_PARTITION_RF_CAL, rf_cal, 0x1000 },
{ SYSTEM_PARTITION_PHY_DATA, phy_data, 0x1000 },
{ SYSTEM_PARTITION_SYSTEM_PARAMETER, system_parameter, 0x3000 },
};
system_partition_table_regist(at_partition_table, sizeof(at_partition_table) / sizeof(at_partition_table[0]), system_get_flash_size_map());
mcspr marked this conversation as resolved.
Show resolved Hide resolved
}

#endif

extern "C" void user_init(void) {

#if (NONOSDK >= (0x30000))
extern void user_rf_pre_init();
user_rf_pre_init();
#endif

struct rst_info *rtc_info_ptr = system_get_rst_info();
memcpy((void *) &resetInfo, (void *) rtc_info_ptr, sizeof(resetInfo));

Expand Down
18 changes: 9 additions & 9 deletions libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenI

*/

#ifdef NONOSDK3V0
#if (NONOSDK >= (0x30000 - 1))

#ifdef DEBUG_ESP_WIFI
if (listenInterval && type == WIFI_NONE_SLEEP)
Expand Down Expand Up @@ -334,9 +334,9 @@ bool ESP8266WiFiGenericClass::setSleepMode(WiFiSleepType_t type, uint8_t listenI
}
}
}
#else // !defined(NONOSDK3V0)
#else // (NONOSDK >= (0x30000 - 1))
(void)listenInterval;
#endif // !defined(NONOSDK3V0)
#endif // (NONOSDK >= (0x30000 - 1))

bool ret = wifi_set_sleep_type((sleep_type_t) type);
if (!ret) {
Expand Down Expand Up @@ -571,10 +571,10 @@ bool ESP8266WiFiGenericClass::forceSleepWake() {
* @return interval
*/
uint8_t ESP8266WiFiGenericClass::getListenInterval () {
#ifndef NONOSDK3V0
return 0;
#else
#if (NONOSDK >= (0x30000 - 1))
return wifi_get_listen_interval();
#else
return 0;
#endif
}

Expand All @@ -583,10 +583,10 @@ uint8_t ESP8266WiFiGenericClass::getListenInterval () {
* @return true if max level
*/
bool ESP8266WiFiGenericClass::isSleepLevelMax () {
#ifndef NONOSDK3V0
return false;
#else
#if (NONOSDK >= (0x30000 - 1))
return wifi_get_sleep_level() == MAX_SLEEP_T;
#else
return false;
#endif
}

Expand Down
22 changes: 18 additions & 4 deletions libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static bool sta_config_equal(const station_config& lhs, const station_config& rh
*/
static bool sta_config_equal(const station_config& lhs, const station_config& rhs) {

#ifdef NONOSDK3V0
#if (NONOSDK >= (0x30000 - 1))
static_assert(sizeof(station_config) == 116, "struct station_config has changed, please update comparison function");
#else
static_assert(sizeof(station_config) == 112, "struct station_config has changed, please update comparison function");
Expand Down Expand Up @@ -94,8 +94,18 @@ static bool sta_config_equal(const station_config& lhs, const station_config& rh
return false;
}

#ifdef NONOSDK3V0
if (lhs.open_and_wep_mode_disable != rhs.open_and_wep_mode_disable) {
#if (NONOSDK >= (0x30000 - 1))
if(lhs.open_and_wep_mode_disable != rhs.open_and_wep_mode_disable) {
return false;
}
#endif

#if (NONOSDK >= (0x30200))
if(lhs.channel != rhs.channel) {
return false;
}

if(lhs.all_channel_scan != rhs.all_channel_scan) {
return false;
}
#endif
Expand Down Expand Up @@ -156,9 +166,13 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
}

conf.threshold.rssi = -127;
#ifdef NONOSDK3V0
#if (NONOSDK >= (0x30000 - 1))
conf.open_and_wep_mode_disable = !(_useInsecureWEP || *conf.password == 0);
#endif
#if (NONOSDK >= (0x30200))
conf.channel = channel;
conf.all_channel_scan = true;
#endif

if(bssid) {
conf.bssid_set = 1;
Expand Down
10 changes: 7 additions & 3 deletions tests/host/common/user_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ extern "C"
config->bssid[i] = i;
config->threshold.rssi = 1;
config->threshold.authmode = AUTH_WPA_PSK;
#ifdef NONOSDK3V0
#if (NONOSDK >= (0x30000 - 1))
config->open_and_wep_mode_disable = true;
#endif
#if (NONOSDK >= (0x30200))
config->channel = 1;
config->all_channel_scan = true;
#endif
return true;
}
Expand Down Expand Up @@ -211,7 +215,7 @@ extern "C"
return STATION_MODE;
}

#ifdef NONOSDK3V0
#if (NONOSDK >= (0x30000 - 1))

sleep_level_t wifi_get_sleep_level(void)
{
Expand Down Expand Up @@ -267,7 +271,7 @@ extern "C"
return true;
}

#ifdef NONOSDK3V0
#if (NONOSDK >= (0x30000 - 1))

bool wifi_set_sleep_level(sleep_level_t level)
{
Expand Down
12 changes: 12 additions & 0 deletions tools/boards.txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,18 @@ def sdk ():
('.menu.sdk.nonosdk221.build.sdk', 'NONOSDK221'),
('.menu.sdk.nonosdk3v0', 'nonos-sdk pre-3 (180626 known issues)'),
('.menu.sdk.nonosdk3v0.build.sdk', 'NONOSDK3V0'),
('.menu.sdk.nonosdk300', 'nonos-sdk 3.0.0'),
('.menu.sdk.nonosdk300.build.sdk', 'NONOSDK300'),
('.menu.sdk.nonosdk301', 'nonos-sdk 3.0.1'),
('.menu.sdk.nonosdk301.build.sdk', 'NONOSDK301'),
('.menu.sdk.nonosdk302', 'nonos-sdk 3.0.2'),
('.menu.sdk.nonosdk302.build.sdk', 'NONOSDK302'),
('.menu.sdk.nonosdk303', 'nonos-sdk 3.0.3'),
('.menu.sdk.nonosdk303.build.sdk', 'NONOSDK303'),
('.menu.sdk.nonosdk304', 'nonos-sdk 3.0.4'),
('.menu.sdk.nonosdk304.build.sdk', 'NONOSDK304'),
('.menu.sdk.nonosdk305', 'nonos-sdk 3.0.5'),
('.menu.sdk.nonosdk305.build.sdk', 'NONOSDK305'),
])
}

Expand Down
74 changes: 36 additions & 38 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,51 +173,49 @@ def scons_patched_match_splitext(path, suffixes=None):
)
)

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")]
)
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221" in flatten_cppdefines:
#(previous default)
env.Append(
CPPDEFINES=[("NONOSDK221", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK221")]
)
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190313" in flatten_cppdefines:
env.Append(
CPPDEFINES=[("NONOSDK22x_190313", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK22x_190313")]
)
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191024" in flatten_cppdefines:
env.Append(
CPPDEFINES=[("NONOSDK22x_191024", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK22x_191024")]
)
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191105" in flatten_cppdefines:
env.Append(
CPPDEFINES=[("NONOSDK22x_191105", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK22x_191105")]
)
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191122" in flatten_cppdefines:
env.Append(
CPPDEFINES=[("NONOSDK22x_191122", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK22x_191122")]
)
else: #(default) if "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703" in flatten_cppdefines:
env.Append(
CPPDEFINES=[("NONOSDK22x_190703", 1)],
LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK22x_190703")]
)
NONOSDK_VERSIONS = (
("SDK22x_190703", "NONOSDK22x_190703"),
("SDK221", "NONOSDK221"),
("SDK22x_190313", "NONOSDK22x_190313"),
("SDK22x_191024", "NONOSDK22x_191024"),
("SDK22x_191105", "NONOSDK22x_191105"),
("SDK22x_191122", "NONOSDK22x_191122"),
("SDK3", "NONOSDK3V0"),
("SDK300", "NONOSDK300"),
("SDK301", "NONOSDK301"),
("SDK302", "NONOSDK302"),
("SDK303", "NONOSDK303"),
("SDK304", "NONOSDK304"),
("SDK305", "NONOSDK305"),
)
nonosdk_version = NONOSDK_VERSIONS[0]

NONOSDK_PREFIX = "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_"
for define in env["CPPDEFINES"]:
if isinstance(define, (tuple, list)):
define, _ = define
if define.startswith(NONOSDK_PREFIX):
for version in NONOSDK_VERSIONS:
name, _ = version
if define.endswith(name):
nonosdk_version = version

NONOSDK_LIBPATH=join(FRAMEWORK_DIR, "tools", "sdk", "lib", nonosdk_version[1])
assert(isdir(NONOSDK_LIBPATH))

env.Append(
CPPDEFINES=[(nonosdk_version[1], 1)],
LIBPATH=[NONOSDK_LIBPATH],
)

#
# lwIP
#
flatten_cppdefines = env.Flatten(env["CPPDEFINES"])

lwip_lib = None
if "PIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_LOW_MEMORY" in flatten_cppdefines:
env.Append(
Expand Down
Loading