lldb-dap + openocd #238
Answered
by
svaante
ssilnicki-dev
asked this question in
Q&A
-
|
Hello! what is the easiest way to start/stop/tune openocd as debug server and then configure lldb session to work with JTAG connected target? With lldb-vscode's approach with its initCommands, attachCommands,terminateCommands it was not that cumbersome, but I struggle with dape to achieve similar convenience. |
Beta Was this translation helpful? Give feedback.
Answered by
svaante
Jun 8, 2025
Replies: 1 comment 1 reply
-
|
Hey! (add-to-list
'dape-configs
`(lldb-dap-openocd
,@(alist-get 'lldb-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 ["platform/stm32f4.cfg"]
:initCommands ["platform select remote-gdb-server"
"target connect connect://localhost:3333"
"monitor reset halt"]
:exitCommands ["monitor shutdown"]
:terminateCommands ["monitor shutdown"]))
Also there is the integration with cortext-debug adapter https://github.com/svaante/dape-cortex-debug |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ssilnicki-dev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey!
This is some kind of starting point for how a openocd + lldb-dap could look like (have not test it).