
esp32-debugging
Debug ESP32 firmware issues including compilation errors, runtime panics, memory issues, and communication failures
- Installs
- 303
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/laurigates/mcu-tinkering-lab --skill esp32-debugging- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads esp32-debugging automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
ESP32 Firmware Debugging Guide
When to Use This Skill
Apply this skill when the user:
- Encounters compilation errors in ESP-IDF projects
- Sees runtime panics or "Guru Meditation Error" messages
- Has memory-related crashes or stack overflows
- Experiences I2C/SPI/UART communication failures
- Needs help interpreting serial monitor output
$ARGUMENTS may contain error messages or context about the issue.
Debugging Process
Ask for Context First
If the error isn't clear from $ARGUMENTS, ask the user to provide:
- Full error message or panic output
- Which project they're building
- Recent code changes
1. Compilation Error Analysis
Run a fresh build to capture the error:
just <project>::build 2>&1 | tail -100
Missing Includes
fatal error: driver/gpio.h: No such file or directory
Fix: Add the component to REQUIRES in main/CMakeLists.txt:
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.
2. Runtime Panic Analysis
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 |
Double exception, backtrace CORRUPTED, A0 = a recognisable constant (e.g. 0x10000000) | Stack buffer overflow upward into caller frames — a VLA or local array indexed past its end; the canary only watches the low end | Read the code between the last log line and the panic; look up the top byte of A0 in the driver just called. See .claude/rules/gated-init-paths.md |
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.
That message needs CONFIG_COMPILER_STACK_CHECK_MODE_* enabled. With it off (the robocar-unified default) the same overflow reports as a double exception with a corrupted backtrace instead — see the table above. Pin the fix with a host test that compiles the file unmodified under -fsanitize=address (packages/robocar/unified/test/test_pca9685_multi.c is the template).
3. Memory Debugging
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
- Memory leak: Missing
free()aftermalloc() - Double free: Freeing same memory twice
- Use after free: Accessing freed memory
4. Communication Debugging
I2C Issues
E (1234) i2c: i2c_master_cmd_begin(xxx): I2C_NUM error
Checklist:
- Verify I2C address (7-bit vs 8-bit format)
- Check SDA/SCL GPIO pins
- Ensure pull-up resistors are present (4.7K typical)
- Verify clock frequency compatibility
Serial/UART Issues
- Baud rate mismatch
- TX/RX swapped
- Missing ground connection
Dual-Controller Sync (I2C)
- Check both controllers are running
- Verify I2C addresses match
- Check GPIO pin configuration
5. Build Commands for Debugging
# Clean build to eliminate stale objects
just <project>::clean && just <project>::build
# Start serial monitor
just <project>::monitor PORT=/dev/cu.usbserial-0001
6. Useful ESP-IDF Config Options
Enable in sdkconfig.defaults or via 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 corruption
Common Fixes
| Symptom | Fix |
|---|---|
| Stack overflow | Increase task stack size in xTaskCreate |
| Memory leak | Check for missing free() calls |
| I2C timeout | Verify connections, pull-ups, addresses |
| Crash on startup | Increase CONFIG_ESP_MAIN_TASK_STACK_SIZE to 8192+ |
FAQ
What does the esp32-debugging skill do?
Debug ESP32 firmware issues including compilation errors, runtime panics, memory issues, and communication failures
How do I install esp32-debugging?
Run npx skills add https://github.com/laurigates/mcu-tinkering-lab --skill esp32-debugging in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/esp32-debugging/ (personal) or .claude/skills/esp32-debugging/ (project).
Which AI agents can use esp32-debugging?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is esp32-debugging safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains esp32-debugging?
It is published by laurigates in laurigates/mcu-tinkering-lab. It has 303 recorded installs.
More from laurigates/mcu-tinkering-lab
embedded-best-practices
laurigates/mcu-tinkering-lab
Open the skill to read its SKILL.md instructions.
esp-idf-setup
laurigates/mcu-tinkering-lab
Open the skill to read its SKILL.md instructions.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.