esp32-debugging by laurigates/mcu-tinkering-lab
npx skills add https://github.com/laurigates/mcu-tinkering-lab --skill esp32-debugging当用户遇到以下情况时,应用此技能:
缺少包含文件
fatal error: driver/gpio.h: No such file or directory
修复:检查 CMakeLists.txt 并将组件添加到 REQUIRES:
idf_component_register(
SRCS "main.c"
REQUIRES driver
)
未定义的引用
undefined reference to 'some_function'
修复:确保包含该函数的组件位于 REQUIRES 或 PRIV_REQUIRES 中。
类型错误 查找函数声明和实现之间的类型不匹配。
Guru Meditation Error 模式
| 错误 |
|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 原因 |
|---|
| 修复 |
|---|
StoreProhibited | 写入无效内存 | 检查指针初始化 |
LoadProhibited | 从无效内存读取 | 检查空指针 |
InstrFetchProhibited | 函数指针损坏 | 检查回调函数赋值 |
IntegerDivideByZero | 除以零 | 添加零值检查 |
堆栈溢出
Guru Meditation Error: Core 0 panic'ed (Stack overflow)
修复:在任务创建时增加堆栈大小:
xTaskCreatePinnedToCore(task_fn, "name", 4096, NULL, 5, NULL, 0);
// ^^^^ 增加此值
堆栈破坏
Stack smashing detected
修复:局部缓冲区溢出 - 检查数组边界和字符串操作。
检查堆使用情况
ESP_LOGI(TAG, "Free heap: %lu", esp_get_free_heap_size());
ESP_LOGI(TAG, "Min free heap: %lu", esp_get_minimum_free_heap_size());
常见内存问题
malloc() 后缺少 free()I2C 问题
E (1234) i2c: i2c_master_cmd_begin(xxx): I2C_NUM error
检查清单:
串口/UART 问题
# 清理构建以消除过时对象
make robocar-clean && make robocar-build-main
# 使用详细输出构建
cd packages/esp32-projects/robocar-main && idf.py build -v
# 启动串口监视器
make robocar-monitor-main PORT=/dev/cu.usbserial-0001
在 sdkconfig 中或通过 idf.py menuconfig 启用:
CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT - 重启前打印崩溃信息CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK - 更早检测堆栈溢出CONFIG_HEAP_POISONING_COMPREHENSIVE - 检测堆损坏用户报告:"我的 ESP32 在启动时不断崩溃"
用户报告:"I2C 设备无响应"
每周安装量
76
代码仓库
GitHub 星标数
2
首次出现
2026年1月28日
安全审计
安装于
codex67
gemini-cli66
opencode66
github-copilot62
cursor60
amp58
Apply this skill when the user:
Missing Includes
fatal error: driver/gpio.h: No such file or directory
Fix: Check CMakeLists.txt and add the component to REQUIRES:
idf_component_register(
SRCS "main.c"
REQUIRES driver
)
Undefined References
undefined reference to 'some_function'
Fix: Ensure the component containing the function is in REQUIRES or PRIV_REQUIRES.
Type Errors Look for mismatched types between function declarations and implementations.
Guru Meditation Error Patterns
| Error | Cause | Fix |
|---|---|---|
StoreProhibited | Writing to invalid memory | Check pointer initialization |
LoadProhibited | Reading from invalid memory | Check null pointers |
InstrFetchProhibited | Corrupted function pointer | Check callback assignments |
IntegerDivideByZero | Division by zero | Add zero checks |
Stack Overflow
Guru Meditation Error: Core 0 panic'ed (Stack overflow)
Fix: Increase stack size in task creation:
xTaskCreatePinnedToCore(task_fn, "name", 4096, NULL, 5, NULL, 0);
// ^^^^ increase this
Stack Smashing
Stack smashing detected
Fix: Local buffer overflow - check array bounds and string operations.
Check Heap Usage
ESP_LOGI(TAG, "Free heap: %lu", esp_get_free_heap_size());
ESP_LOGI(TAG, "Min free heap: %lu", esp_get_minimum_free_heap_size());
Common Memory Issues
free() after malloc()I2C Issues
E (1234) i2c: i2c_master_cmd_begin(xxx): I2C_NUM error
Checklist:
Serial/UART Issues
# Clean build to eliminate stale objects
make robocar-clean && make robocar-build-main
# Build with verbose output
cd packages/esp32-projects/robocar-main && idf.py build -v
# Start serial monitor
make robocar-monitor-main PORT=/dev/cu.usbserial-0001
Enable in sdkconfig or via idf.py menuconfig:
CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT - Print panic info before rebootCONFIG_FREERTOS_WATCHPOINT_END_OF_STACK - Detect stack overflow earlierCONFIG_HEAP_POISONING_COMPREHENSIVE - Detect heap corruptionUser reports: "My ESP32 keeps crashing on startup"
User reports: "I2C device not responding"
Weekly Installs
76
Repository
GitHub Stars
2
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex67
gemini-cli66
opencode66
github-copilot62
cursor60
amp58
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
Bug 闪电战:AI 代理并行修复代码缺陷,自动化 bug 解决流程
4 周安装
Stitch设计系统技能:自动生成语义化设计文档,实现UI一致性
4 周安装
Oracle IDCS组织配置技能:解决登录后租户、角色与成员资格生效问题
4 周安装
ElysiaJS DDD 架构指南:使用 Prisma 和 Better Auth 构建可扩展后端 API
4 周安装
Remotion Render - 在线从React组件渲染视频,快速生成动画与动态内容
4 周安装
qwen-image-2-pro AI图像生成技能 - 25.3K周安装量,集成于Claude/Codex/Kimi等主流AI工具
4 周安装