ESP32/ESP8266 出现Guru Meditation Error错误溯源办法

ESP32/ESP8266 出现Guru Meditation Error错误溯源办法

我们调试ESP32都知道,在idf monitor中,如果出现Guru Meditation Error 错误时,会看到错误出现的具体文件函数以及代码行数。如下这样:

Guru Meditation Error of type StoreProhibited occurred on core  0. Exception was unhandled.
Register dump:
PC      : 0x400f360d  PS      : 0x00060330  A0      : 0x800dbf56  A1      : 0x3ffb7e00
0x400f360d: do_something_to_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:57
(inlined by) inner_dont_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:52
A2      : 0x3ffb136c  A3      : 0x00000005  A4      : 0x00000000  A5      : 0x00000000
A6      : 0x00000000  A7      : 0x00000080  A8      : 0x00000000  A9      : 0x3ffb7dd0
A10     : 0x00000003  A11     : 0x00060f23  A12     : 0x00060f20  A13     : 0x3ffba6d0
A14     : 0x00000047  A15     : 0x0000000f  SAR     : 0x00000019  EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000

Backtrace: 0x400f360d:0x3ffb7e00 0x400dbf56:0x3ffb7e20 0x400dbf5e:0x3ffb7e40 0x400dbf82:0x3ffb7e60 0x400d071d:0x3ffb7e90
0x400f360d: do_something_to_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:57
(inlined by) inner_dont_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:52
0x400dbf56: still_dont_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:47
0x400dbf5e: dont_crash at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:42
0x400dbf82: app_main at /home/gus/esp/32/idf/examples/get-started/hello_world/main/./hello_world_main.c:33
0x400d071d: main_task at /home/gus/esp/32/idf/components/esp32/./cpu_start.c:254

可是更多的我们没有条件使用 idf monitor ,出现错误就会是这样的:

Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.
Core  1 register dump:
PC      : 0x4000c46c  PS      : 0x00060c30  A0      : 0x80123439  A1      : 0x3ffffda0  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000800  A5      : 0x00000000  
A6      : 0x00000008  A7      : 0x00000080  A8      : 0x00000000  A9      : 0x3ffffd50  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x3ffcf644  A13     : 0x00000000  
A14     : 0x3ffcf3ec  A15     : 0x00000018  SAR     : 0x00000004  EXCCAUSE: 0x0000001d  
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x0000007f  
Backtrace:0x4000c469:0x3ffffda0 0x40123436:0x3ffffdb0 0x40123a5d:0x3ffffe20 0x40123b33:0x3ffffe40

ELF file SHA256: aa23852d5f02b6c3

这时候我们就需要使用Backtrace 来溯源,Backtrace包含的信息其实就是出现错的具体函数具体位置,我们需要借助官方工具以及我们当前固件的工程文件,一定要确保此工程版本和固件版本对应,不然定位可能会不准。

在工程目录中打开终端,输入以下代码 xtensa-esp32-elf-addr2line -pfiaC -e build/SP1.elf 0x40123436:0x3ffffdb0

 lcz@LCX  ~/WORK/CHANGE/ubibot-SmartPlug   xtensa-esp32-elf-addr2line -pfiaC -e build/SP1.elf 0x40123436:0x3ffffdb0
0x40123436: read_485_co2_task at /home/lcz/WORK/CHANGE/ubibot-SmartPlug/components/RS485_Read/RS485_Read.c:498

SP1.elf为工程生成的中间文件,SP1是工程名称,0x40123436:0x3ffffdb0 就是错误代码的地址,一般使用Backtrace中第二个地址几个定位到出问题的函数。(注意:0x4000c469:0x3ffffda0 为一段完整的地址 )

参考: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html

  • 3
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值