Skip to content

Update SDK to 2.0.0 #2440

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

Merged
merged 1 commit into from
Feb 3, 2017
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
34 changes: 26 additions & 8 deletions cores/esp8266/core_esp8266_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <stdbool.h>
#include <string.h>
#include "c_types.h"
#include "ets_sys.h"
#include "spi_flash.h"

static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
{
Expand Down Expand Up @@ -228,7 +230,7 @@ static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
// 3: auto measure frequency offset and correct it, bbpll is 160M, it only can correct + frequency offset.
// 5: use 113 byte force_freq_offset to correct frequency offset, bbpll is 168M, it can correct + and - frequency offset.
// 7: use 113 byte force_freq_offset to correct frequency offset, bbpll is 160M , it only can correct + frequency offset.
[112] = 3,
[112] = 0,

// force_freq_offset
// signed, unit is 8kHz
Expand All @@ -250,14 +252,20 @@ static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
#define __get_rf_mode _Z13__get_rf_modev
#define __run_user_rf_pre_init _Z22__run_user_rf_pre_initv

extern int __real_register_chipv6_phy(uint8_t* init_data);
extern int __wrap_register_chipv6_phy(uint8_t* init_data)
static bool spoof_init_data = false;

extern int __real_spi_flash_read(uint32_t addr, uint32_t* dst, size_t size);
extern int ICACHE_RAM_ATTR __wrap_spi_flash_read(uint32_t addr, uint32_t* dst, size_t size);

extern int ICACHE_RAM_ATTR __wrap_spi_flash_read(uint32_t addr, uint32_t* dst, size_t size)
{
if (init_data != NULL) {
memcpy(init_data, phy_init_data, sizeof(phy_init_data));
init_data[107] = __get_adc_mode();
if (!spoof_init_data || size != 128) {
return __real_spi_flash_read(addr, dst, size);
}
return __real_register_chipv6_phy(init_data);

memcpy(dst, phy_init_data, sizeof(phy_init_data));
((uint8_t*)dst)[107] = __get_adc_mode();
return 0;
}

extern int __get_rf_mode(void) __attribute__((weak));
Expand All @@ -278,10 +286,16 @@ extern void __run_user_rf_pre_init(void)
return; // default do noting
}

uint32_t user_rf_cal_sector_set(void)
{
spoof_init_data = true;
return flashchip->chip_size/SPI_FLASH_SEC_SIZE - 4;
}

void user_rf_pre_init()
{
// *((volatile uint32_t*) 0x60000710) = 0;

spoof_init_data = false;
volatile uint32_t* rtc_reg = (volatile uint32_t*) 0x60001000;
if((rtc_reg[24] >> 16) > 4) {
rtc_reg[24] &= 0xFFFF;
Expand All @@ -295,3 +309,7 @@ void user_rf_pre_init()
}
__run_user_rf_pre_init();
}


void ICACHE_RAM_ATTR user_spi_flash_dio_to_qio_pre_init() {}

2 changes: 1 addition & 1 deletion platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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 call_user_start -u _printf_float -u _scanf_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,register_chipv6_phy
compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u call_user_start -u _printf_float -u _scanf_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.cmd=xtensa-lx106-elf-gcc
compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -laxtls -lespnow -lsmartconfig -lmesh -lwpa2 -lstdc++ -lm -lc -lgcc
Expand Down
27 changes: 27 additions & 0 deletions tools/sdk/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
ESP8266_NONOS_SDK_V2.0.0_16_07_19 Release Note
----------------------------------------------
1. Updated libphy.a to 1055, fixed an issue of large current in Light-sleep.
2. Updated AT+ to 1.3.0:
2.1 Added Light-sleep wakeup command, AT+WAKEUPGPIO;
2.2 Fixed abnormal AT+CWDHCPS IP allocation;
2.3 Added at_sdio demo under example directory.
3. Fixed probable system default when calling cur and def interfaces.
4. Fixed the issue of high current in Deep-sleep mode without disabling SPI first.
5. Fixed an issue where the SDK would crash when switching from AP to Station mode by calling wifi_set_phy_mode.
6. Updated secondary boot loader to v1.6:
6.1 Supports AT + based on SDIO;
6.2 Supports entering testing mode through GPIO.
7. Added support for MXIC Flash QIO mode.
8. Fixed exception caused during TCP handshake and retransmission.
9. Fixed issues in ESP-NOW.
10. Added ESP-PAIR (Simple-Pair) feature, for APIs please refer to ESP8266 SDK API Guide.
11. wpa2-enterprise time function derivation and time check disable can be set by users.
12. Support for PEAP/TTLS in wpa2-enterprise, for APIs please refer to ESP8266 SDK API Guide.
13. Added mqtt demos under examples directory.
14. Other issue fixes.
15. Resolved an issue that RF_Init_data sector may be broken in stress test. Provided a function user_rf_cal_sector_set which has to be added in application by software developer. More details about user_rf_cal_sector_set refer to documentation "2C-ESP8266__SDK__API Guide". (Resolved in ESP8266_NONOS_SDK_V1.5.4.1)
16. Fix a potential risk that will cause rf not work after external reset. (Resolved in ESP8266_NONOS_SDK_V1.5.4.1)
17. Add SDIO AT support. (Resolved in ESP8266_NONOS_SDK_V1.5.4.1)
18. Fix a potential bug in espconn. (Resolved in ESP8266_NONOS_SDK_V1.5.4.1)


ESP8266_NONOS_SDK_V1.5.4_16_05_20 Release Note
----------------------------------------------
Optimization:
Expand Down
5 changes: 5 additions & 0 deletions tools/sdk/include/eagle_soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@
//RTC reg {{
#define REG_RTC_BASE PERIPHS_RTC_BASEADDR

#define RTC_STORE0 (REG_RTC_BASE + 0x030)
#define RTC_STORE1 (REG_RTC_BASE + 0x034)
#define RTC_STORE2 (REG_RTC_BASE + 0x038)
#define RTC_STORE3 (REG_RTC_BASE + 0x03C)

#define RTC_GPIO_OUT (REG_RTC_BASE + 0x068)
#define RTC_GPIO_ENABLE (REG_RTC_BASE + 0x074)
#define RTC_GPIO_IN_DATA (REG_RTC_BASE + 0x08C)
Expand Down
1 change: 1 addition & 0 deletions tools/sdk/include/espnow.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum esp_now_role {
ESP_NOW_ROLE_IDLE = 0,
ESP_NOW_ROLE_CONTROLLER,
ESP_NOW_ROLE_SLAVE,
ESP_NOW_ROLE_COMBO,
ESP_NOW_ROLE_MAX,
};

Expand Down
45 changes: 45 additions & 0 deletions tools/sdk/include/simple_pair.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2015 -2018 Espressif System
*
*/

#ifndef __SIMPLE_PAIR_H__
#define __SIMPLE_PAIR_H__

typedef enum {
SP_ST_STA_FINISH = 0,
SP_ST_AP_FINISH = 0,
SP_ST_AP_RECV_NEG,
SP_ST_STA_AP_REFUSE_NEG,
/* all following is err */
SP_ST_WAIT_TIMEOUT,
SP_ST_SEND_ERROR,
SP_ST_KEY_INSTALL_ERR,
SP_ST_KEY_OVERLAP_ERR, //means the same macaddr has two different keys
SP_ST_OP_ERROR,
SP_ST_UNKNOWN_ERROR,
SP_ST_MAX,
} SP_ST_t;


typedef void (*simple_pair_status_cb_t)(u8 *sa, u8 status);

int register_simple_pair_status_cb(simple_pair_status_cb_t cb);
void unregister_simple_pair_status_cb(void);

int simple_pair_init(void);
void simple_pair_deinit(void);

int simple_pair_state_reset(void);
int simple_pair_ap_enter_announce_mode(void);
int simple_pair_sta_enter_scan_mode(void);

int simple_pair_sta_start_negotiate(void);
int simple_pair_ap_start_negotiate(void);
int simple_pair_ap_refuse_negotiate(void);

int simple_pair_set_peer_ref(u8 *peer_mac, u8 *tmp_key, u8 *ex_key);
int simple_pair_get_peer_ref(u8 *peer_mac, u8 *tmp_key, u8 *ex_key);


#endif /* __SIMPLE_PAIR_H__ */
5 changes: 5 additions & 0 deletions tools/sdk/include/user_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "queue.h"
#include "user_config.h"
#include "spi_flash.h"
#include "gpio.h"

#ifndef MAC2STR
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
Expand Down Expand Up @@ -178,6 +179,7 @@ typedef struct bss_info {
sint16 freq_offset;
sint16 freqcal_val;
uint8 *esp_mesh_ie;
uint8 simple_pair;
} bss_info_t;

typedef struct _scaninfo {
Expand Down Expand Up @@ -606,4 +608,7 @@ bool wifi_set_user_ie(bool enable, uint8 *m_oui, uint8 type, uint8 *user_ie, uin
int wifi_register_user_ie_manufacturer_recv_cb(user_ie_manufacturer_recv_cb_t cb);
void wifi_unregister_user_ie_manufacturer_recv_cb(void);

void wifi_enable_gpio_wakeup(uint32 i, GPIO_INT_TYPE intr_status);
void wifi_disable_gpio_wakeup(void);

#endif
38 changes: 38 additions & 0 deletions tools/sdk/include/wpa2_enterprise.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef __WPA2_ENTERPRISE_H__
#define __WPA2_ENTERPRISE_H__

typedef long os_time_t;

struct os_time {
os_time_t sec;
os_time_t usec;
};

typedef int (* get_time_func_t)(struct os_time *t);

int wifi_station_set_wpa2_enterprise_auth(int enable);

int wifi_station_set_enterprise_cert_key(u8 *client_cert, int client_cert_len,
u8 *private_key, int private_key_len,
u8 *private_key_passwd, int private_key_passwd_len);
void wifi_station_clear_enterprise_cert_key(void);

int wifi_station_set_enterprise_ca_cert(u8 *ca_cert, int ca_cert_len);
void wifi_station_clear_enterprise_ca_cert(void);

int wifi_station_set_enterprise_username(u8 *username, int len);
void wifi_station_clear_enterprise_username(void);

int wifi_station_set_enterprise_password(u8 *password, int len);
void wifi_station_clear_enterprise_password(void);

int wifi_station_set_enterprise_new_password(u8 *new_password, int len);
void wifi_station_clear_enterprise_new_password(void);

void wifi_station_set_enterprise_disable_time_check(bool disable);
bool wifi_station_get_enterprise_disable_time_check(void);

void wpa2_enterprise_set_user_get_time(get_time_func_t cb);


#endif /* __WPA2_ENTERPRISE_H__ */
2 changes: 2 additions & 0 deletions tools/sdk/ld/eagle.app.v6.common.ld
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ SECTIONS
*libgcc.a:_udivdi3.o(.literal .text)
*libsmartconfig.a:(.literal .text .literal.* .text.*)
*libstdc++.a:(.literal .text .literal.* .text.*)
*liblwip_gcc.a:(.literal .text .literal.* .text.*)
*liblwip_src.a:(.literal .text .literal.* .text.*)
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text .irom.text.*)
_irom0_text_end = ABSOLUTE(.);
_flash_code_end = ABSOLUTE(.);
Expand Down
1 change: 1 addition & 0 deletions tools/sdk/ld/eagle.rom.addr.v6.ld
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ PROVIDE ( SPI_read_status = 0x400043c8 );
PROVIDE ( SPI_write_status = 0x40004400 );
PROVIDE ( SPI_write_enable = 0x4000443c );
PROVIDE ( Wait_SPI_Idle = 0x4000448c );
PROVIDE ( Enable_QMode = 0x400044c0 );
PROVIDE ( SPIEraseArea = 0x40004b44 );
PROVIDE ( SPIEraseBlock = 0x400049b4 );
PROVIDE ( SPIEraseChip = 0x40004984 );
Expand Down
Binary file modified tools/sdk/lib/libat.a
Binary file not shown.
Binary file modified tools/sdk/lib/libcrypto.a
Binary file not shown.
Binary file added tools/sdk/lib/libdriver.a
Binary file not shown.
Binary file modified tools/sdk/lib/libespnow.a
Binary file not shown.
Binary file added tools/sdk/lib/libgcc.a
Binary file not shown.
Binary file modified tools/sdk/lib/libjson.a
Binary file not shown.
Binary file modified tools/sdk/lib/liblwip.a
Binary file not shown.
Binary file added tools/sdk/lib/liblwip_536.a
Binary file not shown.
Binary file modified tools/sdk/lib/liblwip_gcc.a
Binary file not shown.
Binary file modified tools/sdk/lib/libmain.a
Binary file not shown.
Binary file modified tools/sdk/lib/libmesh.a
Binary file not shown.
Binary file modified tools/sdk/lib/libnet80211.a
Binary file not shown.
Binary file modified tools/sdk/lib/libphy.a
Binary file not shown.
Binary file modified tools/sdk/lib/libpp.a
Binary file not shown.
Binary file modified tools/sdk/lib/libsmartconfig.a
Binary file not shown.
Binary file modified tools/sdk/lib/libssl.a
Binary file not shown.
Binary file modified tools/sdk/lib/libupgrade.a
Binary file not shown.
Binary file modified tools/sdk/lib/libwpa.a
Binary file not shown.
Binary file modified tools/sdk/lib/libwpa2.a
Binary file not shown.
Binary file modified tools/sdk/lib/libwps.a
Binary file not shown.
3 changes: 3 additions & 0 deletions tools/sdk/lwip/include/arch/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
#include "osapi.h"
#define EFAULT 14

#undef ICACHE_FLASH_ATTR
#define ICACHE_FLASH_ATTR

//#define LWIP_PROVIDE_ERRNO

#if (1)
Expand Down
5 changes: 5 additions & 0 deletions tools/sdk/lwip/include/lwip/app/espconn.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "lwip/dns.h"
#include "os_type.h"
#include "lwip/app/espconn_buf.h"

#if 0
#define espconn_printf(fmt, args...) os_printf(fmt,## args)
Expand Down Expand Up @@ -32,6 +33,8 @@ typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
#define ESPCONN_ARG -12 /* Illegal argument. */
#define ESPCONN_IF -14 /* Low_level error */
#define ESPCONN_ISCONN -15 /* Already connected. */
#define ESPCONN_TIME -16 /* Sync Time error */
#define ESPCONN_NODATA -17 /* No data can be read */

#define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
#define ESPCONN_RESP_TIMEOUT -29 /* ssl handshake no response*/
Expand Down Expand Up @@ -186,6 +189,8 @@ typedef struct _espconn_msg{
//***********Code for WIFI_BLOCK from upper**************
uint8 recv_hold_flag;
uint16 recv_holded_buf_Len;
//*******************************************************
ringbuf *readbuf;
}espconn_msg;

#ifndef _MDNS_INFO
Expand Down
60 changes: 60 additions & 0 deletions tools/sdk/lwip/include/lwip/app/espconn_buf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* ringbuf.h
*
* Created on: Apr 22, 2016
* Author: liuhan
*/

#ifndef _ESPCONN_BUF_H_
#define _ESPCONN_BUF_H_

/*
* ringbuffer.c
*
* Created on: Apr 22, 2016
* Author: liuhan
*/
#include "c_types.h"

#include "ets_sys.h"
#include "os_type.h"

typedef struct ringbuf_t {
uint8_t *buf;
uint8_t *head, *tail;
size_t size;
} ringbuf, *ringbuf_t;

ringbuf_t ringbuf_new(size_t capacity);

size_t ringbuf_buffer_size(const struct ringbuf_t *rb);

void ringbuf_reset(ringbuf_t rb);

void ringbuf_free(ringbuf_t *rb);

size_t ringbuf_capacity(const struct ringbuf_t *rb);

size_t ringbuf_bytes_free(const struct ringbuf_t *rb);

size_t ringbuf_bytes_used(const struct ringbuf_t *rb);

int ringbuf_is_full(const struct ringbuf_t *rb);

int ringbuf_is_empty(const struct ringbuf_t *rb);

const void* ringbuf_tail(const struct ringbuf_t *rb);

const void* ringbuf_head(const struct ringbuf_t *rb);

static uint8_t *ringbuf_nextp(ringbuf_t rb, const uint8_t *p);

size_t ringbuf_findchr(const struct ringbuf_t *rb, int c, size_t offset);

size_t ringbuf_memset(ringbuf_t dst, int c, size_t len);

void *ringbuf_memcpy_into(ringbuf_t dst, const void *src, size_t count);

void *ringbuf_memcpy_from(void *dst, ringbuf_t src, size_t count);

#endif /* RINGBUF_H_ */
Loading