You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all! I'm trying to set up dape to debug a STM32 nucleo board for a personal project using openocd as the gdb server. I can't make it work and I don't know why. I tried using a .gdbinit file, put everything inside my .dir-locals and whatnot. When I use the fields like :target I avoid the .gdbinit. I tried to understand the code and the already defined debugger settings inside dape with some degree of success, I read the other answers and I read the gdb documentation about the dap interface, but to no avail. I must have miss something.
Using
emacs 30.1
arm-none-eabi-gdb 14.3 with python support
openocd 0.12.0
What I tried
Manually starting openocd and using only the .dir-locals lead to a gdb client not talking to openocd
Manually starting openocd and using .gdbinit (so without :target and the other options inside .dir-locals) lead to a :initialize timeout triggered by dape (after around 15 seconds even if I set the timeout to 50 seconds)
Using the configuration shared here (dape starts openocd and .gdbinit is used) it seems that dape doesn't start openocd correctly and gdb disconnect beause it can't find any server listening to the desired port.
Thank you in advance!
.dir-locals
;;; local directory variables -*- no-byte-compile: t -*-
((nil . ((dape-request-timeout . 50)))
(nil . ((eval . (add-to-list
'dape-configs
`(gdb-openocd
;; https://github.com/svaante/dape/discussions/238
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 ["interface/stlink.cfg"
"target/stm32u5x.cf"]
modes (c-or-c++-mode c-ts-mode c++-ts-mode)
command-cwd dape-command-cwd
command "arm-none-eabi-gdb-py"
command-args ("--interpreter=dap")
compile "make build_debug"
:type "gdb"
:name "Launch debug"
:request "launch"
;; For the debugger
;; :args [""]
:cwd "./build"
;; :env ""
:program "./Core/Src/firmware.elf"
:stopAtBeginningOfMainSubprogram t
:stopOnEntry t
:target "localhost:3333"
))))))
.gdbinit
# Miscellaneous
set pagination off
set history save on
set history expansion on
#
file ./build/Core/Src/firmware.elf
#
target extended-remote localhost:3333
#
set mem inaccessible-by-default off
#
monitor reset halt
#
load
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
How to make arm-none-eaby-gdb-py + openocd work?
Hi all! I'm trying to set up dape to debug a STM32 nucleo board for a personal project using openocd as the gdb server. I can't make it work and I don't know why. I tried using a
.gdbinitfile, put everything inside my.dir-localsand whatnot. When I use the fields like:targetI avoid the.gdbinit. I tried to understand the code and the already defined debugger settings inside dape with some degree of success, I read the other answers and I read the gdb documentation about the dap interface, but to no avail. I must have miss something.Using
What I tried
.dir-localslead to a gdb client not talking to openocd.gdbinit(so without:targetand the other options inside.dir-locals) lead to a:initializetimeout triggered by dape (after around 15 seconds even if I set the timeout to 50 seconds).gdbinitis used) it seems that dape doesn't start openocd correctly and gdb disconnect beause it can't find any server listening to the desired port.Thank you in advance!
.dir-locals
.gdbinit
Beta Was this translation helpful? Give feedback.
All reactions