I'm trying to move away from doing my firmware development in Eclipse GNU MCU for several reasons, mostly related to project maintainability (much easier to integrate CMake such that there is only one build system), and also for better Intellisense etc.

I seem to have most of everything working, except I can't seem to find any way to send commands via semihosting. Basically I have a command line interface to the embedded system via semihosting, where I can do things like command IOs on/off etc etc, which is a big help in debugging.

Now that I've got my basic configuration set up, what happens when I start my debug session is that the code compiles, is flashed (via OpenOCD with STLink), and the debug session starts, halted at the entry point. When I then continue, I see the semihosting output in the "Output/Adapter Output", which holds the as expected OpenOCD console. However, if I try to write text to enter a command (which is how it works under Eclipse), I get "Cannot edit in read-only editor".

I've attached a screen cap to show what I mean, the last three lines are output from my console running in the embedded device: OpenOCD console in VSCode

If I run OpenOCD and arm-none-eabi-gdb separately in terminal, I can write to the OpenOCD console, so it seems that the Cortex-Debug extension needlessly makes the window read-only under VSCode.

Is there any way to use bidirectional semihosting in VSCode? Even a workaround, such as connecting to OpenOCD via telnet (or rather nc) will do (I've tried, but writing commands there also don't seem to go to the semihosting pipe), if this can't be done directly in VSCode. Or sending text to semihosting via the GDB console, which does allow writing. However, running gdb and OpenOCD completely separately is not a solution, since then I don't get any of the other debugging features in VSCode.

I'm on OS X Mojave and VSCode, Cortex-Debug and OpenOCD are the newest versions at the time of writing.

Please let me know if this not the right SE, I suppose this could go to Stack Overflow or even SuperUser, but I though this is the right place since the question is very embedded-systems specific.

  • 2
    \$\begingroup\$ I don't think the question is misplaced here, but the experts for cortex-debug are certainly more active on their github repository than here. So I'd open an issue on certex-debug there and see if I get an answer. \$\endgroup\$
    – Arsenal
    Apr 1, 2021 at 11:16
  • 1
    \$\begingroup\$ @Arsenal thanks, I'll do that and might even self-answer if I can get that cleared up in there. \$\endgroup\$
    – Timo
    Apr 1, 2021 at 11:25
  • \$\begingroup\$ I asked here: github.com/Marus/cortex-debug/issues/420 but no answers this far... \$\endgroup\$
    – Timo
    May 5, 2021 at 12:18

2 Answers 2


VSCode can do whatever the plugin you're using supports. This isn't really a limitation of VSCode specifically.

Unfortunately, it IS a limitation of cortex-debug. cortex-debug, as of this writing, does not support semihosting. It doesn't work because it hasn't been added yet. I would point you to the project's README.md on github under the planned features section:

enter image description here

I certainly understand the desire to move away from Eclipse. But I don't think there is a solution here that won't involve either using a different VSCode plugin (if one exists), or perhaps exploring some other editors and see if they have any suitable plugins with semihosting support.

Or you could always try and add it yourself (and make a pull request if you do!) since it appears to already have most of the required functionality already there, so it might not be too difficult. But I'm sure it isn't what you planned on spending your time on.

I know this wasn't the answer you wanted to hear, but that is the current situation. On the plus, they do seem to at least be planning on adding it.

  • \$\begingroup\$ It supposedly works now, might be useful to update this answer accordingly if someone figures it out. \$\endgroup\$
    – DarkFranX
    Feb 17, 2023 at 18:12

Cortex-Debug no longer uses the "Adapter Output" in the OUTPUT tab. That was for output only so, it is now available in the TERMINAL tab like a shell where a gdb-server sub-window is created. This is a bi-directional window and you can use semi-hosting interactions here. This works for gdb-servers like openocd which interact on its own stdout/stderr for semi-hosting.

If your gdb-server uses a TCP port you can something like putty or netcat in a separate terminal window.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.