rust-embedded/cortex-m-quickstart

VSCode GDB Launch Configuration Not Taken From `openocd.gdb`

david-boles opened this issue · 6 comments

Would it be possible to configure the VSCode cortex-debug extension to pull its gdb commands from openocd.gdb? I ran into this when trying to use semihosting, openocd.gdb enables it but the cortex-debug launch configuration doesn't. If not (I couldn't see how), should I make a pull request to add "preLaunchCommands": ["monitor arm semihosting enable"] to the launch configurations?

AFAIK it’s not currently possible to load a gdb script through the cortex-debug extension. I would encourage you to open an issue there as I couldn’t find a related one.

I think it’s reasonable to open a PR that adds semihosting to the QEMU launch config, since the stm32f303 config is set up to use ITM. That way we have an example for both communication mechanisms. QEMU doesn’t support ITM, so it seems reasonable, to me, for it to be the one to be configured for semihosting.

You can add this to your launch.json. Worked nicely with stm32g0.

            "postLaunchCommands": [
                "monitor arm semihosting enable",
            ],

Also cortex-debug supports a lot of parameters that can be tweaked: https://github.com/Marus/cortex-debug/blob/master/package.json#L195

Damn, I should have read OP more carefully. It was all there.

Can this issue be closed?

Is there a way to configure the extension to show hprintln output?

Ah, nevermind, hprintln output is in the gdb-server terminal.