-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] [Cortex-Debug] Debugger for STM32 #224
Comments
Thank you. Let me know if you have any issues with that. |
So looks like I have a lack of knowledge how to configure this one right.
next arm-none-eabi-gdb :
then in gdb session or as --ex argument:
and session is going, ofc. in case of dap-mode arm-none-eabi-gdb should be in mi mode (--interpreter=mi) Another way is to use Cortex-debug, but for me is not obvious which file is responsible for start gdb debugger, I assume that similar to for example cppdbg is gdb.js but I need to dig more. Another thing that this debbuger fire up automatically OpenOCD - looks like in pipe manner. I have full working example in VSCode on procesor STM32F411.
And LOG from Cortex-debug gdb
My biggest problem is that I don't have knowledge about Elisp (yet), so it will take some time to adapt.
|
Something like that should be the initial version. (dap-register-debug-provider "cortex-debug" #'identity)
(dap-debug
(list :type "cortex-debug"
:request "launch"
:servertype "openocd"
:dap-server-path '("node" "<FIXME path-to-extension>/dist/debugadapter.js")
:cwd "<FIXME path to project>"
:internalConsoleOptions "openOnSessionStart"
:executable "./build/vsarm_firmware.elf"
:name "Debug (openocd)"
:device "STM32F411CE"
:v1 false
:svdFile "<FIXME path to project>/STM32F411.svd"
:configFiles ["/usr/share/openocd/scripts/interface/stlink-v2-1.cfg"
"/usr/share/openocd/scripts/target/stm32f4x.cfg"])) |
Any plans of getting this feature in? |
It all depends on someone with expertise in the domain taking care of this. Alternatinatively, someone from the core team can take care of this if there is simple to follow recipe how to make that work in vscode. Consider the fact that this is the first time I have heard of STM32/Cortex. |
Same as @tosiek88, I have a fully working example in VSCode, but have no idea of lisp, and have never come across |
@roangel fyi: dap-mode supports launch.json files. After a quick glimpse at yours, I think it should work. So just copy your launch.json file to .vscode/launch.json in your project root, and everything should work. There are currently some limitations (not full json5 support, i.e. no trailing commas), but most things should work. |
Variables also work just fine, so you don't need to replace ${workspaceFolder}, etc. with anything else. |
Nevermind, I overlooked "type": "cortex-debug". Yeah, we need to support cortex-debug first, then you can use your launch.json unmodified. |
I wonder, if this can be done: https://www.eggers-club.de/blog/2017/07/01/embedded-debugging-with-lldb-sure/ I guess that if we have lldb-vscode working with dap-mode, which we do, it shouldn't be crazy hard to connect both ends right? |
I have an st-link with me and a stm32 microcontroller to debug. This works for me: Problem is I am finding problems to pass the right commands to lldb. Does anyone know how to pass these startup commands to lldb from the debug-template?
|
Is this lldb-vscode or native debug adapter? Usually, the best way to find that info is to look at the package.json for vscode package or debug adapter sources. |
I compiled the |
Hi again I don't have to much time to work with this, but for my point of view better to adapt https://github.com/Marus/cortex-debug/ it has written debugger adaptor, and can be fire up even from node js. in Package.json there is all the commands how to work with it. |
Hi, @yyoncho I think dap-gdb-lldb.el almost can do the same thing.
Then the launch.json config file
here is the gdb init file
arm-none-eabi-gdb need a init file to write image to MCU, in case, if the image on MCU is different from current elf file, the single step/break points will have errors. And also need to start a gdb server from the console, I use openocd. |
@c2real nice!
I think you can pass those through the template itself without code change, no? Other than that if you are willing to write a blog/tutorial/wiki I will be happy to link it from lsp-mode docs and popularize it because it all seems to narrow down to documentation. |
yes, pass all parameters via launch.json should be ok. I will test later, and write a brief guide on how to setup the develop environment with stm32 evk board. |
Is there some way to have it start OpenOCD automatically, perhaps by specifying a tty? |
I think that cortex-debug should do it , because : and VSCode config fire up this: in https://github.com/Marus/cortex-debug/blob/master/package.json there is a path to OpenOCD GDB server that need to be specify. |
I write a brief note about how I setup the dap-mode/dap-gdb-lldb. here the link https://github.com/c2real/dap-mode-setup-for-mcu/blob/main/README.md |
Yes, it could work, and when you terminate the debugging, you should also close the openocd process, otherwise, next time, when start again, another process try to access the usb device, it may cause problem. I am not good at emacs-lisp, so just start the openocd process at the very beginning once, it will be ok. |
Does the adapter itself not have such a feature? If not, then this should probably be implemented upstream, if at all. |
Today I made some test and looks like the Cortex-Debug can be adopted - Parts of this debuger are based upon Jan Jurzitza's (WebFreak) code-debug which is already working in dap-mode.
I will try to add provider and we will see how its cooperate, it will be amazing debugging cortex uC in emacs !
The text was updated successfully, but these errors were encountered: