espressif / esp8266-rtos-sample-code

Other
129 stars 86 forks source link

OTA升级导致崩溃 #4

Closed xiongyumail closed 7 years ago

xiongyumail commented 7 years ago

`while(upgrade->fw_bin_sec_earse != secnm) { taskENTER_CRITICAL(); if( OUT_OF_RANGE( upgrade->fw_bin_sec_earse) ) { os_printf("fw_bin_sec_earse:%d, Out of range\n",upgrade->fw_bin_sec_earse); break;

        }
        else
        {
             spi_flash_erase_sector(upgrade->fw_bin_sec_earse);
             upgrade->fw_bin_sec_earse++;
        }
        **taskEXIT_CRITICAL();**
        vTaskDelay(10 / portTICK_RATE_MS);
    }
    os_printf("flash erase over\n");`

OTA例程中,进行扇区擦出结束执行taskEXIT_CRITICAL()时会发生不可预知的错误,导致当前运行的bin不能执行(并没有擦出当前扇区!)。使得重新开机也不能执行代码!去除该代码,并在一次循环中擦除全部扇区不会出现问题!

错误调试记录:

flash erase sector:70,OK flash erase sector:71,OK

flash erase sector:72,OK

猺jrA(S藆嬓汌沊?衴juh?"8醫硗狽?E,?11)DP婹K!A??e"辱I預,v%(E,R?1┰vA锝5?Eh n?e⑷hInA,X%※(E,R?5?膙A锏5y*E?n?e⑷hInA,t[ 簐A,t[ 仩Pz~o誱y+uh?!E%諴鈊t  ??1?岎

ets Jan 8 2013,rst cause:1, boot mode:(3,7)

load 0x4010 0000, len 2408, room 16 tail 8 chksum 0xe5 load 0x3ffe8000, len 776, room 0 tail 8 chksum 0x84 load 0x3ffe8310, len 632, room 0 tail 8 chksum 0xd8 csum 0xd8

2nd boot version : 1.6 SPI Speed : 80MHz SPI Mode : QIO SPI Flash Size & Map: 32Mbit(512KB+512KB) jump to run user1 @ 1000

OS SDK ver: 1.5.0 -dev(950076a) compiled @ Nov 4 2016 19:29:32

phy ver: 1055, pp ver: 10.7

rf cal sector: 1019 tcpip_task_hdl : 3ffeffd0, prio:10,stack:512 idle_task_hdl : 3fff0070,prio:0, stack:384 tim_task_hdl : 3fff2628, prio:2,stack:512 mode : sta(18:fe:34:de:0d:30) Fatal exception (0): epc1=0x402b3d94 epc2=0x00000000 epc3=0x00000000 epcvaddr=0x00000000 depc=0x00000000 rtn_add=0x40237b18 @猺jrA(S藆嬓鰶豃z~闝!薟K??E??1〥P婹K!{~A??e⑷hI預,v%!E,R?1)膙A?祔E?n?e⑷hI預,X%※(E,R 5偐詖Ao?5yE?n?e"Hh深A,t[ 忽A,tK ?P鷡o誱y+eh-%!E%諴鈊t