Skip to content

Commit be32bb6

Browse files
committed
Update to SDK 1.4 (esp8266#908)
1 parent deb6898 commit be32bb6

26 files changed

+384
-16
lines changed

cores/esp8266/core_esp8266_main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern "C" {
3131
#include "user_interface.h"
3232
#include "cont.h"
3333
}
34-
#define LOOP_TASK_PRIORITY 0
34+
#define LOOP_TASK_PRIORITY 1
3535
#define LOOP_QUEUE_SIZE 1
3636

3737
#define OPTIMISTIC_YIELD_TIME_US 16000
@@ -80,7 +80,7 @@ extern "C" void esp_yield() {
8080
}
8181

8282
extern "C" void esp_schedule() {
83-
system_os_post(LOOP_TASK_PRIORITY, 0, 0);
83+
ets_post(LOOP_TASK_PRIORITY, 0, 0);
8484
}
8585

8686
extern "C" void __yield() {
@@ -152,7 +152,7 @@ extern "C" void user_init(void) {
152152

153153
cont_init(&g_cont);
154154

155-
system_os_task(loop_task,
155+
ets_task(loop_task,
156156
LOOP_TASK_PRIORITY, g_loop_queue,
157157
LOOP_QUEUE_SIZE);
158158

cores/esp8266/core_esp8266_phy.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ static uint8_t phy_init_data[128] =
231231
// force_freq_offset
232232
// signed, unit is 8kHz
233233
[113] = 0,
234+
235+
// rf_cal_use_flash
236+
// 0: RF init no RF CAL, using all RF CAL data in flash, it takes about 2ms for RF init
237+
// 1: RF init only do TX power control CAL, others using RF CAL data in flash , it takes about 20ms for RF init
238+
// 2: RF init no RF CAL, using all RF CAL data in flash, it takes about 2ms for RF init (same as 0?!)
239+
// 3: RF init do all RF CAL, it takes about 200ms for RF init
240+
[114] = 2
234241
};
235242

236243
extern int __real_register_chipv6_phy(uint8_t* init_data);

tools/sdk/changelog.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,83 @@
1+
esp_iot_sdk_v1.4.0_15_09_18 Release Note
2+
----------------------------------------
3+
Resolved Issues(Bugs below are eligible for Bug Bounty Program):
4+
1.Espconn may fail to download big chunk of data(FOTA).
5+
2.Invalid TCP data sent issue.
6+
3.Fatal exceptions occur when change WiFi mode in WiFi scan callback.
7+
4.WiFi compatibility problem of special network card.
8+
5.Deep sleep may appear high current under certain circumstances.
9+
10+
Optimization:
11+
1. Add a new method to check memory leaks (API : system_show_malloc).
12+
2. Add print information when exception happens.
13+
3. Resolve the problem of os_timer_disarm.
14+
4. Optimize DHCP server, add API to set up the lease time of DHCP server. More details are in the “Added APIs”.
15+
5. Add event “EVENT_STAMODE_DHCP_TIMEOUT” for the DHCP timeout handling mechanism.
16+
6. Optimize handling of the reception of data and ZWP message.
17+
7. Add new APIs to support SSL bidirectional authentication. More details are in the “Added APIs”.
18+
8. Add new APIs to set up SSL certificates and encryption keys. API espconn_secure_set_default_certificate and espconn_secure_set_default_private_key should be called to set SSL certificate and secure key, if ESP8266 runs as SSL server. More details are in the “Added APIs”.
19+
9. Optimize the process of FOTA (firmware upgrade through WiFi.
20+
10. Optimize mDNS, and resolve the problem that in certain case the ESP8266 softAP can not work in the sta+AP mode.
21+
11. Release mesh as a lib in the esp_iot_sdk, and do not provide SDK of the mesh version any more.
22+
12. Optimize mesh’s handling of UDP packets.
23+
13. Optimize checking of the validity of the mesh API’s parameters.
24+
14. Add an API to set up the largest hop of mesh. For detailed information, go to mesh instructions.
25+
15. Optimize the process of powering up and booting to shorten booting time by 20 ms.
26+
16. Optimize the function of automatic frequency offset calibration.
27+
17. Optimize the function of sniffer.
28+
18. Strengthen reliability of the checking of beacon timeout.
29+
19.Optimize Wi-Fi event mechanism, and add event “ EVENT_SOFTAPMODE_PROBEREQRECVED”, and reason for a failed connection.
30+
20. Optimize Wi-Fi callback function and strengthen reliability of the software.
31+
21. Add the function of data transferring between stations in the soft-AP mode.
32+
22. Update SmartConfig to the version of 2.5.1.
33+
34+
23.Update esp_init_data_default.bin. Please use the newest esp_init_data_default.bin when burning.
35+
36+
24.Modify the espconn pointer in the receive callback of UDP. Parameters remote_ip and remote_port in it are the remote IP and port set by espconn_create. If users want to obtain IP and ports of the current sender, please call espconn_get_connection_info to get relevant information.
37+
38+
39+
Added APIs:
40+
1.System API
41+
system_show_malloc : for checking memory leak, to print the memory usage.
42+
2.DHCP server lease time related APIs
43+
wifi_softap_set_dhcps_lease_time:set ESP8266 softAP DHCP server lease time.
44+
wifi_softap_get_dhcps_lease_time:check ESP8266 softAP DHCP server lease time.
45+
wifi_softap_reset_dhcps_lease_time:reset ESP8266 softAP DHCP server lease time which is 120 minutes by default.
46+
3.wifi_station_dhcpc_set_maxtry:set the maximum number that ESP8266 station DHCP client will try to reconnect to the AP.
47+
4.Force sleep APIs
48+
wifi_fpm_open:enable force sleep function.
49+
wifi_fpm_close:disable force sleep function.
50+
wifi_fpm_do_sleep:force ESP8266 enter sleep mode.
51+
wifi_fpm_do_wakeup:wake ESP8266 up from force sleep.
52+
wifi_fpm_set_sleep_type:set sleep type of force sleep function.
53+
wifi_fpm_get_sleep_type:get sleep type of force sleep function.
54+
5.Send packet freedom APIs (to send user-define 802.11 packets)
55+
wifi_register_send_pkt_freedom_cb:register a callback for sending user-define 802.11 packets.
56+
wifi_unregister_send_pkt_freedom_cb:unregister the callback for sending user-define 802.11 packets.
57+
wifi_send_pkt_freedom:send user-define 802.11 packet.
58+
6.RFID LOCP APIs
59+
wifi_rfid_locp_recv_open:enable RFID LOCP to receive WDS packets.
60+
wifi_rfid_locp_recv_close:disable RFID LOCP.
61+
wifi_register_rfid_locp_recv_cb:register a callback of receiving WDS packets.
62+
wifi_unregister_rfid_locp_recv_cb:unregister the callback of receiving WDS packets.
63+
7.Rate Control APIs
64+
wifi_set_user_fixed_rate:set the fixed rate and mask of sending data from ESP8266
65+
wifi_get_user_fixed_rate:check the fixed rate and mask of ESP8266
66+
wifi_set_user_sup_rate:set the rate range supported by ESP8266 to limit the rate of sending packets from other devices.
67+
wifi_set_user_rate_limit:limit the rate of sending data from ESP8266.
68+
wifi_set_user_limit_rate_mask:set the interfaces of ESP8266 whose rate of sending packets is limited by wifi_set_user_rate_limit.
69+
wifi_get_user_limit_rate_mask:get the interfaces of ESP8266 whose rate of sending packets is limited by wifi_set_user_rate_limit.
70+
8.Espconn APIs
71+
espconn_sendto:send UDP data.
72+
espconn_secure_cert_req_enable:enable certificates verification function when ESP8266 runs as SSL client.
73+
espconn_secure_cert_req_disable:disable certificates verification function when ESP8266 runs as SSL client.
74+
espconn_secure_set_default_certificate:set the certificate when ESP8266 runs as SSL server.
75+
espconn_secure_set_default_private_key:set the encryption key when ESP8266 runs as SSL server.
76+
9.SmartConfig API
77+
smartconfig_set_type: set the protocol type of SmartConfig.
78+
79+
80+
181
esp_iot_sdk_v1.3.0_15_08_10_p1 Release Note
282
----------------------------------------
383

tools/sdk/include/espconn.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
1414
#define ESPCONN_TIMEOUT -3 /* Timeout. */
1515
#define ESPCONN_RTE -4 /* Routing problem. */
1616
#define ESPCONN_INPROGRESS -5 /* Operation in progress */
17+
#define ESPCONN_MAXNUM -7 /* Total number exceeds the set maximum*/
1718

1819
#define ESPCONN_ABRT -8 /* Connection aborted. */
1920
#define ESPCONN_RST -9 /* Connection reset. */
2021
#define ESPCONN_CLSD -10 /* Connection closed. */
2122
#define ESPCONN_CONN -11 /* Not connected. */
2223

2324
#define ESPCONN_ARG -12 /* Illegal argument. */
25+
#define ESPCONN_IF -14 /* UDP send error */
2426
#define ESPCONN_ISCONN -15 /* Already connected. */
2527

2628
#define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
@@ -289,6 +291,17 @@ sint8 espconn_send(struct espconn *espconn, uint8 *psent, uint16 length);
289291

290292
sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length);
291293

294+
/******************************************************************************
295+
* FunctionName : espconn_sendto
296+
* Description : send data for UDP
297+
* Parameters : espconn -- espconn to set for UDP
298+
* psent -- data to send
299+
* length -- length of data to send
300+
* Returns : error
301+
*******************************************************************************/
302+
303+
sint16 espconn_sendto(struct espconn *espconn, uint8 *psent, uint16 length);
304+
292305
/******************************************************************************
293306
* FunctionName : espconn_regist_connectcb
294307
* Description : used to specify the function that should be called when
@@ -502,6 +515,51 @@ bool espconn_secure_ca_enable(uint8 level, uint8 flash_sector );
502515

503516
bool espconn_secure_ca_disable(uint8 level);
504517

518+
519+
/******************************************************************************
520+
* FunctionName : espconn_secure_cert_req_enable
521+
* Description : enable the client certificate authenticate and set the flash sector
522+
* as client or server
523+
* Parameters : level -- set for client or server
524+
* 1: client,2:server,3:client and server
525+
* flash_sector -- flash sector for save certificate
526+
* Returns : result true or false
527+
*******************************************************************************/
528+
529+
bool espconn_secure_cert_req_enable(uint8 level, uint8 flash_sector );
530+
531+
/******************************************************************************
532+
* FunctionName : espconn_secure_ca_disable
533+
* Description : disable the client certificate authenticate as client or server
534+
* Parameters : level -- set for client or server
535+
* 1: client,2:server,3:client and server
536+
* Returns : result true or false
537+
*******************************************************************************/
538+
539+
bool espconn_secure_cert_req_disable(uint8 level);
540+
541+
/******************************************************************************
542+
* FunctionName : espconn_secure_set_default_certificate
543+
* Description : Load the certificates in memory depending on compile-time
544+
* and user options.
545+
* Parameters : certificate -- Load the certificate
546+
* length -- Load the certificate length
547+
* Returns : result true or false
548+
*******************************************************************************/
549+
550+
bool espconn_secure_set_default_certificate(const uint8* certificate, uint16 length);
551+
552+
/******************************************************************************
553+
* FunctionName : espconn_secure_set_default_private_key
554+
* Description : Load the key in memory depending on compile-time
555+
* and user options.
556+
* Parameters : private_key -- Load the key
557+
* length -- Load the key length
558+
* Returns : result true or false
559+
*******************************************************************************/
560+
561+
bool espconn_secure_set_default_private_key(const uint8* private_key, uint16 length);
562+
505563
/******************************************************************************
506564
* FunctionName : espconn_secure_accept
507565
* Description : The function given as the listen

tools/sdk/include/ets_sys.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,9 @@ inline uint32_t ETS_INTR_PENDING(void)
145145
ETS_INTR_DISABLE(ETS_SLC_INUM)
146146

147147

148-
void *pvPortMalloc(size_t xWantedSize) __attribute__((malloc, alloc_size(1)));
149-
void *pvPortRealloc(void* ptr, size_t xWantedSize) __attribute__((alloc_size(2)));
150-
void pvPortFree(void *ptr);
151-
void *vPortMalloc(size_t xWantedSize) __attribute__((malloc, alloc_size(1)));
152-
void vPortFree(void *ptr);
148+
void *pvPortMalloc(size_t xWantedSize, const char* file, int line) __attribute__((malloc, alloc_size(1)));
149+
void *pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line) __attribute__((alloc_size(2)));
150+
void vPortFree(void *ptr, const char* file, int line);
153151
void *ets_memcpy(void *dest, const void *src, size_t n);
154152
void *ets_memset(void *s, int c, size_t n);
155153
void ets_timer_arm_new(ETSTimer *a, int b, int c, int isMstimer);
@@ -174,5 +172,8 @@ void ets_intr_lock();
174172
void ets_intr_unlock();
175173
int ets_vsnprintf(char * s, size_t n, const char * format, va_list arg) __attribute__ ((format (printf, 3, 0)));
176174
int ets_vprintf(const char * format, va_list arg) __attribute__ ((format (printf, 1, 0)));
175+
bool ets_task(ETSTask task, uint8 prio, ETSEvent *queue, uint8 qlen);
176+
bool ets_post(uint8 prio, ETSSignal sig, ETSParam par);
177+
177178

178179
#endif /* _ETS_SYS_H */

tools/sdk/include/mem.h

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
#ifndef __MEM_H__
22
#define __MEM_H__
33

4-
//void *pvPortMalloc( size_t xWantedSize );
5-
//void vPortFree( void *pv );
6-
//void *pvPortZalloc(size_t size);
4+
#ifndef MEMLEAK_DEBUG
5+
#define os_free(s) vPortFree(s, "", 0)
6+
#define os_malloc(s) pvPortMalloc(s, "", 0)
7+
#define os_calloc(s) pvPortCalloc(s, "", 0);
8+
#define os_realloc(p, s) pvPortRealloc(p, s, "", 0)
9+
#define os_zalloc(s) pvPortZalloc(s, "", 0)
10+
#else
11+
#define os_free(s) \
12+
do{\
13+
const char *file = mem_debug_file;\
14+
vPortFree(s, file, __LINE__);\
15+
}while(0)
716

8-
#define os_malloc pvPortMalloc
9-
#define os_free vPortFree
10-
#define os_zalloc pvPortZalloc
11-
#define os_realloc pvPortRealloc
17+
#define os_malloc(s) ({const char *file = mem_debug_file; pvPortMalloc(s, file, __LINE__);})
1218

19+
#define os_calloc(s) ({const char *file = mem_debug_file; pvPortCalloc(s, file, __LINE__);})
20+
21+
#define os_realloc(p, s) ({const char *file = mem_debug_file; pvPortRealloc(p, s, file, __LINE__);})
22+
23+
#define os_zalloc(s) ({const char *file = mem_debug_file; pvPortZalloc(s, file, __LINE__);})
1324
#endif
25+
26+
#endif
27+

tools/sdk/include/mesh.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#ifndef __LWIP_API_MESH_H__
2+
#define __LWIP_API_MESH_H__
3+
4+
#include "ip_addr.h"
5+
#include "user_interface.h"
6+
#include "espconn.h"
7+
8+
typedef void (* espconn_mesh_callback)();
9+
10+
enum mesh_type {
11+
MESH_CLOSE = 0,
12+
MESH_LOCAL,
13+
MESH_ONLINE,
14+
MESH_NONE = 0xFF
15+
};
16+
17+
enum mesh_status {
18+
MESH_DISABLE = 0,
19+
MESH_WIFI_CONN,
20+
MESH_NET_CONN,
21+
MESH_LOCAL_AVAIL,
22+
MESH_ONLINE_AVAIL
23+
};
24+
25+
enum mesh_node_type {
26+
MESH_NODE_PARENT = 0,
27+
MESH_NODE_CHILD,
28+
MESH_NODE_ALL
29+
};
30+
31+
bool espconn_mesh_local_addr(struct ip_addr *ip);
32+
bool espconn_mesh_get_node_info(enum mesh_node_type type,
33+
uint8_t **info, uint8_t *count);
34+
bool espconn_mesh_get_router(struct station_config *router);
35+
bool espconn_mesh_set_router(struct station_config *router);
36+
bool espconn_mesh_encrypt_init(AUTH_MODE mode, uint8_t *passwd, uint8_t passwd_len);
37+
bool espconn_mesh_set_ssid_prefix(uint8_t *prefix, uint8_t prefix_len);
38+
bool espconn_mesh_set_max_hops(uint8_t max_hops);
39+
40+
char * espconn_json_find_section(const char *pbuf, u16 len, const char *section);
41+
42+
sint8 espconn_mesh_connect(struct espconn *usr_esp);
43+
sint8 espconn_mesh_disconnect(struct espconn *usr_esp);
44+
sint8 espconn_mesh_get_status();
45+
sint8 espconn_mesh_sent(struct espconn *usr_esp, uint8 *pdata, uint16 len);
46+
47+
uint8 espconn_mesh_get_max_hops();
48+
uint8 espconn_mesh_layer(struct ip_addr *ip);
49+
uint32_t user_json_get_value(const char *pbuffer, uint16_t buf_len,
50+
const uint8_t *json_key);
51+
52+
void espconn_mesh_enable(espconn_mesh_callback enable_cb, enum mesh_type type);
53+
void espconn_mesh_disable(espconn_mesh_callback disable_cb);
54+
void espconn_mesh_init();
55+
void espconn_mesh_init_group_list(uint8_t *dev_mac, uint16_t dev_count);
56+
void espconn_mesh_set_dev_type(uint8_t dev_type);
57+
void espconn_mesh_setup_timer(os_timer_t *timer, uint32_t time,
58+
os_timer_func_t cb, void *arg, bool repeat);
59+
60+
#endif
61+

tools/sdk/include/smartconfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ typedef enum {
1717
typedef enum {
1818
SC_TYPE_ESPTOUCH = 0,
1919
SC_TYPE_AIRKISS,
20+
SC_TYPE_ESPTOUCH_AIRKISS,
2021
} sc_type;
2122

2223
typedef void (*sc_callback_t)(sc_status status, void *pdata);
@@ -25,5 +26,6 @@ const char *smartconfig_get_version(void);
2526
bool smartconfig_start(sc_callback_t cb, ...);
2627
bool smartconfig_stop(void);
2728
bool esptouch_set_timeout(uint8 time_s); //15s~255s, offset:45s
29+
bool smartconfig_set_type(sc_type type);
2830

2931
#endif

0 commit comments

Comments
 (0)