Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Panic/IllegalInstruction exception on c3 #30

Open
MabezDev opened this issue Nov 5, 2021 · 1 comment
Open

Panic/IllegalInstruction exception on c3 #30

MabezDev opened this issue Nov 5, 2021 · 1 comment

Comments

@MabezDev
Copy link
Contributor

MabezDev commented Nov 5, 2021

Building 876a42e for c3 (both pio & native build) produces a IllegalInstruction exception, I captured the PC and fed it into addr2line and it reported the invalid instruction to be in super::intrinsics::abort() inside panic_fmt. Looking at git log it seems immediate abort was removed, but perhaps its still around somewhere?

Regardless of all that, there seems to be a panic when running the demo on a C3.

Here is the log snippet, which may be of interest:

I (5583) wifi:Init max length of beacon: 752/752
I (5583) esp_idf_svc::wifi: Got wifi event: 2 
I (5593) esp_idf_svc::wifi: Reconnecting
Guru Meditation Error: Core  0 panic'ed (Illegal instruction). Exception was unhandled.

Core  0 register dump:
MEPC    : 0x4200bb92  RA      : 0x42006056  SP      : 0x3fc9dca0  GP      : 0x3fc8ea00  
TP      : 0x3fc7952c  T0      : 0x4005890e  T1      : 0x403808fe  T2      : 0x69666957  
S0/FP   : 0x3fc9dcf0  S1      : 0x00000005  A0      : 0x3fc9dca8  A1      : 0x0000300a  
A2      : 0x00000001  A3      : 0x00000001  A4      : 0x3fc96000  A5      : 0x600c2000  
A6      : 0x42054760  A7      : 0x0000000a  S2      : 0x00000000  S3      : 0x00000000  
S4      : 0x3fc9e540  S5      : 0x00000000  S6      : 0xffffffff  S7      : 0x3fca5d88  
S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000  
T3      : 0x00000000  T4      : 0x64656c64  T5      : 0x00000027  T6      : 0x3120746e  
MSTATUS : 0x4200bb92  MTVEC   : 0x40380001  MCAUSE  : 0x00000002  MTVAL   : 0x00000000  
MHARTID : 0x00000000  

Stack memory:
3fc9dca0: 0x000002b7 0xffffffff 0x0000300a 0x00000001 0x00000000 0x00000000 0x3c0c13bc 0x00000000
3fc9dcc0: 0x00000000 0x00000002 0x00000002 0x420058f8 0x00000000 0x00000000 0x3fc9dd10 0x4202063a
3fc9dce0: 0x00000000 0x00000000 0x00000000 0x00000000 0x3c0c1eb0 0x00000002 0x00000000 0x40388b30
3fc9dd00: 0x3fc9dcd8 0x00000001 0x3fc9d2fc 0x4038706e 0x00000002 0x00000000 0x00000000 0x3fca5d88
3fc9dd20: 0xffffffff 0x00000000 0xffffffff 0x000000ce 0x00000000 0x3fc9d088 0x3fc9f140 0x420b2caa
3fc9dd40: 0x00000000 0x3fc9d088 0x00000000 0x420b34f2 0x00000000 0x3c0ccd44 0x00000002 0x00000000
3fc9dd60: 0x00000000 0x3c0ccd44 0x00000002 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fc9dd80: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x3fc9d088 0x420b35dc
3fc9dda0: 0x00000000 0x00000000 0x00000000 0x403896da 0x00000000 0x00000000 0x00000000 0x00000000
3fc9ddc0: 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0x27146414 0x00000000 0x00000000 0x01010107
3fc9dde0: 0x00000001 0xffffffff 0x7fefffff 0x00000000 0x3fc00000 0x00000000 0x40300000 0x00000000
3fc9de00: 0x3fe00000 0x00000000 0x3ff80000 0x636f4361 0x3fd287a7 0x8b60c8b3 0x3fc68a28 0x509f79fb
3fc9de20: 0x3fd34413 0x00000000 0x3ff00000 0x00000000 0x40240000 0x00000000 0x401c0000 0x00000000
3fc9de40: 0x40140000 0x00000000 0x43500000 0x3fc8e200 0xa5a5a5a5 0x00000154 0x3fc9db70 0x3fc96374
3fc9de60: 0x3fc91f48 0x3fc91f48 0x3fc9de58 0x3fc91f40 0x00000005 0x3fc9e5e0 0x3fc9e5e0 0x3fc9de58
3fc9de80: 0x00000000 0x00000014 0x3fc9d354 0x5f737973 0x00747665 0xa5a5a5a5 0x00a5a5a5 0x00000000
3fc9dea0: 0x3fc9de50 0x00000014 0x00000002 0x3fca62e8 0x4205159c 0x00000000 0x3fc96b8c 0x3fc96bf4
3fc9dec0: 0x3fc96c5c 0x00000000 0x00000000 0x00000001 0x00000000 0x00000000 0x00000000 0x4209b9cc
3fc9dee0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fc9df00: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fc9df20: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fc9df40: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fc9df60: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fc9df80: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fc9dfa0: 0x00000000 0x00000000 0x3fc90000 0x0000000c 0x00000002 0x00000001 0x3fc9dfa8 0x0000000c
3fc9dfc0: 0x3fc9dfd0 0x00000000 0x3fc9dfb8 0x00000054 0x00000000 0x3fc9dfd0 0x00000000 0x00000000
3fc9dfe0: 0x00000000 0x3fc9dfe8 0xffffffff 0x3fc9dfe8 0x3fc9dfe8 0x00000000 0x3fc9dffc 0xffffffff
3fc9e000: 0x3fc9dffc 0x3fc9dffc 0x00000001 0x00000001 0x00000000 0xa500ffff 0x00000000 0xa5a5a5a5
3fc9e020: 0x3fc9dfc8 0x00000054 0x00000000 0x3fc9e028 0x00000000 0x00000000 0x00000000 0x3fc9e040
3fc9e040: 0xffffffff 0x3fc9e040 0x3fc9e040 0x00000000 0x3fc9e054 0xffffffff 0x3fc9e054 0x3fc9e054
3fc9e060: 0x00000001 0x00000001 0x00000000 0xa500ffff 0x00000000 0xa5a5a5a5 0x3fc9e020 0x00000028
3fc9e080: 0x3c0d4924 0x00000000 0x00000000 0x00000000 0x3fc9e1c8 0x3fc9e1c8 0x00000001 0x3fc9e104



ELF file SHA256: 0000000000000000

Rebooting...
�`ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
@ivmarkov
Copy link
Owner

ivmarkov commented Nov 5, 2021

panic_immediate_abort was removed temporarily in commit 1a76359#diff-c0f7069e07464fa4e93b743976ee388e5ee530e3393fa306e4745d442bbf1fe8 because of this issue in Rust nightly.

However, the above issue is fixed in the meantime, so panic_immediate_abort was restored with this commit: 3f5d36d#diff-c0f7069e07464fa4e93b743976ee388e5ee530e3393fa306e4745d442bbf1fe8

Now, why do we need panic_immediate_abort in the first place? Two reasons:

  • The non-immediate-abort code-path wants to have the posix call realpath. realpath is declared under ESP-IDF, but not implemented, and results in a linkage error. This is raised as this issue against ESP-IDF.
  • The non-immediate-abort code-path (if I remember correctly) tries to capture a backtrace using backtrace-rs. Backtrace-rs still works for Xtensa under ESP-IDF 4.3.1, but crashes for RiscV, as it uses C++ unwind API calls which fail under RiscV. Now, the worse thing is, from ESP-IDF 4.4 and later, backtrace-rs will start crashing also for Xtensa, as the ESP-IDF folks have replaced the C++ unwind APIs with stubs which do panic when the ESP-IDF is compiled with C++ exceptions disabled. Which means that to support a non-immediate-abort, we'll have to - at the very least - patch (and possibly upstream) backtrace-rs so that it at least does not crash under ESP-IDF, even if producing empty backtraces (good backtrace or stack dump will be produced anyway once the code hits the ESP-IDF native panic handler). Wy would we want to use a non-immediate abort? To display the user error message "Boo" that might come from the developer calling panic!("Boo")

With all of the above said, let me see what is going on on the c3... :)

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

No branches or pull requests

2 participants