当前位置: 首页 > ds >正文

platformIO开发ESP32程序时,出现崩溃重启时如何根据堆栈定位到源代码位置

开启使用ESP-IDF查看backtrace

  • 在platofmrio.ini中增加两个配置
monitor_filters = esp32_exception_decoder
build_type = debug

        如果是esp8266的话改成

monitor_filters = esp8266_exception_decoder
build_type  = debug
  • 然后重新上传固件,并启用串口监视器

        当发生错误时,会显示如下信息

Guru Meditation Error: Core  0 panic'ed (Store access fault). Exception was unhandled.Core  0 register dump:
MEPC    : 0x420017a8  RA      : 0x42001790  SP      : 0x3fc95870  GP      : 0x3fc8bc00
TP      : 0x3fc89d74  T0      : 0x00000000  T1      : 0xffc3ffff  T2      : 0x00000001
S0/FP   : 0x3fc8d0d0  S1      : 0x00000000  A0      : 0x00000001  A1      : 0xffffffff
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x08000000  A5      : 0x00000010
A6      : 0x00000001  A7      : 0x04c4b400  S2      : 0x00000000  S3      : 0x00000000
S4      : 0x00000000  S5      : 0x00000000  S6      : 0x00000000  S7      : 0x00000000
S8      : 0x00000000  S9      : 0x00000000  S10     : 0x00000000  S11     : 0x00000000
T3      : 0x00000000  T4      : 0x0000000f  T5      : 0x003c0000  T6      : 0x00000003
MSTATUS : 0x00001881  MTVEC   : 0x40380001  MCAUSE  : 0x00000007  MTVAL   : 0x00000010
MHARTID : 0x00000000Stack memory:
3fc95870: 0x00000000 0x3fc8d000 0x01312d00 0x00000001 0x00000000 0x3fc8d000 0x3fc8d0d0 0x42001a50#0  0x3fc8d000 in __global_pointer$ at ??:?#1  0x3fc8d000 in __global_pointer$ at ??:?#2  0x3fc8d0d0 in ?? at src/main.cpp:28#3  0x42001a50 in TFT_eSPI::init(unsigned char) at .pio/libdeps/wifiduino32c3/TFT_eSPI/TFT_eSPI.cpp:6933fc95890: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x3fc8d000 0x3fc8d000 0x420000fc#0  0x3fc8d000 in __global_pointer$ at ??:?#1  0x3fc8d000 in __global_pointer$ at ??:?#2  0x420000fc in setup() at src/main.cpp:2533fc958b0: 0x00000000 0x3fc8f000 0x42003000 0x42004dd6 0x00000000 0x00000000 0x00000000 0x403873a8#0  0x42003000 in Stream::readString() at C:/Users/Administrator/.platformio/packages/framework-arduinoespressif32/cores/esp32/Stream.cpp:320#1  0x42004dd6 in loopTask(void*) at C:/Users/Administrator/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:51#2  0x403873a8 in _prvTaskExitError at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port/riscv/port.c:126(inlined by) prvTaskExitError at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port/riscv/port.c:1403fc958d0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
3fc958f0: 0xa5a5a5a5 0xbaad5678 0x00000160 0xabba1234 0x00000154 0x3fc95790 0xff0afad5 0x3fc8de0c
3fc95910: 0x3fc8de0c 0x3fc95904 0x3fc8de04 0x00000018 0x8cba16ee 0xeafa516c 0x3fc95904 0x00000000
3fc95930: 0x00000001 0x3fc938f4 0x706f6f6c 0x6b736154 0x67661c00 0x00d4b199 0x00000000 0x3fc958f0
3fc95950: 0x00000001 0x00000002 0x00000000 0x00000000 0x00000000 0x3fc8f4f4 0x3fc8f55c 0x3fc8f5c4
3fc95970: 0x00000000 0x00000000 0x00000001 0x00000000 0x00000000 0x00000000 0x4201dc5e 0x00000000#0  0x4201dc5e in _cleanup_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/newlib/newlib/libc/stdio/findfp.c:2293fc95990: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
3fc959b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ELF file SHA256: b7059677e947a7da

在下面就可以看到,发重错误的大概源代码位置了

如:

        #3  0x42001a50 in TFT_eSPI::init(unsigned char) at

.pio/libdeps/wifiduino32c3/TFT_eSPI/TFT_eSPI.cpp:693

参考

https://zhuanlan.zhihu.com/p/710490878

http://www.xdnf.cn/news/14373.html

相关文章:

  • 节日快乐啊
  • 【Docker基础】Docker核心概念:资源隔离详解
  • Docker run 子命令与运行优化相关的参数
  • 因为没有使用路由懒加载,产生了一个难以寻找的bug
  • std::shared_ptr引起内存泄漏的例子
  • Guava RateLimiter 使用详解:从基础使用到生产实践
  • js调试技巧
  • Meta推出AI视频重塑风格工具,现已在Meta AI和Instagram的Edits应用中上线
  • 【项目实训#10】HarmonyOS API文档RAG检索系统后端实现
  • DAY 31 文件的规范拆分和写法
  • 【Erdas实验教程】020:遥感图像空间增强( 图像锐化)
  • 是否需要预先安装 CUDA Toolkit?——按使用场景分级推荐及进阶说明
  • Git可视化革命:3分钟学会用Mermaid+AI画专业分支图
  • 快速入门:创建 Azure 数据资源管理器群集和数据库
  • 《单光子成像》第五章 预习2025.6.14
  • 使用Cursor + Devbox + Uniapp 一站式AI编程开发移动端(App、H5、小程序)
  • wifi架构
  • pikachu靶场通关笔记31 文件包含02之远程文件包含
  • java hashmap详解篇
  • LeetCode - 35. 搜索插入位置
  • 家政维修平台实战27:服务流程搭建
  • 华为云Flexus+DeepSeek征文 | 基于Dify构建股票分析助手
  • Qt事件处理
  • 青少年编程与数学 01-011 系统软件简介 19 SSMS 数据库管理工具
  • Linux上安装Golang及服务服务指南
  • 【学习笔记】Langchain基础(二)
  • 【unitrix】 1.7 规范化常量类型结构(standardization.rs)
  • List的简单模拟实现
  • 软件测试质量的“防”与“治”
  • LeetCode - 69. x 的平方根