我正在研究esp8266。我已经构建并刷新了esphttpd webserver。 然后我添加了一段代码来在esp8266上启动mdns:
static void ICACHE_FLASH_ATTR mdns()
{
struct ip_info ipConfig;
struct mdns_info *info = (struct mdns_info *)os_zalloc(sizeof(struct mdns_info));
wifi_get_ip_info(STATION_IF, &ipConfig);
if (!(wifi_station_get_connect_status() == STATION_GOT_IP && ipConfig.ip.addr != 0)) {
os_printf("Cannot read station configuration\n");
return;
}
info->host_name = (char *) "lienka";
info->ipAddr = ipConfig.ip.addr; //ESP8266 station IP
info->server_name = "module01";
info->server_port = 80;
info->txt_data[0] = "version = now";
info->txt_data[1] = "user1 = data1";
info->txt_data[2] = "user2 = data2";
info->txt_data[3] = "vendor = me";
espconn_mdns_init(info);
//espconn_mdns_server_register();
espconn_mdns_enable();
}
static void ICACHE_FLASH_ATTR testTimerCb(void *arg) {
mdns();
}
在user_init函数中添加了以下代码:
os_timer_disarm(&testTimer);
os_timer_setfn(&testTimer, testTimerCb, NULL);
os_timer_arm(&testTimer, 10000, 0);
问题是,由于我添加了mdns功能,因此esp8266每分钟重新启动一次。注释掉user_init函数中的这三行代码后,esp8266会自行重启。
ESP重新启动时记录:
3fff0e50 already freed
3fff0e50 already freed
Fatal exception 0(IllegalInstructionCause):
epc1=0x40107cba, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
ets Jan 8 2013,rst cause:1, boot mode:(3,0)
load 0x40100000, len 32264, room 16
tail 8
chksum 0x13
load 0x3ffe8000, len 2316, room 0
tail 12
chksum 0x9f
ho 0 tail 12 room 4
load 0x3ffe8910, len 6456, room 12
tail 12
chksum 0x30
csum 0x30
rl⸮⸮rl⸮⸮Httpd init
有人可以帮助我,我该怎么办?