Skip to content

Commit 5266f25

Browse files
Document support for embedded/cross dev
For eng/ide/ada_language_server#1375
1 parent a988b52 commit 5266f25

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,40 @@ The GNATtest integration in VS Code also supports running tests in coverage mode
306306

307307
Integrating the steps of source instrumentation and test harness build into the test execution workflow allows for a quick feedback loop: run a test, observe results and coverage, edit the test or the tested code, repeat... In this context invoking the VS Code commands `Test: Rerun Last Run` and `Test: Rerun Last Run with Coverage` with their respective keyboard shortcuts can be valuable.
308308

309+
### Cross and Embedded Support
310+
311+
This section provides some guidance to work on cross or embedded projects. It assumes
312+
that your `.gpr` project files are already properly configured to work on a cross environments/embedded platforms.
313+
314+
#### GNATemulator Support
315+
316+
If you have loaded an embedded project, the extension will automatically provide predefined tasks and commands
317+
to run and debug your application through GNATemulator, if available for your target.
318+
319+
For instance if you have loaded a project with an `arm-eabi` target configured to run on a STM32F4
320+
board, the extension will provide predefined tasks, commands and CodeLenses to run and debug your
321+
program using GNATemulator.
322+
323+
<img src="doc/media/gnatemu-debug-codelens.gif" width="800" alt="Debug with GNATemulator CodeLens" />
324+
325+
The port used by the debugger launched by VS Code to connect to the running GNATemulator instance
326+
is the one specified via the `Emulator'Debug_Port` project attribute, so make sure it is set before
327+
running the dedicated GNATemulator command/CodeLens.
328+
329+
Note that GNATemulator is not available for all GNAT embedded toolchains. For more information about GNATemulator itself and its availabilty please refer to the [GNATemulator User's Guide](https://docs.adacore.com/gnatemulator-docs/gnatemulator.html).
330+
331+
#### Remote Debugging
332+
333+
If your project can be debugged remotely via GDB using the `target remote <ip-of-target:port>` command, you will just need to set the `IDE'Program_Host` project attribute in your `.gpr` file to specify the address that should be used
334+
to connect to your machine or board.
335+
336+
You will also need to run the debugging utility that spawns the remote `gdbserver` before launching the debugger in VS Code ( e.g: `st-util` or `openocd` for STM32F4 boards). This can be done directly through a VS Code `Terminal` or by configuring a custom [VS Code task](https://code.visualstudio.com/docs/editor/tasks) for that purpose.
337+
338+
Once your project is setup, just open the VS Code
339+
`Run and Debug` panel and then click on the `Run and Debug` button.
340+
341+
For more advanced use cases or if your program cannot be debugged remotely via GDB, you can try creating your custom VS Code debug launch configuration following [VS Code User's Guide for Launch Configurations](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations).
342+
309343
### Commands and Shortcuts
310344

311345
The extension contributes commands and a few default key bindings.
@@ -363,7 +397,7 @@ The VS Code extension has a few limitations and some differences compared to [GN
363397
* **Indentation/formatting**: it does not support automatic indentation when adding a newline and range/document
364398
formatting might no succeed on incomplete/illegal code.
365399

366-
* **Tooling support**: we currently provide support for some *SPARK*, *GNATtest*, *GNATcoverage* and *GNAT SAS* [Tasks](#tasks), but some workflows may not be supported yet.
400+
* **Tooling support**: we currently provide support for some *SPARK*, *GNATtest*, *GNATcoverage*, *GNAT SAS* and *GNATemulator* [Tasks](#tasks), but some workflows may not be supported yet.
367401

368402
* **Alire support**: if the root folder contains an `alire.toml` file and
369403
there is `alr` executable in the `PATH`, then the language server fetches

0 commit comments

Comments
 (0)