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 7 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
67 changes: 67 additions & 0 deletions cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,73 @@ 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

extern void user_rf_pre_init();
void user_rf_pre_init();
metarutaiga marked this conversation as resolved.
Show resolved Hide resolved
}

#endif

extern "C" void user_init(void) {
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
94 changes: 92 additions & 2 deletions tools/sdk/include/user_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@
#ifndef __USER_INTERFACE_H__
#define __USER_INTERFACE_H__

#if defined(NONOSDK3V0)
#define NONOSDK (0x30000-1)
#elif defined(NONOSDK300)
#define NONOSDK (0x30000)
#elif defined(NONOSDK301)
#define NONOSDK (0x30100)
#elif defined(NONOSDK302)
#define NONOSDK (0x30200)
#elif defined(NONOSDK303)
#define NONOSDK (0x30300)
#elif defined(NONOSDK304)
#define NONOSDK (0x30400)
#elif defined(NONOSDK305)
#define NONOSDK (0x30500)
#elif defined(NONOSDK306)
#define NONOSDK (0x30600)
#else
#define NONOSDK (0x22100)
#endif

#include "os_type.h"
#ifdef LWIP_OPEN_SRC

Expand Down Expand Up @@ -249,13 +269,19 @@ typedef struct {
struct station_config {
uint8 ssid[32];
uint8 password[64];
#if (NONOSDK >= (0x30200))
uint8 channel;
#endif
uint8 bssid_set; // Note: If bssid_set is 1, station will just connect to the router
// with both ssid[] and bssid[] matched. Please check about this.
uint8 bssid[6];
wifi_fast_scan_threshold_t threshold;
#ifdef NONOSDK3V0
#if (NONOSDK >= (0x30000-1))
bool open_and_wep_mode_disable; // Can connect to open/wep router by default.
#endif
#if (NONOSDK >= (0x30200))
bool all_channel_scan;
#endif
};

bool wifi_station_get_config(struct station_config *config);
Expand Down Expand Up @@ -438,7 +464,7 @@ typedef enum {
MODEM_SLEEP_T
} sleep_type_t;

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

typedef enum {
MIN_SLEEP_T,
Expand Down Expand Up @@ -771,6 +797,70 @@ bool wifi_set_country(wifi_country_t *country);
*/
bool wifi_get_country(wifi_country_t *country);

#if (NONOSDK >= (0x30000))

typedef enum {
SYSTEM_PARTITION_INVALID = 0,
SYSTEM_PARTITION_BOOTLOADER, /* user can't modify this partition address, but can modify size */
SYSTEM_PARTITION_OTA_1, /* user can't modify this partition address, but can modify size */
SYSTEM_PARTITION_OTA_2, /* user can't modify this partition address, but can modify size */
SYSTEM_PARTITION_RF_CAL, /* user must define this partition */
SYSTEM_PARTITION_PHY_DATA, /* user must define this partition */
SYSTEM_PARTITION_SYSTEM_PARAMETER, /* user must define this partition */
SYSTEM_PARTITION_AT_PARAMETER,
SYSTEM_PARTITION_SSL_CLIENT_CERT_PRIVKEY,
SYSTEM_PARTITION_SSL_CLIENT_CA,
SYSTEM_PARTITION_SSL_SERVER_CERT_PRIVKEY,
SYSTEM_PARTITION_SSL_SERVER_CA,
SYSTEM_PARTITION_WPA2_ENTERPRISE_CERT_PRIVKEY,
SYSTEM_PARTITION_WPA2_ENTERPRISE_CA,

SYSTEM_PARTITION_CUSTOMER_BEGIN = 100, /* user can define partition after here */
SYSTEM_PARTITION_MAX
} partition_type_t;

typedef struct {
partition_type_t type; /* the partition type */
uint32_t addr; /* the partition address */
uint32_t size; /* the partition size */
} partition_item_t;

/**
* @brief regist partition table information, user MUST call it in user_pre_init()
*
* @param partition_table: the partition table
* @param partition_num: the partition number in partition table
* @param map: the flash map
*
* @return true : succeed
* @return false : fail
*/
bool system_partition_table_regist(
const partition_item_t* partition_table,
uint32_t partition_num,
uint32_t map
);

/**
* @brief get ota partition size
*
* @return the size of ota partition
*/
uint32_t system_partition_get_ota_partition_size(void);

/**
* @brief get partition information
*
* @param type: the partition type
* @param partition_item: the point to store partition information
*
* @return true : succeed
* @return false : fail
*/
bool system_partition_get_item(partition_type_t type, partition_item_t* partition_item);

#endif

#ifdef __cplusplus
}
#endif
Expand Down
Loading