Using Visual Studio Code with IAR Embedded Workbench

Technical Note 200415

Arkitekturer:

All

Komponent:

general

Uppdaterad:

2022-06-07 12:01

Introduction

Visual Studio Code (VS Code) is a popular cross-platform code editor. It is customizable and extensible, and can be adapted for a variety of workflows. This Technical Note shows how to use VS Code on top of IAR Embedded Workbench®, to build and debug applications.

Prerequisites

  • This document assumes little to no previous knowledge of VS Code.
  • IAR Systems does not provide support for the VS Code editor. If you have any problems setting up or using VS Code, contact your provider.

Discussion

Tools to install

  • IAR Embedded Workbench
  • VS Code
  • VS Code extension IAR Build
  • VS Code extension IAR C-SPY Debug

The two IAR VS Code extension listed above are installed from VS Code via the Extensions panel.

IAR Build extension

Using this extension you can develop and build your IAR Embedded Workbench projects from VS Code. You can:

  • Build projects
  • Manage project files
  • Perform C-STAT static analysis
  • Use language and editing features powered by VS Code and its extensions

An IAR Embedded Workbench or IAR Build Tools installation is required to use this extension.

IAR C-SPY Debug extension

The IAR C-SPY Debug extension lets you perform basic debugging of an existing IAR Embedded Workbench project or a stand-alone application. It supports most of the IAR C-SPY Debug drivers that IAR Embedded Workbench supports, and uses the Disassembly, Memory, Peripheral, and RTOS views provided by VS Code or the VS Code Embedded Tools extension.

The extension can be used with IAR Embedded Workbench (.ewp) projects, or with other build systems such as CMake. An IAR Embedded Workbench installation is required to use this extension.

Note: Detailed getting started and reference documentation can be found together with the respective extensions once they have been installed.

Opening VS Code from the IAR Embedded Workbench IDE

Optionally, to facilitate using VS Code alongside the IAR Embedded Workbench IDE, you may add a menu option inside the IDE to open the current file in VS Code. To do this, choose Tools>Configure Tools and add a new entry called Open in VS Code.

By default, VS Code is installed in:

C:\users\{username}\AppData\Local\Programs\Microsoft VS Code

Based on this, set the Command field to your VS Code executable like this (using a Windows standard environment variable): 

$_localappdata_$\Programs\Microsoft VS Code\Code.exe 

The Argument field should be $WS_DIR$ -g $FILE_PATH$:$CUR_LINE$

Example:

Click OK and you can now open the current file and line in VS Code at any time by choosing Tools>Open in VS Code.

Opening the IAR Embedded Workbench IDE from VS Code

It is possible to open the IAR Embedded Workbench IDE from VS Code, by running the iar: Open Workspace in IAR Embedded Workbench task. This will open the current project in the IDE.

Limitations

  • The VS Code extensions do not support modifying IAR Embedded Workbench (.ewp) project settings.
  • Not all debugging features available in IAR Embedded Workbench are supported in VS Code.

Conclusion

This Technical Note briefly describes the possibilities to use VS Code on top of IAR Embedded Workbench to develop and debug applications. It also shows how to facilitate working on the same project in both VS Code and the IAR Embedded Workbench IDE.

For further information, see the full documentation provided on Visual Studio Marketplace at IAR Build and IAR C-SPY Debug respectively.

All product names are trademarks or registered trademarks of their respective owners.

Det här innehållet finns tyvärr inte på svenska.

Vår webbplats finns främst på vårt koncernspråk engelska, förutom det innehåll för investerare som vi är lagstadgade att kommunicera på svenska. Vi rekommenderar att du besöker vår globala webbplats på engelska för att få en bättre upplevelse.

Vi stöder inte längre Internet Explorer. För att få bästa möjliga upplevelse av iar.com rekommenderar vi att du uppgraderar till en modern webbläsare som Chrome eller Edge.