SKILL.md
Flipper Debug
Debug Flipper Zero applications and firmware issues using available tools and techniques.
Context
- Flipper Zero runs on STM32WB55 microcontroller
- Uses FreeRTOS operating system
- Limited debugging capabilities compared to desktop development
- Serial console available via CLI
Debugging Tools
- Serial CLI:
- Connect via scripts/serial_cli.py - Use log command to view system logs - free command shows memory usage - ps shows running processes
- Log System:
``c FURILOGE(TAG, "Error message"); FURILOGW(TAG, "Warning message"); FURILOGI(TAG, "Info message"); FURILOGD(TAG, "Debug message"); ``
- Memory Debugging:
- Use memmgrheapprintffreeblocks() to check heap - Monitor stack usage with furithreadgetstackspace() - Check for memory leaks with allocation tracking
Common Issues and Solutions
- App Crashes:
- Check for null pointer dereferences - Verify proper memory allocation/deallocation - Ensure GUI elements are properly cleaned up - Check stack overflow (increase stack_size in application.fam)
- GUI Issues:
- Verify view_dispatcher is properly configured - Check scene transitions and cleanup - Ensure proper event handling - Validate input parameters
- Hardware Issues:
- Check GPIO pin configurations - Verify SPI/I2C initialization - Test with known working hardware - Use oscilloscope for signal analysis
Debugging Process
- Reproduce the issue consistently
- Add logging at key points
- Check memory usage and leaks
- Use CLI tools for system state
- Test with minimal code to isolate problem
- Review similar working code in codebase
Hardware Debugging
- Use SWD debugger with OpenOCD
- ST-Link or Black Magic Probe supported
- GDB debugging available with proper setup
- Check
scripts/debug/for configuration files