
iot-firmware-defect-analysis
Analyze and debug IoT firmware defects with automated diagnostics
What You Can Do
This skill analyzes IoT firmware logs, stack traces, and binary files to identify root causes of device failures and performance issues. You can submit crash dumps, error logs, or source code snippets, and receive actionable debugging reports with recommended fixes, architectural improvements, and test strategies to prevent recurrence.
Features
extract register states, memory dumps, and exception information to pinpoint failure points
match log timestamps and error codes to identify patterns and systemic issues
buffer overflows, memory leaks, race conditions, and resource exhaustion using static analysis heuristics
create minimal test cases and scenarios to help QA and field teams reproduce and verify fixes
identify design flaws, suggest refactoring patterns, and propose firmware modularity enhancements
analyze diffs and test coverage to assess whether proposed fixes introduce new regressions
generate device-specific debugging workflows for field engineers and support teams
Example Output
Example 1: Crash Dump Analysis
Crash Analysis Report — Device ID: esp32-prod-4521
✓ Root Cause: Buffer overflow in WiFi packet handler (line 234 of wifi_driver.c)
✓ Evidence: Stack pointer corrupted, exception code 0x28 (LoadProhibited)
✓ Reproduction: Send crafted 802.11 frame >256 bytes to unprotected rx_buffer
✓ Fix: Add bounds check before memcpy() and increase buffer to 512 bytes
✓ Risk: Low — isolated to rx handler, no cross-module impact
Example 2: Memory Leak Detection
Memory Profiling Summary — 48 hours runtime
⚠ Leak detected: mqtt_client_init() allocates 2KB per reconnection
→ After 1,000 reconnections = 2MB heap consumed
→ Leads to heap fragmentation and malloc() failures by day 2
✓ Fix: Add mqtt_client_destroy() cleanup in error path
✓ Test: Simulate 10k reconnections, verify heap remains <50KB
Example 3: Race Condition Report
Concurrency Analysis — BLE Advertisement Task
⚠ Race detected: adv_data_t global struct written by 2 threads
→ Thread A: BLE stack updates adv_data.payload (line 156)
→ Thread B: Application task updates adv_data.flags (line 89)
→ No mutex protection = data corruption every ~4k adv packets
✓ Fix: Add rtos_mutex_t to adv_data_t, acquire lock in both paths
✓ Verification: ThreadSanitizer simulation confirms no data races
What's Included
- SKILL.md: Complete firmware analysis workflows, defect detection heuristics, and diagnostic decision trees
- Diagnostic Checklist Template: Device model-specific debugging steps for common defects (crashes, hangs, memory issues)
- Crash Dump Parser: Structured format guide for stack traces, register dumps, and exception codes
- Reproduction Test Case Template: Format for step-by-step reproduction steps, expected vs. actual behavior, and verification criteria
- Patch Review Checklist: Risk assessment framework for firmware changes (scope, test coverage, regression risk)
- Memory Profiling Log Template: Structure for heap/stack usage data to detect leaks and fragmentation
Who It's For
- Embedded Systems Engineers — Debug firmware crashes and optimize embedded C code
- IoT Device Manufacturers — Analyze field failures and reduce warranty returns
- QA/Test Engineers — Create regression test cases and verify firmware patches
- Field Service/Support Teams — Generate device-specific troubleshooting guides for remote diagnostics
- DevOps/CI Pipeline Teams — Automate firmware quality checks in build pipelines
Best For
- Analyzing crash dumps and stack traces from production devices
- Identifying memory leaks, buffer overflows, and race conditions in firmware
- Creating minimal reproduction steps for intermittent device failures
- Assessing firmware patch safety before deployment to production fleet
- Generating diagnostic checklists for field technicians and customer support






