From a794dac7d4fad23efefd9447204236cd4f3ff35d Mon Sep 17 00:00:00 2001 From: ju6ge Date: Thu, 26 Jun 2025 18:31:44 +0200 Subject: [PATCH] intial emacs config for debugging via openocd --- .doomrc | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .doomrc diff --git a/.doomrc b/.doomrc new file mode 100644 index 0000000..7299146 --- /dev/null +++ b/.doomrc @@ -0,0 +1,39 @@ +;;; .doomrc --- doom runtime config -*- mode: emacs-lisp; lexical-binding: t; -*- +;;; Commentary: +;;; Code: +(require 'doom) ; be silent, byte-compiler + +(after! dape + (add-to-list + 'dape-configs + `(gdb-dap-openocd + ,@(alist-get 'gdb-dap dape-configs) + fn (lambda (config) + (let* ((default-directory (dape--guess-root config)) + (openocd + ;; Run openocd with config files from `openocd-files' property + (start-process-shell-command + "openocd" "*openocd*" + (concat "openocd" + (mapconcat (lambda (file) + (concat " -f " (shell-quote-argument file))) + (append (dape-config-get config 'openocd-files) nil))))) + probe) + ;; Wait until port is open + (while (and (process-live-p openocd) + (not (setq probe (ignore-errors + (make-network-process :name "openocd port probe" + :service 3333))))) + (sleep-for 0.1)) + ;; Close probe connection + (when probe + (delete-process probe))) + config) + openocd-files ["openocd.cfg"] + :initCommands ["target remote 10.128.5.10:3333" + "monitor reset halt"] + :exitCommands ["monitor shutdown"] + :terminateCommands ["monitor shutdown"])) +) + +;;; .doomrc ends here