SDK从1.3.0, 升级到1.5.2版本后,flash “user param”区 写出错?
SDK从1.3.0, 升级到1.5.2版本后,flash “user param”区 写出错?
Postby Goland » Tue Feb 23, 2016 8:05 pm
我的flash为 1024kbyte,支持 OTA,
以前程序在sdk1.3.0版本时,运行正常,但升级到 1.5.2后,运行异常。
现象为: 开机正常运行,但写flash后,重启,异常,log如后。
查好像是 写flash ”user param“区出错。我的一些参数 想保存在 16kb的 ”user param“区:
struct device_param {
uint16 a;
uint16 b;
uint16 c;
uint8 pad[2];//填充, 4字节对齐
};
#define USER_PARAM_START_ADDR (0x7C)
int ret = spi_flash_write(USER_PARAM_START_ADDR * SPI_FLASH_SEC_SIZE, (uint32 *) p, sizeof(struct device_param));
查ret为0,
写完后重启,就出现异常。
请帮助,谢谢!
------------------------------------------------------------------------------------------
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79
2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : DOUT
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000
Fatal exception (28):
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000054, depc=0x00000000
Fatal exception (28):
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000054, depc=0x00000000
Fatal exception (28):
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000054, depc=0x00000000
。。。
。。。
以前程序在sdk1.3.0版本时,运行正常,但升级到 1.5.2后,运行异常。
现象为: 开机正常运行,但写flash后,重启,异常,log如后。
查好像是 写flash ”user param“区出错。我的一些参数 想保存在 16kb的 ”user param“区:
struct device_param {
uint16 a;
uint16 b;
uint16 c;
uint8 pad[2];//填充, 4字节对齐
};
#define USER_PARAM_START_ADDR (0x7C)
int ret = spi_flash_write(USER_PARAM_START_ADDR * SPI_FLASH_SEC_SIZE, (uint32 *) p, sizeof(struct device_param));
查ret为0,
写完后重启,就出现异常。
请帮助,谢谢!
------------------------------------------------------------------------------------------
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79
2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : DOUT
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000
Fatal exception (28):
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000054, depc=0x00000000
Fatal exception (28):
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000054, depc=0x00000000
Fatal exception (28):
epc1=0x40001800, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000054, depc=0x00000000
。。。
。。。
Re: SDK从1.3.0, 升级到1.5.2版本后,flash “user param”区 写出错?
Postby Goland » Fri Mar 11, 2016 4:44 pm
您好,如上,加入业务逻辑后,跟踪了一下代码,发现在user_webserver.c中, webserver_recv()函数里, POST,
进入 1573行: “ } else if (os_strcmp(pURL_Frame->pFilename, "wifi") == 0) { ”
......
json_parse(&js, pParseBuffer);
在这行之前 调用 system_restart(), 重启正常,
在这行之后 调用 system_restart(), 打印乱码,重启异常,
......
会不会是在libjson.a里 ram 不够引起的问题?(同样的代码在sdk1.3.0版本运行正常)
在 json_parse() 前 用 system_print_meminfo()打印的 信息如下:
data : 0x3ffe8000 ~ 0x3ffe8b54, len: 2900
rodata: 0x3ffe8b60 ~ 0x3ffe9888, len: 3368
bss : 0x3ffe9888 ~ 0x3fff0048, len: 26560
heap : 0x3fff0048 ~ 0x3fffc000, len: 49080
system_get_free_heap_size()打印为: 43896
急,请帮助分析,谢谢!
进入 1573行: “ } else if (os_strcmp(pURL_Frame->pFilename, "wifi") == 0) { ”
......
json_parse(&js, pParseBuffer);
在这行之前 调用 system_restart(), 重启正常,
在这行之后 调用 system_restart(), 打印乱码,重启异常,
......
会不会是在libjson.a里 ram 不够引起的问题?(同样的代码在sdk1.3.0版本运行正常)
在 json_parse() 前 用 system_print_meminfo()打印的 信息如下:
data : 0x3ffe8000 ~ 0x3ffe8b54, len: 2900
rodata: 0x3ffe8b60 ~ 0x3ffe9888, len: 3368
bss : 0x3ffe9888 ~ 0x3fff0048, len: 26560
heap : 0x3fff0048 ~ 0x3fffc000, len: 49080
system_get_free_heap_size()打印为: 43896
急,请帮助分析,谢谢!
Re: SDK从1.3.0, 升级到1.5.2版本后,flash “user param”区 写出错?
Postby ESP_Faye » Tue Mar 15, 2016 11:00 am
您好,
system_restart() 并不会立即重启,而是到系统的 idle task 中才执行重启,也就是要等系统完成一些重启前的准备,才会重启。
但 system_restart 中会做清除状态的动作,也就是重启前的准备。因此不建议在它之后继续做其他操作,直接 return 即可。
例如:
system_restart() 并不会立即重启,而是到系统的 idle task 中才执行重启,也就是要等系统完成一些重启前的准备,才会重启。
但 system_restart 中会做清除状态的动作,也就是重启前的准备。因此不建议在它之后继续做其他操作,直接 return 即可。
例如:
Code: Select all
json_parse(&js, pParseBuffer);
system_restart();
return;
Re: SDK从1.3.0, 升级到1.5.2版本后,flash “user param”区 写出错?
Postby Goland » Fri Mar 18, 2016 8:49 am
加了return还是一样的现象,问题没解决。
更确切的地方是user_json.c中,json_parse()函数中, c->set(json, &js); 这行出错,
在这行之前 调用 system_restart(),;return;重启正常,
在这行之后 调用 system_restart(),return; 打印乱码,重启异常,
更确切的地方是user_json.c中,json_parse()函数中, c->set(json, &js); 这行出错,
在这行之前 调用 system_restart(),;return;重启正常,
在这行之后 调用 system_restart(),return; 打印乱码,重启异常,
Who is online
Users browsing this forum: No registered users and 14 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.