You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/2025/11/debugging-embedded-graphics-with-wokwi-and-ai/index.md
+51-45Lines changed: 51 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,16 @@ Raylib is a popular game programming library that recently gained software rende
17
17
18
18
The initial port compiled and ran, but there was a problem: instead of showing solid colors, the display showed vertical yellow/blue stripes. The framebuffer format was clearly wrong, but determining exactly where and how required multiple iterations.
19
19
20
-
## Enter Wokwi: Hardware Simulation in CI/CD
20
+
## Enter Wokwi: Hardware Simulation for Bug Hunting
21
21
22
-
Rather than flash to physical hardware for every test, we integrated Wokwi - a hardware simulator that can emulate ESP32 boards with displays. This gave us several advantages:
22
+
Rather than flash to physical hardware for every test, we used Wokwi - a powerful hardware simulator that can emulate ESP32 boards with displays. Wokwi is particularly valuable for bug hunting in embedded graphics applications because it provides:
23
23
24
-
1.**Fast iteration cycles**: No need to physically flash devices
25
-
2.**Screenshot capability**: Wokwi can capture display output as PNG files
26
-
3.**Reproducible testing**: Same simulation conditions every time
27
-
4.**CI/CD integration**: Automated testing in GitHub Actions
24
+
1.**Screenshot Capability**: Capture display output as PNG files at any point in execution - crucial for visual debugging
25
+
2.**Integrated Debugger**: Step through code, set breakpoints, and inspect variables without physical hardware
26
+
3.**Fast Iteration Cycles**: No need to physically flash devices between tests
27
+
4.**Reproducible Testing**: Same simulation conditions every time, eliminating hardware variability
28
+
5.**IDE Integration**: Works seamlessly with VSCode and CLion for professional development workflows
29
+
6.**CI/CD Ready**: Automated testing in GitHub Actions with screenshot validation
1.**Visual Feedback is Critical**: Color bugs can't be debugged with logs alone - you need to see the actual output
164
-
2.**Wokwi's Consistency**: Same simulation every time meant we could isolate variables
165
-
3.**AI Vision + Code Understanding**: The AI could correlate visual output with code changes
166
-
4.**Fast Iteration**: ~2 minutes per cycle (build + simulate + analyze) vs. hours with physical hardware
167
-
5.**Executable Investigation**: The AI could directly build, simulate, and capture screenshots
166
+
1.**Visual Feedback is Critical**: Color bugs can't be debugged with logs alone - you need to see the actual output. Wokwi's screenshot capability made this trivial
167
+
2.**Wokwi's Debugging Power**: The integrated debugger would have allowed stepping through framebuffer operations if screenshots weren't sufficient
168
+
3.**Wokwi's Consistency**: Same simulation every time meant we could isolate variables and prove fixes definitively
169
+
4.**AI Vision + Code Understanding**: The AI could correlate visual output with code changes by reading Wokwi screenshots
170
+
5.**Fast Iteration**: ~2 minutes per cycle (build + simulate + analyze) vs. hours with physical hardware
171
+
6.**Professional Development Environment**: Wokwi's VSCode and CLion integration meant we could debug just like with physical hardware
168
172
169
173
### Limitations We Hit
170
174
171
-
1.**MCP Connection Drops**: Wokwi MCP server would occasionally disconnect, requiring restart
172
-
2.**Screenshot Timing**: Had to carefully time captures to match test sequence (red at 2.7s, green at 3.9s, etc.)
173
-
3.**Endianness Assumptions**: Even AI made wrong guesses about byte order initially
175
+
1.**Screenshot Timing**: Had to carefully time captures to match test sequence (red at 2.7s, green at 3.9s, etc.) - though Wokwi's debugger could have helped pause at exact moments
176
+
2.**Endianness Assumptions**: Even AI made wrong guesses about byte order initially, requiring multiple iterations
174
177
175
178
## Lessons for Embedded Development
176
179
177
-
### 1. Simulation-First Development
180
+
### 1. Simulation-First Development with Wokwi
178
181
179
-
Don't wait until hardware is available. Tools like Wokwi let you:
180
-
- Test display output without physical devices
181
-
- Capture exact visual state for comparison
182
-
- Integrate visual testing into CI/CD
182
+
Don't wait until hardware is available. Wokwi provides a complete development environment:
183
+
-**Screenshot capture** for visual debugging - essential for graphics bugs
184
+
-**Integrated debugger** with breakpoints and variable inspection
185
+
-**IDE integration** with VSCode and CLion for professional workflows
186
+
-**Test display output** without physical devices
187
+
-**Capture exact visual state** for comparison and regression testing
188
+
-**CI/CD integration** for automated visual testing
183
189
184
190
### 2. AI as Debugging Partner
185
191
@@ -196,7 +202,7 @@ The key was having a repeatable process:
Each step was automated or AI-assisted, keeping human focus on problem-solving.
205
+
Each step was automated or AI-assisted, keeping developer focus on problem-solving. Wokwi's screenshot capability was the key enabler - without it, we'd need physical hardware and manual camera captures for each test.
0 commit comments