esp-storage icon indicating copy to clipboard operation
esp-storage copied to clipboard

Does one have to disable interrupts before using `FlashStorage::write`?

Open dimpolo opened this issue 1 year ago • 10 comments

I'm seeing this backtrace on a ESP32S3 when ISRs are being ran on the same core:

Backtrace

Exception occured 'IllegalInstruction'
Context
PC=0x4201219e       PS=0x00060030
0x4201219e - core::sync::atomic::atomic_load
    at C:\Users\d.polonski\.rustup\toolchains\esp\lib\rustlib\src\rust\library\core\src\sync\atomic.rs:3153
0x00060030 - PS_WOE
    at ??:??
A0=0x82006b38       A1=0x3fcda550       A2=0x00000000       A3=0x3fcda630       A4=0x00000000
0x82006b38 - _rtc_fast_bss_end
    at ??:??
0x3fcda550 - _heap_end
    at ??:??
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x3fcda630 - _heap_end
    at ??:??
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
A5=0x41200000       A6=0x00000000       A7=0x3fcda550       A8=0x00000023       A9=0x3fcda530
0x41200000 - __default_double_exception
    at ??:??
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x3fcda550 - _heap_end
    at ??:??
0x00000023 - PS_UM
    at ??:??
0x3fcda530 - _heap_end
    at ??:??
A10=0x00000000      A11=0x00000000      A12=0xbf0d0690      A13=0x6000880c      A14=0x801702a5
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0xbf0d0690 - _rtc_fast_bss_end
    at ??:??
0x6000880c - _rtc_slow_bss_end
    at ??:??
0x801702a5 - _rtc_fast_bss_end
    at ??:??
A15=0x3fcda530
0x3fcda530 - _heap_end
    at ??:??
SAR=0000001f
EXCCAUSE=0x00000000 EXCVADDR=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
LBEG=0x00000000     LEND=0x00000000     LCOUNT=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
THREADPTR=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
SCOMPARE1=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
BR=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
ACCLO=0x00000000    ACCHI=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
M0=0x00000000       M1=0x00000000       M2=0x00000000       M3=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
F64R_LO=0x000000ad  F64R_HI=0x00000000  F64S=0x3c0331f4
0x000000ad - XT_STK_F5
    at ??:??
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x3c0331f4 - _ZN15core_control_v43adc23ADC_PLAUSIBILITY_RANGES17h889f840f788e9dafE
    at ??:??
FCR=0x00000000      FSR=0x00000080
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000080 - XT_STK_M3
    at ??:??
F0=0x00000000       F1=0x00000000       F2=0x00000000       F3=0x00000000       F4=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
F5=0x00000000       F6=0x00000000       F7=0x00000000       F8=0x00000000       F9=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
F10=0x3c2237c3      F11=0x43990677      F12=0x41e88f61      F13=0x00000000      F14=0x00000000
0x3c2237c3 - _sidata
    at ??:??
0x43990677 - _ZN17compiler_builtins3mem6memcmp17hf37f2c57db2018e8E
    at ??:??
0x41e88f61 - __default_double_exception
    at ??:??
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388
F15=0x00000000
0x00000000 - <esp32s3::RTC_CNTL as core::fmt::Debug>::fmt
    at C:\Users\d.polonski\.cargo\registry\src\index.crates.io-6f17d22bba15001f\esp32s3-0.19.0\src\lib.rs:1388

0x42019b99
0x42019b99 - core::fmt::Arguments::new_const
    at C:\Users\d.polonski\.rustup\toolchains\esp\lib\rustlib\src\rust\library\core\src\fmt\mod.rs:301
0x40000000
0x40000000 - _external_ram_end
    at ??:??
0x40034c48
0x40034c48 - rom_i2c_writeReg_Mask
    at ??:??
0x40000000
0x40000000 - _external_ram_end
    at ??:??


dimpolo avatar Jul 31 '23 10:07 dimpolo