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

NVS erase causes panic #513

Closed
hhy50 opened this issue Nov 13, 2024 · 0 comments
Closed

NVS erase causes panic #513

hhy50 opened this issue Nov 13, 2024 · 0 comments

Comments

@hhy50
Copy link

hhy50 commented Nov 13, 2024

pub unsafe fn reset() -> ! {
    log::warn!("{TAG} reset system....");
    if let Err(e) = esp!(nvs_flash_erase()) {
        log::error!("{TAG} reset nvs_flash_erase error, {:?}", e);
    }
    if let Err(e) = esp!(nvs_flash_init()) {
        log::error!("{TAG} reset nvs_flash_init error, {:?}", e);
    }
    esp_idf_svc::hal::reset::restart()
}

log:

W (167667) billiards_esp32::device::system: SYSTEM reset system....
W (167707) billiards_esp32::device::wifi: WIFI StaStopped
thread '<unnamed>' panicked at /Users/hanhaiyang/.cargo/git/checkouts/esp-idf-svc-a28457b0e32c6283/7cf3a9a/src/eventloop.rs:251:26:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

abort() was called at PC 0x420509d1 on core 0
0x420509d1 - panic_abort::__rust_start_panic::abort
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/panic_abort/src/lib.rs:48
Core  0 register dump:
MEPC    : 0x4038188c  RA      : 0x4038a288  SP      : 0x3fcb4230  GP      : 0x3fc97a00  
0x4038188c - panic_abort
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_system/panic.c:466
0x4038a288 - __ubsan_include
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_system/ubsan.c:313
0x3fc97a00 - g_wifi_osi_funcs
    at ??:??
TP      : 0x3fc722a0  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130  
S0/FP   : 0x00000004  S1      : 0x3fcb4294  A0      : 0x3fcb425c  A1      : 0x3fcb4292  
A2      : 0x00000000  A3      : 0x3fcb4289  A4      : 0x00000001  A5      : 0x3fc9f000  
0x3fc9f000 - chip7_phy_init_ctrl
    at ??:??
A6      : 0x7a797877  A7      : 0x76757473  S2      : 0x00000000  S3      : 0x00000001  
S4      : 0x0000023f  S5      : 0x00000000  S6      : 0xffffffff  S7      : 0x3fcd2294  
S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000  
T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938  
MSTATUS : 0x00001881  MTVEC   : 0x40380001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000  
0x40380001 - _vector_table
    at ??:??
MHARTID : 0x00000000  

Stack memory:
3fcb4230: 0x42024e24 0x00000004 0x3fcb4290 0x40392a04 0x00000004 0x3fcb4254 0x00000003 0x3fc9a2d0
0x42024e24 - std::sys::thread_local::key::unix::get
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/thread_local/key/unix.rs:21
0x40392a04 - abort
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/newlib/abort.c:35
3fcb4250: 0x3fcb4294 0x3fc9a2ec 0x3fcb4290 0x726f6261 0x20292874 0x20736177 0x6c6c6163 0x61206465
3fcb4270: 0x43502074 0x34783020 0x30353032 0x20316439 0x63206e6f 0x2065726f 0x00000030 0x3c140000
3fcb4290: 0x00000030 0x35303234 0x31643930 0x00000000 0x3fcb4298 0x3fc9ad70 0x00000008 0x420509d4
0x3fc9ad70 - $d
    at ??:??
0x420509d4 - core::convert::num::ptr_try_from_impls::<impl core::convert::TryFrom<u64> for usize>::try_from
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/convert/num.rs:256
3fcb42b0: 0x00000000 0x00000000 0x3fcb42a4 0x4201a0f6 0x3c139688 0x00000002 0x3fcb42b0 0x00000002
0x4201a0f6 - <&T as core::fmt::Display>::fmt
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:2390
0x3c139688 - $d
    at ??:??
3fcb42d0: 0x00000000 0x3fc9ad70 0x00000008 0x42046396 0x00000000 0x3fc9ad70 0x00000008 0x42046992
0x3fc9ad70 - $d
    at ??:??
0x42046396 - core::ptr::const_ptr::<impl *const T>::as_ref
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:278
0x3fc9ad70 - $d
    at ??:??
0x42046992 - core::fmt::Arguments::new_const
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:339
3fcb42f0: 0x3fcb4350 0x3c140f20 0x3c130bf4 0x3fc97a00 0x3fc722a0 0x00000010 0x4205fcf2 0xffffffff
0x3c140f20 - $d
    at ??:??
0x3c130bf4 - $d
    at ??:??
0x3fc97a00 - g_wifi_osi_funcs
    at ??:??
0x4205fcf2 - core::fmt::Formatter::pad
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:1435
3fcb4310: 0x3fccf0dc 0x00000001 0x00000001 0x00000009 0x3c140f10 0x3c130bf4 0x00000001 0x600c0000
0x3c140f10 - $d
    at ??:??
0x3c130bf4 - $d
    at ??:??
3fcb4330: 0x420a6c06 0x3c146f6e 0xffffffff 0x00000003 0x00000000 0x3fcd2284 0x3fcd2274 0x420466ba
0x420a6c06 - wifi_default_action_sta_stop
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_wifi/src/wifi_default.c:78
0x3c146f6e - $d
    at ??:??
0x420466ba - std::panicking::begin_panic_handler::{{closure}}
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:677
3fcb4350: 0x3c146c69 0x0000002b 0x00000000 0x00000000 0x00000000 0x3fcb4380 0x3c130bf4 0x3fcb4374
0x3c146c69 - $d
    at ??:??
0x3c130bf4 - $d
    at ??:??
3fcb4370: 0x00000000 0x3fcb4380 0x3c130bf4 0x40380001 0x3fcb4398 0x00000001 0x00000004 0x00000000
0x3c130bf4 - $d
    at ??:??
0x40380001 - _vector_table
    at ??:??
3fcb4390: 0x00000000 0x3fc9f000 0x3c146c69 0x0000002b 0x3fcd2294 0x3fc9f000 0x00000000 0x4208f8fa
0x3fc9f000 - chip7_phy_init_ctrl
    at ??:??
0x3c146c69 - $d
    at ??:??
0x3fc9f000 - chip7_phy_init_ctrl
    at ??:??
0x4208f8fa - sys_arch_sem_wait
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/lwip/port/freertos/sys_arch.c:166
3fcb43b0: 0x00000000 0xffffffff 0x3fc9f320 0x00000000 0x3fcd2294 0x3fc9f000 0x3fcb43fc 0x4208f894
0x3fc9f320 - api_lock_sem
    at ??:??
0x3fc9f000 - chip7_phy_init_ctrl
    at ??:??
0x4208f894 - sys_sem_signal
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/lwip/port/freertos/sys_arch.c:136
3fcb43d0: 0x000000b0 0x3fccf034 0x3fcb43fc 0x420927c2 0x4200cb56 0x3fcb372c 0x00000000 0x420927e0
0x420927c2 - esp_netif_lwip_ipc_call_msg
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_netif/lwip/esp_netif_lwip.c:231
0x4200cb56 - <esp_idf_svc::wifi::WifiEvent as core::fmt::Debug>::fmt
    at /Users/hanhaiyang/.cargo/git/checkouts/esp-idf-svc-a28457b0e32c6283/7cf3a9a/src/wifi.rs:2224
0x420927e0 - esp_netif_lwip_ipc_call
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_netif/lwip/esp_netif_lwip.c:245
3fcb43f0: 0x00000000 0x3fcd2284 0x3c1568a0 0x4201b82e 0x00005002 0x420935d4 0x3fcd03b0 0x3c1568a0
0x4201b82e - <alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut
    at /Users/hanhaiyang/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:2461
0x420935d4 - esp_netif_stop_api
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_netif/lwip/esp_netif_lwip.c:1167
3fcb4410: 0x0000000b 0x00000003 0x00000000 0x4200293c 0x00000000 0x00000000 0x3c1568a0 0x0000000b
0x4200293c - esp_idf_svc::eventloop::EspSubscription<T>::handle
    at /Users/hanhaiyang/.cargo/git/checkouts/esp-idf-svc-a28457b0e32c6283/7cf3a9a/src/eventloop.rs:367
3fcb4430: 0x00000003 0x00000000 0x3fcd2284 0x00000000 0x00000000 0x3fcb372c 0x3fcd4344 0x4212442e
0x4212442e - handler_execute
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_event/esp_event.c:163
3fcb4450: 0x00000000 0x3fcb372c 0x00000000 0x42124cdc 0x00000000 0x3c1568a0 0x00000003 0x00000000
0x42124cdc - esp_event_loop_run
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_event/esp_event.c:584
3fcb4470: 0x00000000 0x3c1568a0 0x00000003 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fcb4490: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x3fcb372c 0x42124d98
0x42124d98 - esp_event_loop_run_task
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_event/esp_event.c:108
3fcb44b0: 0x00000000 0x00000000 0x00000000 0x4038b2fa 0x00000000 0x00000000 0x00000000 0x00000000
0x4038b2fa - vPortTaskWrapper
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:258
3fcb44d0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fcb44f0: 0xa5a5a5a5 0xa5a5a5a5 0x00000150 0x3fcb4080 0x00000000 0x3fc9b128 0x3fc9b128 0x3fcb44fc
0x3fc9b128 - pxReadyTasksLists
    at ??:??
0x3fc9b128 - pxReadyTasksLists
    at ??:??
3fcb4510: 0x3fc9b120 0x00000005 0x3fccf108 0x3fccf108 0x3fcb44fc 0x00000000 0x00000014 0x3fcb39f8
0x3fc9b120 - pxReadyTasksLists
    at ??:??
3fcb4530: 0x5f737973 0x00747665 0x00000000 0x00000000 0x3fcb44f0 0x00000014 0x00000001 0x3fcd08e8
3fcb4550: 0x42068508 0x00000000 0x3fca1708 0x3fca1770 0x3fca17d8 0x00000000 0x00000000 0x00000001
0x42068508 - pthread_cleanup_thread_specific_data_callback
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/pthread/pthread_local_storage.c:126
3fcb4570: 0x00000000 0x00000000 0x00000000 0x4206f18a 0x00000000 0x00000000 0x00000000 0x00000000
0x4206f18a - esp_cleanup_r
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/newlib/newlib_init.c:60
3fcb4590: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fcb45b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fcb45d0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fcb45f0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fcb4610: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000



ELF file SHA256: 000000000

Rebooting...
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xf (SPI_FAST_FLASH_BOOT)
Saved PC:0x40381848
0x40381848 - esp_restart_noos
    at /Users/hanhaiyang/.espressif/esp-idf/v5.2.2/components/esp_system/port/soc/esp32c3/system_internal.c:111
@hhy50 hhy50 closed this as completed Nov 13, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

1 participant