Debugging¶
The app runs on the device, and GDB reaches it through the Black Magic probe on the WiFi Devboard. Only our code is stepped through: the SDK ships no firmware sources, so firmware calls are stepped over. The board's setup is on Debug probe.
Before a session¶
The device must run the firmware the SDK pins,
have Settings → System → Debug on, which otherwise disables its debug port,
and stay unlocked:
a PIN lock drops its USB console, and mise run launch fails.
Turn auto-lock off in Settings → Desktop for the session.
Attach the board in this order:
- Pull the board's cable and power the device off.
- Seat the board on the GPIO header.
- Power the device on by holding Back, and enter the PIN.
- Plug the board's cable, then the device's cable, into the Mac.
If the device will not power on, take the board off, pull its cable, and hold Back for 30 seconds.
After the session, take the board off and pull its cable, for the risks it carries.
In CLion¶
In a clone CLion has opened:
- Pick
Flipperin the Debug Profiles list on the toolbar. CLion lists its own profiles first, so a clone needs this once. - Set a breakpoint in our sources.
- Run the
Debugconfiguration. - Run the
Launchconfiguration. CLion stops in disassembly atflipper_application_alloc_thread: the app is loaded and its symbols are in. - Press Resume. CLion stops on the breakpoint.
- Press Stop when done.
The red
exit code 137 (interrupted by signal 9:SIGKILL)is CLion ending GDB after it detached, and it is harmless.
In a terminal¶
From .mise/tasks/:
debugopens GDB on the device in the terminal.
mise run debug # GDB on the device; leave it with `quit`
mise run launch # in another terminal
Leave with quit rather than killing the process:
this session sets the firmware's debug flag and clears it on the way out,
and with the flag left set the next app to start faults the device.