rust-embedded / cortex-m-quickstart

Template to develop bare metal applications for Cortex-M microcontrollers
782 stars 164 forks source link

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

Open david-boles opened 4 years ago

david-boles commented 4 years ago

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?

rubberduck203 commented 4 years ago

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.

andresv commented 4 years ago

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

andresv commented 4 years ago

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

rubberduck203 commented 3 years ago

Can this issue be closed?

reitermarkus commented 2 years ago

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

reitermarkus commented 2 years ago

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