Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crash on SPIFFS when booting rom slot 1 #2103

Closed
kmihaylov opened this issue Aug 15, 2020 · 4 comments
Closed

App crash on SPIFFS when booting rom slot 1 #2103

kmihaylov opened this issue Aug 15, 2020 · 4 comments

Comments

@kmihaylov
Copy link
Contributor

When application is using only one SPIFFS address space for both roms (in my case 0x1....), the second (or newly flashed) rom fails to boot (probably because spiffs_mount problem).

If separate addressing is used for SPIFFS partition for rom 0 and rom 1 (0x1xxxx and 0x3xxxx), no problem occurs.
Also if the app uses only one SPIFFS partition located at 0x3xxxx, again no problem occurs (multiple OTA updates and successfull boots from both slot 0 and slot 1).

The decoded stacktraces are below!
Attached is the Basic_rBoot example with minor changes, that shows similar, but not the same behaviour (it successfully updates and switches to slot 1, mounting it from 0x8200 for some reason, but breaks when OTA-ing slot 0).
rboot_spiffs.tar.gz

Here I'm pasting my serial output, including the bootloader messages and other information:

rBoot_config, romSlot: 0 , addr1: 0000002000 , addr2: 0000102000
Sming>
In callback...Firmware updated, rebooting to rom 1...

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 1072, room 16 
tail 0
chksum 0x50
load 0x3ffe8000, len 576, room 8 
tail 8
chksum 0x41
csum 0x41

rBoot v1.4.2 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   DIO
Flash Speed:  40 MHz

Booting rom 1 at 102000, load addr 15a3c0.
~�2�
    �Nn�䒃� �����
                 �no��ۂ�l�bl`�r�olph����p��o��{��N|�
                                                    l�$ll ��c���
                                                                ��2r��l�N�
                                                                          �o��l`���s�p��l2��

                                                                                            l ���{�$�����


                                                                                                         $ �.���110438 Commandhandlercommand status registered
110869 Commandhandlercommand echo registered
111129 Commandhandlercommand help registered
111876 Commandhandlercommand debugon registered
116130 Commandhandlercommand debugoff registered
120489 Commandhandlercommand command registered
Welcome to the Stream Command executor
128056 fs.start: size:64 Kb, offset:0x100000

133726 mount res: 0
260380 FS check res: 0
261198 Commandhandlercommand debug registered
261381 
Currently running rom 1.

261730 Commandhandlercommand restart registered
263323 Commandhandlercommand heap registered
267280 Commandhandlercommand hostname registered
271667 Commandhandlercommand ls registered
275540 Commandhandlercommand cat registered
279480 Commandhandlercommand fscheck registered
283742 Commandhandlercommand fsformat registered
288035 Commandhandlercommand ver registered
291819 SPIClass::setClock(prediv 20, cntdiv 2) for target 2000000
297803 Commandhandlercommand updateFW registered
302084 Commandhandlercommand switchFW registered
306423 Commandhandlercommand deviceInfo registered
sleep disable
332482 SPIClass::setClock(prediv 10, cntdiv 2) for target 4000000
332951 Commandhandlercommand mqtt registered
mode : sta(5c:cf:7f:13:e6:e0)
add if0


***** Fatal exception 0 (ILLEGAL)
pc=0x40209930 sp=0x3ffffef0 excvaddr=0x00000000
ps=0x00000030 sar=0x00000013 vpri=0xffffffff
r00: 0x4020baa1=1075886753 r01: 0x3ffffef0=1073741552 r02: 0x00000000=         0 
r03: 0x00000004=         4 r04: 0x00000000=         0 r05: 0x40209930=1075878192 
r06: 0x3ffeec5c=1073671260 r07: 0x3ffeec5c=1073671260 r08: 0x00000000=         0 
r09: 0x000000c0=       192 r10: 0x3fffc6fc=1073727228 r11: 0x3ffea144=1073652036 
r12: 0x00000003=         3 r13: 0x3ffee5b0=1073669552 r14: 0x402484f4=1076135156 
r15: 0x3ffeeb48=1073670984 

Stack dump:
To decode the stack dump call from command line:
   make decode-stacktrace
and copy & paste the text enclosed in '===='.

================================================================
3ffffef0:  00000004 4020bae4 40209930 d6f45bea  
3fffff00:  40209aac 56a8a9f9 a65ee88d fd8ceb1b  
3fffff10:  40209868 00000003 3ffea144 00000000  
3fffff20:  4020bd95 00000000 00000000 3ffee5b0  
3fffff30:  3fff0084 0000010f 4022d1bb 3ffea144  
3fffff40:  40215d9e 3fff014c 402484f4 40216cad  
3fffff50:  3fff014c 00000000 3fffdaf0 000528ee  
3fffff60:  00000000 402484f4 3fff2608 40248071  
3fffff70:  3fffdaf0 00000000 3fffdab0 4024808c  
3fffff80:  3fffdc10 00000000 3fff10b0 40257c88  
3fffff90:  402185f6 3fff10b0 00000000 402579be  
3fffffa0:  40000f49 3fffdab0 08000081 40000f49  

================================================================
To decode the stack dump call from command line:
   make decode-stacktrace
and copy & paste the text enclosed in '===='.


***** Software Watchdog Reset

Stack dump:
To decode the stack dump call from command line:
   make decode-stacktrace
and copy & paste the text enclosed in '===='.

================================================================
3ffffdd0:  3ffffdf0 ffffffff ffffffff ffffffff  
3ffffde0:  ffffffff ffffffff ffffffff 400005e1  
3ffffdf0:  40209930 00000030 00000013 ffffffff  
3ffffe00:  4020baa1 00000000 00000004 00000000  
3ffffe10:  40209930 3ffeec5c 3ffeec5c 00000000  
3ffffe20:  000000c0 3fffc6fc 3ffea144 00000003  
3ffffe30:  3ffee5b0 402484f4 3ffeeb48 00000000  
3ffffe40:  ffffffff ffffffff ffffffff ffffffff  
3ffffe50:  ffffffff 00000003 ffffff00 ffffffff  
3ffffe60:  ffffffff ffffffff ffffffff ffffffff  
3ffffe70:  ffffffff ffffffff ffffffff ffff0064  
3ffffe80:  00000000 00000000 ffffffff ffffffff  
3ffffe90:  ffffffff ffffffff ffffffff ffffffff  
3ffffea0:  ffffffff ffffffff ffffffff ffffffff  
3ffffeb0:  ffffffff ffffffff ffffffff ffffffff  
3ffffec0:  ffffffff ffffffff ffffffff ffffffff  
3ffffed0:  ffffffff ffffffff ffffffff ffffffff  
3ffffee0:  4020ba93 ffffffff ffffffff ffffffff  
3ffffef0:  00000004 4020bae4 40209930 d6f45bea  
3fffff00:  40209aac 56a8a9f9 a65ee88d fd8ceb1b  
3fffff10:  40209868 00000003 3ffea144 00000000  
3fffff20:  4020bd95 00000000 00000000 3ffee5b0  
3fffff30:  3fff0084 0000010f 4022d1bb 3ffea144  
3fffff40:  40215d9e 3fff014c 402484f4 40216cad  
3fffff50:  3fff014c 00000000 3fffdaf0 000528ee  
3fffff60:  00000000 402484f4 3fff2608 40248071  
3fffff70:  3fffdaf0 00000000 3fffdab0 4024808c  
3fffff80:  3fffdc10 00000000 3fff10b0 40257c88  
3fffff90:  402185f6 3fff10b0 00000000 402579be  
3fffffa0:  40000f49 3fffdab0 08000081 40000f49  

================================================================
To decode the stack dump call from command line:
   make decode-stacktrace
�nd copy & paste the text enclosed in '===='.
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 1072, room 16 
tail 0
chksum 0x50
load 0x3ffe8000, len 576, room 8 
tail 8
chksum 0x41
csum 0x41

rBoot v1.4.2 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   DIO
Flash Speed:  40 MHz

Rom 1 at 102000 is bad.
Booting rom 0 at 2000, load addr 5a3c0.

Decode stack-trace of the first dump:

0x4020bae4: chm_cancel_op at ??:?
0x40209930: scan_start at ??:?
0x40209aac: scan_cancel at ??:?
0x40209868: scan_start at ??:?
0x4020bd95: cnx_sta_scan_cmd at ??:?
0x4022d1bb: pp_enable_noise_timer at /home/xcg/workspace/debug/esp8266_nonos_sdk_core_20180510/app/pp/pp.c:323
0x40215d9e: wifi_get_opmode at ??:?
0x402484f4: StationImpl::smartConfigStart(SmartConfigType, Delegate<bool (SmartConfigEvent, SmartConfigEventInfo const&)>)::{lambda(sc_status, void*)#1}::_FUN(sc_status, void*) at StationImpl.cpp:?
0x40216cad: wifi_station_scan at ??:?
0x402484f4: StationImpl::smartConfigStart(SmartConfigType, Delegate<bool (SmartConfigEvent, SmartConfigEventInfo const&)>)::{lambda(sc_status, void*)#1}::_FUN(sc_status, void*) at StationImpl.cpp:?
0x40248071: StationImpl::onSystemReady() at /opt/Sming/Sming/Arch/Esp8266/Platform/StationImpl.cpp:305
 (inlined by) StationImpl::onSystemReady() at /opt/Sming/Sming/Arch/Esp8266/Platform/StationImpl.cpp:302
0x4024808c: non-virtual thunk to StationImpl::onSystemReady() at /opt/Sming/Sming/Arch/Esp8266/Platform/StationImpl.h:62
0x40257c88: SystemClass::onReady(ISystemReadyHandler*)::{lambda(void*)#1}::_FUN(void*) at /opt/Sming/Sming/Platform/System.h:165
0x402185f6: wifi_set_status_led_output_level at ??:?
0x402579be: SystemClass::taskHandler(ETSEventTag*) at /opt/Sming/Sming/Platform/System.cpp:46

Decoded stack-trace after the WDT reset:

0x40209930: scan_start at ??:?
0x4020baa1: chm_end_op at ??:?
0x40209930: scan_start at ??:?
0x402484f4: StationImpl::smartConfigStart(SmartConfigType, Delegate<bool (SmartConfigEvent, SmartConfigEventInfo const&)>)::{lambda(sc_status, void*)#1}::_FUN(sc_status, void*) at StationImpl.cpp:?
0x4020ba93: chm_end_op at ??:?
0x4020bae4: chm_cancel_op at ??:?
0x40209930: scan_start at ??:?
0x40209aac: scan_cancel at ??:?
0x40209868: scan_start at ??:?
0x4020bd95: cnx_sta_scan_cmd at ??:?
0x4022d1bb: pp_enable_noise_timer at /home/xcg/workspace/debug/esp8266_nonos_sdk_core_20180510/app/pp/pp.c:323
0x40215d9e: wifi_get_opmode at ??:?
0x402484f4: StationImpl::smartConfigStart(SmartConfigType, Delegate<bool (SmartConfigEvent, SmartConfigEventInfo const&)>)::{lambda(sc_status, void*)#1}::_FUN(sc_status, void*) at StationImpl.cpp:?
0x40216cad: wifi_station_scan at ??:?
0x402484f4: StationImpl::smartConfigStart(SmartConfigType, Delegate<bool (SmartConfigEvent, SmartConfigEventInfo const&)>)::{lambda(sc_status, void*)#1}::_FUN(sc_status, void*) at StationImpl.cpp:?
0x40248071: StationImpl::onSystemReady() at /opt/Sming/Sming/Arch/Esp8266/Platform/StationImpl.cpp:305
 (inlined by) StationImpl::onSystemReady() at /opt/Sming/Sming/Arch/Esp8266/Platform/StationImpl.cpp:302
0x4024808c: non-virtual thunk to StationImpl::onSystemReady() at /opt/Sming/Sming/Arch/Esp8266/Platform/StationImpl.h:62
0x40257c88: SystemClass::onReady(ISystemReadyHandler*)::{lambda(void*)#1}::_FUN(void*) at /opt/Sming/Sming/Platform/System.h:165
0x402185f6: wifi_set_status_led_output_level at ??:?
0x402579be: SystemClass::taskHandler(ETSEventTag*) at /opt/Sming/Sming/Platform/System.cpp:46
@slaff
Copy link
Contributor

slaff commented Aug 17, 2020

@kmihaylov Try to flash the same APP on rom 0 and then on rom 1 over OTA. The stack trace points to a problem in the smartconfig code / WIFI and not in the flash reading/writing.

@kmihaylov
Copy link
Contributor Author

@slaff would you please try the attached project (1st post)? Try OTA several times with the same firmware.

@slaff
Copy link
Contributor

slaff commented May 6, 2021

@kmihaylov Are you still having this issue with the latest develop version?

@kmihaylov
Copy link
Contributor Author

kmihaylov commented May 30, 2021

@slaff with the latest develop f2bcf79 and the new Ota updater everything works fine.

With few versions earlier (with the bit older now rBoot updater) everything works fine too, given that I use rom0 and rom1 images for flashing the appropriated slots.

I have made a mistake to use only rom0 for flashing both slot0 and slot1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants