Skip to content

Commit dba89f9

Browse files
Espressif Systemswujiangang
Espressif Systems
authored andcommitted
NEW VERSION: 1.4.0
1. update boot.bin to v1.5; 2. phy version to 762; 3. add wifi_station_set/get_hostname api; 4. optimize net80211; 5. optimize ssl; 6. optimize ota; 7. optimize dhcp client; 8. update smartconfig to version 2.5.3; 9. support gpio wakeup; 10.enable IGMP in lwip; 11.some modify due to phy update; 12.add espconn_init in espconn.h; 13.update cjson/freertos/ssl; 14.add lwip/nopoll source code; 15.add libairkiss.a/airkiss.h, update smart_config; 16.update esp_init_data_default.bin; 17.irom0 too large, start addr change to 0x20000; 18.some modifications for system stability; 19.many other optimization;
1 parent 5045930 commit dba89f9

File tree

166 files changed

+70223
-1784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+70223
-1784
lines changed

Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ $$(IMAGEODIR)/$(1).out: $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1)) $$(DEPENDS_
235235
endef
236236

237237
$(BINODIR)/%.bin: $(IMAGEODIR)/%.out
238+
@mkdir -p $(BIN_PATH)
238239
@mkdir -p $(BINODIR)
239240

240241
ifeq ($(APP), 0)
@@ -267,7 +268,7 @@ ifeq ($(app), 0)
267268
@echo "No boot needed."
268269
@echo "Generate eagle.flash.bin and eagle.irom0text.bin successully in BIN_PATH"
269270
@echo "eagle.flash.bin-------->0x00000"
270-
@echo "eagle.irom0text.bin---->0x40000"
271+
@echo "eagle.irom0text.bin---->0x20000"
271272
else
272273
@echo "BIN_PATH: $(BIN_PATH)/upgrade"
273274
@echo ""
@@ -403,3 +404,4 @@ INCLUDES += -I $(SDK_PATH)/include/lwip/ipv6
403404
INCLUDES += -I $(SDK_PATH)/include/nopoll
404405
INCLUDES += -I $(SDK_PATH)/include/spiffs
405406
INCLUDES += -I $(SDK_PATH)/include/ssl
407+
INCLUDES += -I $(SDK_PATH)/include/json

bin/boot_v1.4(b1).bin

-2.69 KB
Binary file not shown.

bin/boot_v1.5.bin

3.16 KB
Binary file not shown.

bin/esp_init_data_default.bin

0 Bytes
Binary file not shown.

examples/project_template/Makefile

+17-6
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,28 @@ LINKFLAGS_eagle.app.v6 = \
5858
-u call_user_start \
5959
-Wl,-static \
6060
-Wl,--start-group \
61-
-lminic \
61+
-lcirom \
62+
-lcrypto \
63+
-lespconn \
64+
-lespnow \
65+
-lfreertos \
6266
-lgcc \
6367
-lhal \
68+
-ljson \
69+
-llwip \
70+
-lmain \
71+
-lmesh \
72+
-lmirom \
73+
-lnet80211 \
74+
-lnopoll \
6475
-lphy \
6576
-lpp \
66-
-lnet80211 \
77+
-lpwm \
78+
-lsmartconfig \
79+
-lspiffs \
80+
-lssl \
6781
-lwpa \
68-
-lcrypto \
69-
-lmain \
70-
-lfreertos \
71-
-llwip \
82+
-lwps \
7283
$(DEP_LIBS_eagle.app.v6) \
7384
-Wl,--end-group
7485

examples/project_template/gen_misc.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export SDK_PATH=~/esp_iot_sdk_freertos
88
export BIN_PATH=~/esp8266_bin
99
!
1010

11-
export SDK_PATH=
12-
export BIN_PATH=
11+
export SDK_PATH=$SDK_PATH
12+
export BIN_PATH=$BIN_PATH
1313

1414
echo "gen_misc.sh version 20150911"
1515
echo ""

examples/smart_config/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ LINKFLAGS_eagle.app.v6 = \
6767
-lmain \
6868
-lfreertos \
6969
-llwip \
70+
-lespconn\
7071
-lsmartconfig \
72+
-lairkiss\
7173
$(DEP_LIBS_eagle.app.v6) \
7274
-Wl,--end-group
7375

examples/smart_config/airkiss.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
if you want to use AIRKISS2.0 LAN discovery, should include airkiss.h and include libairkiss.a in makefile.
2+
3+
you can follow the steps below to achieve the function of LAN discovery.
4+
1.scan the two-dimension code in your wechat.
5+
2.running this smartconfig example.
6+
3.wait device connect to AP and LAN discovery.
7+
8+
More detailed introduction refer to wechat.
Binary file not shown.

examples/smart_config/user/user_main.c

+122-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,127 @@
3030
#include "lwip/sockets.h"
3131
#include "lwip/dns.h"
3232
#include "lwip/netdb.h"
33+
#include "espressif/espconn.h"
34+
#include "espressif/airkiss.h"
3335

3436
#define server_ip "192.168.101.142"
3537
#define server_port 9669
3638

39+
40+
#define DEVICE_TYPE "gh_9e2cff3dfa51" //wechat public number
41+
#define DEVICE_ID "122475" //model ID
42+
43+
#define DEFAULT_LAN_PORT 12476
44+
45+
LOCAL esp_udp ssdp_udp;
46+
LOCAL struct espconn pssdpudpconn;
47+
LOCAL os_timer_t ssdp_time_serv;
48+
49+
uint8 lan_buf[200];
50+
uint16 lan_buf_len;
51+
uint8 udp_sent_cnt = 0;
52+
53+
const airkiss_config_t akconf =
54+
{
55+
(airkiss_memset_fn)&memset,
56+
(airkiss_memcpy_fn)&memcpy,
57+
(airkiss_memcmp_fn)&memcmp,
58+
0,
59+
};
60+
61+
LOCAL void ICACHE_FLASH_ATTR
62+
airkiss_wifilan_time_callback(void)
63+
{
64+
uint16 i;
65+
airkiss_lan_ret_t ret;
66+
67+
if ((udp_sent_cnt++) >30) {
68+
udp_sent_cnt = 0;
69+
os_timer_disarm(&ssdp_time_serv);//s
70+
//return;
71+
}
72+
73+
ssdp_udp.remote_port = DEFAULT_LAN_PORT;
74+
ssdp_udp.remote_ip[0] = 255;
75+
ssdp_udp.remote_ip[1] = 255;
76+
ssdp_udp.remote_ip[2] = 255;
77+
ssdp_udp.remote_ip[3] = 255;
78+
lan_buf_len = sizeof(lan_buf);
79+
ret = airkiss_lan_pack(AIRKISS_LAN_SSDP_NOTIFY_CMD,
80+
DEVICE_TYPE, DEVICE_ID, 0, 0, lan_buf, &lan_buf_len, &akconf);
81+
if (ret != AIRKISS_LAN_PAKE_READY) {
82+
os_printf("Pack lan packet error!");
83+
return;
84+
}
85+
86+
ret = espconn_sendto(&pssdpudpconn, lan_buf, lan_buf_len);
87+
if (ret != 0) {
88+
os_printf("UDP send error!");
89+
}
90+
os_printf("Finish send notify!\n");
91+
}
92+
93+
LOCAL void ICACHE_FLASH_ATTR
94+
airkiss_wifilan_recv_callbk(void *arg, char *pdata, unsigned short len)
95+
{
96+
uint16 i;
97+
remot_info* pcon_info = NULL;
98+
99+
airkiss_lan_ret_t ret = airkiss_lan_recv(pdata, len, &akconf);
100+
airkiss_lan_ret_t packret;
101+
102+
switch (ret){
103+
case AIRKISS_LAN_SSDP_REQ:
104+
espconn_get_connection_info(&pssdpudpconn, &pcon_info, 0);
105+
os_printf("remote ip: %d.%d.%d.%d \r\n",pcon_info->remote_ip[0],pcon_info->remote_ip[1],
106+
pcon_info->remote_ip[2],pcon_info->remote_ip[3]);
107+
os_printf("remote port: %d \r\n",pcon_info->remote_port);
108+
109+
pssdpudpconn.proto.udp->remote_port = pcon_info->remote_port;
110+
memcpy(pssdpudpconn.proto.udp->remote_ip,pcon_info->remote_ip,4);
111+
ssdp_udp.remote_port = DEFAULT_LAN_PORT;
112+
113+
lan_buf_len = sizeof(lan_buf);
114+
packret = airkiss_lan_pack(AIRKISS_LAN_SSDP_RESP_CMD,
115+
DEVICE_TYPE, DEVICE_ID, 0, 0, lan_buf, &lan_buf_len, &akconf);
116+
117+
if (packret != AIRKISS_LAN_PAKE_READY) {
118+
os_printf("Pack lan packet error!");
119+
return;
120+
}
121+
122+
os_printf("\r\n\r\n");
123+
for (i=0; i<lan_buf_len; i++)
124+
os_printf("%c",lan_buf[i]);
125+
os_printf("\r\n\r\n");
126+
127+
packret = espconn_sendto(&pssdpudpconn, lan_buf, lan_buf_len);
128+
if (packret != 0) {
129+
os_printf("LAN UDP Send err!");
130+
}
131+
132+
break;
133+
default:
134+
os_printf("Pack is not ssdq req!%d\r\n",ret);
135+
break;
136+
}
137+
}
138+
139+
void ICACHE_FLASH_ATTR
140+
airkiss_start_discover(void)
141+
{
142+
ssdp_udp.local_port = DEFAULT_LAN_PORT;
143+
pssdpudpconn.type = ESPCONN_UDP;
144+
pssdpudpconn.proto.udp = &(ssdp_udp);
145+
espconn_regist_recvcb(&pssdpudpconn, airkiss_wifilan_recv_callbk);
146+
espconn_create(&pssdpudpconn);
147+
148+
os_timer_disarm(&ssdp_time_serv);
149+
os_timer_setfn(&ssdp_time_serv, (os_timer_func_t *)airkiss_wifilan_time_callback, NULL);
150+
os_timer_arm(&ssdp_time_serv, 1000, 1);//1s
151+
}
152+
153+
37154
void ICACHE_FLASH_ATTR
38155
smartconfig_done(sc_status status, void *pdata)
39156
{
@@ -64,11 +181,15 @@ smartconfig_done(sc_status status, void *pdata)
64181
case SC_STATUS_LINK_OVER:
65182
printf("SC_STATUS_LINK_OVER\n");
66183
if (pdata != NULL) {
184+
//SC_TYPE_ESPTOUCH
67185
uint8 phone_ip[4] = {0};
68186

69187
memcpy(phone_ip, (uint8*)pdata, 4);
70188
printf("Phone ip: %d.%d.%d.%d\n",phone_ip[0],phone_ip[1],phone_ip[2],phone_ip[3]);
71-
}
189+
} else {
190+
//SC_TYPE_AIRKISS - support airkiss v2.0
191+
airkiss_start_discover();
192+
}
72193
smartconfig_stop();
73194
break;
74195
}

include/espressif/airkiss.h

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/*
2+
* airkiss.h
3+
*
4+
* Created on: 2015-1-26
5+
* Author: peterfan
6+
*/
7+
8+
#ifndef AIRKISS_H_
9+
#define AIRKISS_H_
10+
11+
#ifdef __cplusplus
12+
extern "C" {
13+
#endif
14+
15+
16+
typedef void* (*airkiss_memset_fn) (void* ptr, int value, unsigned int num);
17+
typedef void* (*airkiss_memcpy_fn) (void* dst, const void* src, unsigned int num);
18+
typedef int (*airkiss_memcmp_fn) (const void* ptr1, const void* ptr2, unsigned int num);
19+
typedef int (*airkiss_printf_fn) (const char* format, ...);
20+
21+
22+
23+
typedef struct
24+
{
25+
airkiss_memset_fn memset;
26+
airkiss_memcpy_fn memcpy;
27+
airkiss_memcmp_fn memcmp;
28+
airkiss_printf_fn printf;
29+
30+
} airkiss_config_t;
31+
32+
/**
33+
* @brief Get airkiss lib version.
34+
*
35+
* @attention The lenth of version is unknown
36+
*
37+
* @param null.
38+
*
39+
* @return const char*
40+
*/
41+
42+
const char* airkiss_version(void);
43+
44+
45+
typedef enum
46+
{
47+
/* the length of the data buffer is lack*/
48+
AIRKISS_LAN_ERR_OVERFLOW = -5,
49+
50+
/* Do not support the type of instruction */
51+
AIRKISS_LAN_ERR_CMD = -4,
52+
53+
/* Error reading data package */
54+
AIRKISS_LAN_ERR_PAKE = -3,
55+
56+
/* Error function passing parameters */
57+
AIRKISS_LAN_ERR_PARA = -2,
58+
59+
/* Packet data error */
60+
AIRKISS_LAN_ERR_PKG = -1,
61+
62+
/* Message format is correct */
63+
AIRKISS_LAN_CONTINUE = 0,
64+
65+
/* Find equipment request packet is received */
66+
AIRKISS_LAN_SSDP_REQ = 1,
67+
68+
/* Packet packaging complete */
69+
AIRKISS_LAN_PAKE_READY = 2
70+
71+
72+
} airkiss_lan_ret_t;
73+
74+
75+
typedef enum
76+
{
77+
AIRKISS_LAN_SSDP_REQ_CMD = 0x1,
78+
AIRKISS_LAN_SSDP_RESP_CMD = 0x1001,
79+
AIRKISS_LAN_SSDP_NOTIFY_CMD = 0x1002
80+
} airkiss_lan_cmdid_t;
81+
82+
/**
83+
* @brief Receive UDP packet and input this API for analyzing.
84+
*
85+
* @attention null.
86+
*
87+
* @param const void* body : The start of the UDP message body data pointer.
88+
* @param unsigned short length : the effective length of data.
89+
* @param const airkiss_config_t* config : input struct airkiss_config_t
90+
*
91+
* @return >=0 : succeed (reference airkiss_lan_ret_t)
92+
* @return <0 : error code (reference airkiss_lan_ret_t)
93+
*/
94+
95+
int airkiss_lan_recv(const void* body, unsigned short length, const airkiss_config_t* config);
96+
97+
98+
/**
99+
* @brief Packaging the UDP packet to send.
100+
*
101+
* @attention null.
102+
*
103+
* @param airkiss_lan_cmdid_t ak_lan_cmdid : The packet type.
104+
* @param void* appid : Vendor's Wechat public number id.
105+
* @param void* deviceid : device model id.
106+
* @param void* _datain : the data to be sent.
107+
* @param unsigned short inlength : the lenth of data to be sent.
108+
* @param void* _dataout : Data buffer addr.
109+
* @param unsigned short* outlength : the size of data buffer.
110+
* @param const airkiss_config_t* config : input struct airkiss_config_t
111+
*
112+
* @return >=0 : succeed (reference airkiss_lan_ret_t)
113+
* @return <0 : error code (reference airkiss_lan_ret_t)
114+
*/
115+
116+
int airkiss_lan_pack(airkiss_lan_cmdid_t ak_lan_cmdid, void* appid, void* deviceid, void* _datain, unsigned short inlength, void* _dataout, unsigned short* outlength, const airkiss_config_t* config);
117+
118+
#ifdef __cplusplus
119+
}
120+
#endif
121+
122+
#endif /* AIRKISS_H_ */

include/espressif/esp8266/eagle_soc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
//}}
8686

8787
//DPORT{{
88-
#define HOST_INF_SEL (0x28)
88+
#define HOST_INF_SEL (PERIPHS_DPORT_BASEADDR + 0x28)
8989
#define DPORT_LINK_DEVICE_SEL 0x000000FF
9090
#define DPORT_LINK_DEVICE_SEL_S 8
9191
#define DPORT_PERI_IO_SWAP 0x000000FF

include/espressif/esp8266/spi_register.h

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@
184184
#define SPI_W14(i) (REG_SPI_BASE(i) + 0x78)
185185
#define SPI_W15(i) (REG_SPI_BASE(i) + 0x7C)
186186

187+
#define SPI_EXT2(i) (REG_SPI_BASE(i) + 0xF8)
188+
187189
#define SPI_EXT3(i) (REG_SPI_BASE(i) + 0xFC)
188190
#define SPI_INT_HOLD_ENA 0x00000003
189191
#define SPI_INT_HOLD_ENA_S 0

include/espressif/espconn.h

+11
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ enum {
183183
ESPCONN_MAX
184184
};
185185

186+
/**
187+
* @brief espconn initialization.
188+
*
189+
* @attention Please call this API in user_init, if you need to use espconn functions.
190+
*
191+
* @param null
192+
*
193+
* @return null
194+
*/
195+
void espconn_init(void);
196+
186197
/**
187198
* @brief Connect to a TCP server (ESP8266 acting as TCP client).
188199
*

0 commit comments

Comments
 (0)