【问题标题】:What does following error means in esp32?esp32 中的以下错误是什么意思?
【发布时间】:2021-09-01 04:33:33
【问题描述】:

我正在研究 esp32 MQTT。当我将消息从云发布到微控制器时,我收到了一条基于 msg 程序的 MQTT 消息,在进程完成后我正在使用 MQTT 发送确认。发送确认后,esp 崩溃了。所以,我想知道这个错误是什么意思? 我收到错误的可能原因是什么?

DEBUG: [mqtt.c:800:handleMqttPayload]  ------------------------>line  
DEBUG: [mqtt.c:472:_mqttSubscriptionCallback]  ------------------------>line  
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x400957b6  PS      : 0x00060933  A0      : 0x80085160  A1      : 0x3ffe2120  
0x400957b6: is_free at /home/horsemann/Desktop/WorkSpace/TestingRepo/vendors/espressif/esp-idf/components/heap/multi_heap.c:380
 (inlined by) multi_heap_malloc_impl at /home/horsemann/Desktop/WorkSpace/TestingRepo/vendors/espressif/esp-idf/components/heap/multi_heap.c:432

A2      : 0x3ffb9a20  A3      : 0x00000074  A4      : 0x3ffb9bc2  A5      : 0x3ffc24f4  
A6      : 0x00000000  A7      : 0x3ffc1930  A8      : 0x62df42e6  A9      : 0x00003ffb  
A10     : 0x00000001  A11     : 0x00000001  A12     : 0x62df42e6  A13     : 0x3ffb9b98  
A14     : 0x3ffb9bc2  A15     : 0x00000003  SAR     : 0x0000001d  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00003ffb  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  

ELF file SHA256: 6ba6c7666cfc3a6affb97ff2c01bc138e861781ba07bfe6d7e01fbf2e790ec91

Backtrace: 0x400957b6:0x3ffe2120 0x4008515d:0x3ffe2140 0x40085456:0x3ffe2160 0x40085671:0x3ffe21a0 0x400817ad:0x3ffe21c0 0x400eeae1:0x3ffe21e0 0x400ef431:0x3ffe2220 0x400ee77f:0x3ffe2240 0x400e2ca4:0x3ffe2270 0x400e2e90:0x3ffe22c0 0x400f2ca9:0x3ffe22e0 0x400f2d18:0x3ffe2300 0x400f3c7a:0x3ffe2320 0x4008fa5d:0x3ffe2350
0x400957b6: is_free at /home/horsemann/Desktop/WorkSpace/TestingRepo/vendors/espressif/esp-idf/components/heap/multi_heap.c:380
 (inlined by) multi_heap_malloc_impl at /home/horsemann/Desktop/WorkSpace/TestingRepo/vendors/espressif/esp-idf/components/heap/multi_heap.c:432

0x4008515d: heap_caps_malloc at /home/horsemann/Desktop/WorkSpace/TestingRepo/vendors/espressif/esp-idf/components/heap/heap_caps.c:232

0x40085456: trace_malloc at /home/horsemann/Desktop/WorkSpace/TestingRepo/vendors/espressif/esp-idf/components/heap/heap_trace.c:188

0x40085671: __wrap_heap_caps_malloc at /home/horsemann/Desktop/WorkSpace/TestingRepo/vendors/espressif/esp-idf/components/heap/heap_trace.c:421

0x400817ad: malloc_internal_wrapper at /home/horsemann/Desktop/WorkSpace/TestingRepo/vendors/espressif/esp-idf/components/esp32/esp_adapter.c:407

0x400eeae1: esf_buf_alloc at ??:?

0x400ef431: ic_ebuf_alloc at ??:?

0x400ee77f: ieee80211_getmgtframe at ??:?

0x400e2ca4: ieee80211_encap_null_data at ??:?

0x400e2e90: ieee80211_pm_tx_null_process at ??:?

0x400f2ca9: pm_tx_null_data_done_process at ??:?

0x400f2d18: pm_send_wake_null_cb at ??:?

0x400f3c7a: ppProcTxDone at ??:?

0x4008fa5d: ppTask at ??:?

【问题讨论】:

  • 这是一些内存访问冲突。请发布您的代码的Minimal, Reproducible Example 以获得任何有用的建议。
  • 代码很大,是amazon-freertos代码,所以这里不能贴代码。
  • 可能你的堆内存用完了或者某个地方有堆损坏错误。
  • 为什么成为“amazon-freertos 代码”意味着您不能发布它?回溯应该给你一个关于你应该发布什么的线索。在任何情况下,回溯中的调用都不是 FreeRTOS 函数。

标签: embedded esp32 freertos


【解决方案1】:

调用堆栈显示在调试输出中:

ppTask calls
ppProcTxDone calls
pm_send_wake_null_cb etc.

由于错误可能出现在您的代码中,您应该查看回溯中的最后一次调用,该调用是您在堆栈转储中调用下一个函数的位置,并验证任何调用参数。

这里的另一个有用信息是EXCCAUSE(异常原因)寄存器28(0x1C)中的值: 表示访问无效地址。

异常的位置是:

0x400957b6: is_free at [...]/espressif/esp-idf/components/heap/multi_heap.c:380

That function 看起来像这样:

static inline bool is_free(const block_header_t *block)
{
    return ((block->size & 0x01) != 0);
}

blockblock->size 取消引用时,最可能的异常原因是block 引用了一个无效位置、为空或具有无效对齐。这个例外反而暗示了这些可能性中的第一个(或者可能是第二个)。

这表明堆损坏,这可能发生在以前任何时间的任何地方 - 不一定在回溯指示的代码路径中。它通常是由分配的堆块过度运行或运行不足引起的,然后在新的堆操作(mallocfreenewdelete 等)时检测到并尝试解释已经损坏的堆。

因此,您需要检查您对每个动态分配块的使用情况,以确保您拥有例如:

  • 在所有情况下都分配了适当的大小,
  • 尚未访问和修改超出分配大小范围的数据,
  • 在内存被free'd / delete'd 或以其他方式返回堆后,还没有访问过内存。
  • 没有内存泄漏。

除此之外: “Guru Mediation Error”是"Guru Meditation Error"的拼写错误;它本身毫无意义(一个“可爱的”计算历史引用本身就是一个笑话,然后由于拼写错误而变得不那么可爱或有趣),但它本质上类似于 内核恐慌BSOD 。关键是;发生异常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-15
    • 1970-01-01
    • 2017-05-30
    • 2012-10-01
    相关资源
    最近更新 更多