PlatformIO integration for the Kate editor: build, upload, serial monitor, debugging (DAP) and clangd IntelliSense
- C++ 62.1%
- Python 36.4%
- CMake 1.5%
Debug bridge (pio-dap.py): - Always stop the debug server: cleanup() is serialized so the gdb reader can no longer exit before the server is stopped; SIGTERM/SIGHUP/SIGINT stop all children; children get PR_SET_PDEATHSIG so they also die when the bridge is SIGKILLed. The pre-debug build is tracked and stopped too. - Server ready patterns starting with '^' now match any line (re.search with re.M, checked per line); the buffer is trimmed at line boundaries. - Run to the init break with a DAP continue request after configurationDone instead of `continue` inside the hookpost-remote hook, which blocked the attach request and confused gdb's DAP state. - Disconnect/terminate: halt a running target before pio_reset_run_target, reset only once, and swallow late responses to injected requests (including the failure-path disconnect). - Re-exec: resolve `#!/usr/bin/env python3` shebangs, honour PLATFORMIO_CORE_DIR, and never re-exec more than once. - Espressif gdb installer: fail when debuggers were not installed and fall back to a checked extraction on Pythons without tarfile filters. - Cache uv_python_envs(). Kate plugin: - Port refresh no longer gets stuck when `pio device list` fails to start. - Without Konsole the serial monitor (and other terminal tasks) runs as an output-only process in its tab, outside the task queue, with Stop/Start. - Tasks run in their own process group; Stop and interrupting a background IntelliSense build signal SCons/compiler children too, and the interrupted compiledb task is queued again. - "Monitor was running" is tracked per upload instead of in a shared member; port tasks share one runPortTask() helper. - Problems de-duplication uses a set; removed an empty if block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| bridge | ||
| src | ||
| .gitignore | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
kate-platformio
PlatformIO integration for the Kate editor (KF6 / Kate 24+, tested on 26.08).
- PlatformIO tool view with environment and serial port pickers. Port hot-plug is detected automatically.
- Tasks: Build, Upload, Upload & Monitor, Clean, Test, Full clean, Build/Upload FS, Erase, Menuconfig,
pio check, package update. - Output: colored task output, plus a Problems list of compiler errors. Double-click either one to jump to the source line.
- Serial monitor in an embedded Konsole, i.e.
pio device monitorwith full keyboard input. It is stopped before uploads and restarted after. - IntelliSense: keeps
compile_commands.jsonup to date (pio run -t compiledb). It also writes a.kateprojectthat runs clangd with--query-driverfor the cross GCC, and a.clangdthat strips GCC-only flags. - Debugging in Kate's Debugger through
bridge/pio-dap.py, a Debug Adapter Protocol bridge. It drives a DAP-capable gdb (gdb ≥ 14 with Python) using PlatformIO's own debug configuration: debug server, load commands, init break. It works with VS Code-style.vscode/launch.jsonentries of"type": "platformio-debug". - ESP32 (Xtensa): PlatformIO › Install Espressif Debugger downloads Espressif's gdb ≥ 14, which supports DAP. If the system Python doesn't match, a uv-managed Python is used.
- Fallback: Debug in GDB Console runs
pio debug --interface=gdbin a terminal tab.
Shortcuts: Ctrl+Alt+B build, Ctrl+Alt+U upload, Ctrl+Alt+S monitor, Ctrl+Alt+D debug.
Install
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/.local \
-DKATE_PLUGIN_DIR=$HOME/.local/lib/qt6/plugins/kf6/ktexteditor
cmake --build build && cmake --install build
# make Qt find user-local plugins (log out/in afterwards):
mkdir -p ~/.config/environment.d
echo 'QT_PLUGIN_PATH=$HOME/.local/lib/qt6/plugins:/usr/lib/qt6/plugins' > ~/.config/environment.d/kate-platformio.conf
For a system-wide install, omit both -D options and run sudo cmake --install build.
Then enable PlatformIO, Debugger, LSP Client and Projects in Settings › Configure Kate › Plugins.
Requires: Qt 6.5+, KF6 (TextEditor, Parts, XmlGui, I18n), Konsole (interactive monitor; without it the monitor is output-only), PlatformIO Core, clangd, gdb ≥ 14 with Python.
Status
- Verified: build/upload/IntelliSense tasks, project setup, the DAP bridge on
native, and connect + flash over a Black Magic Probe (RP2040). - BMP run-control is still being debugged.
- BMP
attachaborts gdb in DAP mode. The bridge works around this with an RSP attach proxy (--rsp-attach).
License
MIT. The bridge only uses PlatformIO's (Apache-2.0) Python API and does not copy its code.