Current userbin is user2.bin
This is user1.bin run @ 0x01000
add if0
compile time:Mar 19 2017 14:33:10
SDK Version 2.0.0(656edbf)
Statistics: Posted by ESP_Faye — Wed Mar 22, 2017 11:31 am
Statistics: Posted by Xuedong — Sun Mar 19, 2017 4:48 pm
Statistics: Posted by Guest — Tue Sep 15, 2015 9:31 pm
Code:
#include "ota_upgrade.h"
#include "upgrade.h"
#include "osapi.h"
#include "mem.h"
struct espconn upgrade_connection;
struct _esp_tcp upgrade_tcp;
struct upgrade_server_info upgrade_server;
static void ICACHE_FLASH_ATTR
check_upgrade_result(void *arg)
{
struct upgrade_server_info *server = arg;
if (server->upgrade_flag == true)
{
os_printf("Upgraded successfully.\r\n");
system_upgrade_reboot();
}
else
os_printf("Upgrade failed.\r\n");
}
void ICACHE_FLASH_ATTR
ota_upgrade(remot_info *phost_info)
{
char user_bin[10] = {0};
upgrade_connection.proto.tcp = &upgrade_tcp;
upgrade_connection.type = ESPCONN_TCP;
upgrade_connection.state = ESPCONN_NONE;
/* Upgrade server is the TCP client that sent "upgrade\n" to esp8266 */
os_memcpy(upgrade_tcp.remote_ip, phost_info->remote_ip, 4);
upgrade_tcp.remote_port = 80;
os_memcpy(upgrade_server.ip, phost_info->remote_ip, 4);
upgrade_server.port = 80;
upgrade_server.check_cb = check_upgrade_result;
upgrade_server.check_times = 120000;
upgrade_server.url = (uint8_t *)os_zalloc(512);
if (system_upgrade_userbin_check() == UPGRADE_FW_BIN1)
os_memcpy(user_bin, "user2.bin", 10);
else if (system_upgrade_userbin_check() == UPGRADE_FW_BIN2)
os_memcpy(user_bin, "user1.bin", 10);
os_sprintf(upgrade_server.url, "GET /ota/%s HTTP/1.0\r\nHost: "IPSTR":%d\r\nConnection: keep-alive\r\nCache-Control: no-cache\r\n\r\n",
user_bin,
IP2STR(upgrade_server.ip),
upgrade_server.port);
os_printf("OTA upgrade request:\r\n%s\r\n", upgrade_server.url);
if (!system_upgrade_start(&upgrade_server))
os_printf("Upgrade already started.\r\n");
}
Code:
esptool.py -b 512000 write_flash -ff 80m -fm qio -fs 8m 0x00000 ../bin/boot_v1.2.bin 0x01000 ../bin/upgrade/user1.1024.new.2.bin 0xfc000 ../bin/esp_init_data_default.bin 0xfe000 ../bin/blank.bin
Statistics: Posted by thuwrx10 — Tue Sep 01, 2015 7:39 pm
Statistics: Posted by ESP_Faye — Tue Jun 23, 2015 3:45 pm
Statistics: Posted by ESP_Faye — Mon Jun 15, 2015 11:05 am
Statistics: Posted by SpenZerX — Thu Jun 11, 2015 7:30 pm
Statistics: Posted by alexchang — Mon May 11, 2015 4:29 pm
Statistics: Posted by ESP_Faye — Mon May 11, 2015 1:58 pm
Statistics: Posted by alexchang — Sun May 10, 2015 2:59 pm
Statistics: Posted by alexchang — Sun May 10, 2015 2:03 pm
Statistics: Posted by ESP_Faye — Thu May 07, 2015 3:48 pm
Statistics: Posted by xyuz — Wed May 06, 2015 10:29 am
Statistics: Posted by ESP_Faye — Tue May 05, 2015 4:42 pm
Statistics: Posted by alexchang — Tue May 05, 2015 4:37 pm
Statistics: Posted by ESP_Faye — Tue May 05, 2015 4:28 pm
Statistics: Posted by alexchang — Tue May 05, 2015 4:18 pm
Statistics: Posted by ESP_Faye — Tue May 05, 2015 3:11 pm
Statistics: Posted by alexchang — Tue May 05, 2015 3:05 pm
Statistics: Posted by alexchang — Tue May 05, 2015 3:03 pm
Statistics: Posted by ESP_Faye — Tue May 05, 2015 2:59 pm
Statistics: Posted by alexchang — Tue May 05, 2015 2:39 pm
Statistics: Posted by ESP_Faye — Tue May 05, 2015 1:45 pm
Statistics: Posted by alexchang — Tue May 05, 2015 11:31 am
Statistics: Posted by alexchang — Mon May 04, 2015 11:16 pm
Statistics: Posted by alexchang — Mon May 04, 2015 6:50 pm
Statistics: Posted by ESP_Faye — Mon May 04, 2015 3:23 pm
Statistics: Posted by alexchang — Wed Apr 29, 2015 9:20 pm