Skip to content

(WIP) update to latest nonos-sdk (SDK3) #4853

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

Closed
wants to merge 8 commits into from
Closed
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
23 changes: 23 additions & 0 deletions cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,29 @@ extern "C" void ICACHE_RAM_ATTR app_entry (void)
return app_entry_custom();
}

extern "C" void user_pre_init (void)
{
// need to get those numbers from board/generator
// NOT WORKING - need to get numbers from board/generator
// 4M
#define SPI_FLASH_SIZE_MAP 4
#define SYSTEM_PARTITION_RF_CAL_ADDR (0x400000 - 0x3000 - 0x1000 - 0x1000)
#define SYSTEM_PARTITION_PHY_DATA_ADDR (0x400000 - 0x3000 - 0x1000)
#define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR (0x400000 - 0x3000)
static const partition_item_t partitions[] = {
{ SYSTEM_PARTITION_BOOTLOADER, 0x0, 0x1000},
{ SYSTEM_PARTITION_RF_CAL, SYSTEM_PARTITION_RF_CAL_ADDR, 0x1000},
{ SYSTEM_PARTITION_PHY_DATA, SYSTEM_PARTITION_PHY_DATA_ADDR, 0x1000},
{ SYSTEM_PARTITION_SYSTEM_PARAMETER,SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR, 0x3000},
{ SYSTEM_PARTITION_CUSTOMER_BEGIN, 0x1000, 0x8000},
};
if (!system_partition_table_regist(partitions, sizeof(partitions) / sizeof(partitions[0]), SPI_FLASH_SIZE_MAP))
{
os_printf("system_partition_table_regist: failed\n");
while(1);
}
}

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
1 change: 1 addition & 0 deletions libraries/ESP8266WiFi/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ psk KEYWORD2
BSSID KEYWORD2
BSSIDstr KEYWORD2
RSSI KEYWORD2
enableInsecureWEP KEYWORD2
beginWPSConfig KEYWORD2
beginSmartConfig KEYWORD2
stopSmartConfig KEYWORD2
Expand Down
2 changes: 2 additions & 0 deletions libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ static bool sta_config_equal(const station_config& lhs, const station_config& rh
// -----------------------------------------------------------------------------------------------------------------------

bool ESP8266WiFiSTAClass::_useStaticIp = false;
bool ESP8266WiFiSTAClass::_useInsecureWEP = false;

/**
* Start Wifi connection
Expand Down Expand Up @@ -127,6 +128,7 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
}

conf.threshold.rssi = -127;
conf.open_and_wep_mode_disable = !(_useInsecureWEP || *conf.password == 0);

// TODO(#909): set authmode to AUTH_WPA_PSK if passphrase is provided
conf.threshold.authmode = AUTH_OPEN;
Expand Down
3 changes: 3 additions & 0 deletions libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ class ESP8266WiFiSTAClass {

int32_t RSSI();

static void enableInsecureWEP (bool enable = true) { _useInsecureWEP = enable; }

protected:

static bool _useStaticIp;
static bool _useInsecureWEP;

// ----------------------------------------------------------------------------------------------
// ------------------------------------ STA remote configure -----------------------------------
Expand Down
77 changes: 77 additions & 0 deletions tools/sdk/include/user_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ struct station_config {
// with both ssid[] and bssid[] matched. Please check about this.
uint8 bssid[6];
wifi_fast_scan_threshold_t threshold;
bool open_and_wep_mode_disable; // Can connect to open/wep router by default.
};

bool wifi_station_get_config(struct station_config *config);
Expand All @@ -261,6 +262,9 @@ bool wifi_station_set_config_current(struct station_config *config);
bool wifi_station_connect(void);
bool wifi_station_disconnect(void);

void wifi_enable_signaling_measurement(void);
void wifi_disable_signaling_measurement(void);

sint8 wifi_station_get_rssi(void);

typedef enum {
Expand Down Expand Up @@ -427,6 +431,17 @@ typedef enum {
MODEM_SLEEP_T
} sleep_type_t;

typedef enum {
MIN_SLEEP_T,
MAX_SLEEP_T
} sleep_level_t;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there info about what this sleep level means?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question already asked, no answer yet. Reading actual values and playing with them may help #2330.


bool wifi_set_sleep_level(sleep_level_t level);
sleep_level_t wifi_get_sleep_level(void);

bool wifi_set_listen_interval(uint8 interval);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there info about what this listen interval means, and the units of the argument (e.g. ms)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No doc to my knowledge yet.

uint8 wifi_get_listen_interval(void);

bool wifi_set_sleep_type(sleep_type_t type);
sleep_type_t wifi_get_sleep_type(void);

Expand Down Expand Up @@ -745,6 +760,68 @@ bool wifi_set_country(wifi_country_t *country);
*/
bool wifi_get_country(wifi_country_t *country);

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
);

#if 0 // as of today, arduino core has its own ota api
/**
* @brief get ota partition size
*
* @return the size of ota partition
*/
uint32_t system_partition_get_ota_partition_size(void);
#endif // not using espressif ota

/**
* @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);

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions tools/sdk/lib/compare/sdk-compare-includes
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ eof

sdk="$1"
me="$0"
core=${me%/*}/../../../..
core=$(cd ${me%/*}/../../../..; pwd)

[ -r "$sdk/lib/libnet80211.a" ] || help "$0"

Expand All @@ -29,5 +29,5 @@ done | sed \
-e 's/^+#ifdef.*cplusplus//g' \
-e 's/^+extern "C"//g' \
-e 's/^+}$//g' \
-e 's/^+#endif//g' \
-e 's/^+#endif$//g' \
-e 's/^+[ \t]*$//g' \
3 changes: 2 additions & 1 deletion tools/sdk/lib/compare/sdk-compare-libs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ search()
espmd5=$(md5 "$tmp/lib/$f")
if [ "$espmd5" = "$coremd5" ]; then
tag=$(git describe --tag)
echo "$tag - https://github.com/espressif/ESP8266_NONOS_SDK/commit/$i - $f"
date=$(git log $tmp/lib/$f | head -3 | grep ^Date | sed 's,^[^ ]*[ ]*,,g')
echo "$tag - https://github.com/espressif/ESP8266_NONOS_SDK/commit/$i - $f - $date"
found=true
break
fi
Expand Down
4 changes: 3 additions & 1 deletion tools/sdk/lib/fix_sdk_libs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
set -e

export PATH=../../xtensa-lx106-elf/bin:$PATH

# Remove mem_manager.o from libmain.a to use custom heap implementation,
# and time.o to fix redefinition of time-related functions:
xtensa-lx106-elf-ar d libmain.a mem_manager.o
Expand All @@ -13,4 +15,4 @@ xtensa-lx106-elf-objcopy --redefine-sym hostname=wifi_station_hostname eagle_lwi
xtensa-lx106-elf-objcopy --redefine-sym default_hostname=wifi_station_default_hostname user_interface.o
xtensa-lx106-elf-objcopy --redefine-sym default_hostname=wifi_station_default_hostname eagle_lwip_if.o
xtensa-lx106-elf-ar r libmain.a eagle_lwip_if.o user_interface.o
rm eagle_lwip_if.o user_interface.o
rm -f eagle_lwip_if.o user_interface.o
Binary file removed tools/sdk/lib/libat.a
Binary file not shown.
Binary file removed tools/sdk/lib/libc_orig.a
Binary file not shown.
Binary file modified tools/sdk/lib/libcrypto.a
100644 → 100755
Binary file not shown.
Binary file removed tools/sdk/lib/libdriver.a
Binary file not shown.
Binary file modified tools/sdk/lib/libespnow.a
100644 → 100755
Binary file not shown.
Binary file removed tools/sdk/lib/libjson.a
Binary file not shown.
Binary file removed tools/sdk/lib/liblwip.a
Binary file not shown.
Binary file modified tools/sdk/lib/liblwip2.a
Binary file not shown.
Binary file modified tools/sdk/lib/liblwip2_1460.a
Binary file not shown.
Binary file removed tools/sdk/lib/liblwip_536.a
Binary file not shown.
Binary file modified tools/sdk/lib/libmain.a
Binary file not shown.
Binary file modified tools/sdk/lib/libnet80211.a
Binary file not shown.
Binary file modified tools/sdk/lib/libpp.a
Binary file not shown.
Binary file removed tools/sdk/lib/libpwm.a
Binary file not shown.
Binary file modified tools/sdk/lib/libsmartconfig.a
100644 → 100755
Binary file not shown.
Binary file removed tools/sdk/lib/libssl.a
Binary file not shown.
Binary file removed tools/sdk/lib/libupgrade.a
Binary file not shown.
Binary file modified tools/sdk/lib/libwpa.a
100644 → 100755
Binary file not shown.
Binary file modified tools/sdk/lib/libwpa2.a
100644 → 100755
Binary file not shown.
Binary file modified tools/sdk/lib/libwps.a
100644 → 100755
Binary file not shown.
2 changes: 1 addition & 1 deletion tools/sdk/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.1.0-10-g509eae8
v2.2.0-28-g89920dc