iar-vsc README
Note: This extension is deprecated in favor of IAR Build
and IAR C-SPY Debug
This plugin makes it possible to combine the IAR Systems compiler solutions with Visual Studio Code. The goal is to support all IAR Systems compiler variants like for example Arm, RISC-V, MSP430, AVR, STM8, 8051, Renesas RX, RL78 and RH850. If you find any problems with this plugin, please open an issue on GitHub and include the compiler and version used. If possible, include also the project file (.ewp). This plugin works on any operating system supported by VS Code and IAR Systems. IAR Systems has contributed to the development of this plugin.
The plugin can parse ewp files and convert them to a valid c_cpp_properties.json
configuration which is used by the cpptools extension made by Microsoft.
In the Features
section you can find more information on how to use this extension.
Improvements are welcome through pull requests or issue reports.
Features
Configuring the extension
The extension will automatically detect Embedded Workbench installations on your systems, as well as IAR projects in your VS Code workspace.
You may select which workbench to use, which configuration to build, and other settings using buttons in the statusbar.
There is also a view in the explorer tab for these settings.
Alternatively, you can call the commands behind those buttons, see the contribution
tab in the extension section of VS Code.
If your Embedded Workbench is installed in a non-standard location, the plugin might not autodetect it. In that case you will need to set iarvsc.iarInstallDirectories
in your settings.json
file, see Extension Settings
Building
When you execute the VSCode command Tasks: Configure Task
two items are added which are generated by this extension:
iar: IAR Build - template using selected workbench, project and config
iar: IAR Rebuild - template using selected workbench, project and config
When selecting one of the two, a default task is generated which uses the workbench, project and configuration selected using the UI. When you select a different configuration, project or workbench, this task will use the newly selected items.
C-STAT
You can run C-STAT on your project with the iar-cstat: Run C-STAT Analysis
task, and clear the warnings with iar-cstat: Clear C-STAT Diagnostics
.
When running these tasks, VS Code might prompt you about scanning the task output, and it is recommended to select Never scan the task output for iar-cstat tasks
,
since these tasks do not use a regular problem matcher.
You can filter the C-STAT warnings by setting iarvsc.cstatFilterLevel
in your user settings.
Debugging
In v1.1.0 settings are added to configure a gdbserver and a gdb executable. The following data for
the launch.json
file will use this configuration to start debugging. Currently this is only for
testing and is a work in progress. The settings are not yet automatically updated when selecting
different projects or configurations (even though the description of the settings mention this).
Open or create the launch.json
file and place your cursor at the beginning of the configurations
array. Now press Ctrl + Space
to activate autocompletion. You should see an item like
IAR: Debug using gdb server
. If you select this, the configuration below is automatically
generated.
Some information about the used config parameters:
iarvsc.debugger
: The path to the debugger to use. In case your debugger is on your PATH
environment you can just enter the debugger executable like arm-none-eabi-gdb.exe
, otherwise,
use the absolute path to the debugger.
iarvsc.gdbServer
: The path to the gdb server. If you are using a J-Link Segger, you will
probably have to enter the full path like: C:\GNU Tools ARM Embedded\2018-q4-major\bin\arm-none-eabi-gdb.exe
.
Keep in mind you have to escape the backslashes \
in json.
iarvsc.device
: The device you are want to flash and debug. Check your debug server
documentation which values you can use here.
iarvsc.outFile
: This field is not yet used in the current release, but it is mentioned here for
completeness. You can use it, but keep in mind the value you enter here can conflict in future
releases.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug GDBServer",
"type": "cppdbg",
"request": "launch",
"program": "Path to the out file",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "${config:iarvsc.debugger}",
"debugServerPath": "${config:iarvsc.gdbServer}",
"debugServerArgs": "-if swd -singlerun -strict -endian little -speed auto -port 3333 -device ${config:iarvsc.device} -vd -strict -halt",
"serverStarted": "Connected\\ to\\ target",
"serverLaunchTimeout": 5000,
"filterStderr": false,
"filterStdout": true,
"setupCommands": [
{
"text": "target remote localhost:3333"
},
{
"text": "monitor flash breakpoints = 1"
},
{
"text": "monitor flash download = 1"
},
{
"text": "monitor reset"
},
{
"text": "load \\\"Path to the out file\\\""
},
{
"text": "monitor reset"
}
]
}
]
}
Requirements
This extensions presumes that you have installed cpptools
of microsoft
.
Extension Settings
To change extension settings, go to Ctrl+Shift+P->Preferences: Open Settings (JSON)
to open your settings.json
file and add the appropriate json entries.
This extension contributes the following settings:
iarvsc.iarInstallDirectories
: The rootfolder where all IAR workbenches are installed. By default this is C:\Program Files (x86)\Iar Systems
. The default settings contain also the non-x86 folder in case IAR will move to 64-bit installations.
For example, if your Embedded Workbench installation is at D:\Iar Systems\Embedded Workbench 8.40
,
add the following to your settings.json
file:
"iarvsc.iarInstallDirectories": ["D:\\Iar Systems"],
This will also let the extension find any other workbench installations in that folder (e.g. D:\Iar Systems\My Second Workbench 7.20
).
iarvsc.defines
: Some custom defines you can add to the define list. They follow the identifier=value
structure. This list will contain all intrinsic compiler functions that are known by the author of this extension. If some are missing, create a GitHub issue.
iarvsc.c-StatFilterLevel
: Sets the lowest severity of C-STAT warnings to display.
iarvsc.c-StatDisplayLowSeverityWarningsAsHints
: When the filter level is set to low, this option will display low severity warnings as 'hints' instead of warnings. This is helpful if you have lots of low severity warnings and want to hide them from the problems list (but still see them in the editor).
Known Issues
Release Notes
1.3.0
- Pull #74: New source file configuration system. This should be much more accurate than the previous one, and handles cases such as CMSIS headers, c++ files, variable expansion, external define files.
- Pull #86: Fix a bug where workbenches were not detected on linux
1.2.1
- Remove 'Scan for task output' dialog when running C-STAT tasks
- Rescan for workspaces when changing
iarInstallDirectories
- Change name of C-STAT settings
- Update readme section on settings
1.2.0
- Change extension name and icon
- Set license to MPL 2.0
- Pull #61: Integrate C-STAT
- Pull #60: Support IAR extended keywords
- Pull #59: Autoselect options for new projects
- Pull #59: Add explorer view for project options
- #51: Use a separate config file to store IAR project related configs which can differ between developers
- Pull #63: Add clearer error and warning messages
- Pull #48: Add extra build argument setting
- #47: Speed up startup time by only calling the compiler when selecting it and not going through all compilers at startup
- Pull #58: Allow extension to run on non-windows OSs
- Update documentation and use readthedocs as host
- Add dependency on
ms-vscode.cpptools
so it is easier to install it
- Clean up readme
1.1.0
- Fixes #38: IAR:Select Configuration does not autopopulate with options
- Implement #28: Add support to generate build tasks using the VSCode built-in command
Tasks: Configure Task
.
- Fix #18: Save all files before build. (this is actually fixed because we are now using tasks)
- Implement #10: Create a launch task to start debugging using the Segger J-Link debugger using settings configurations
parameters.
- Fix #44: Perform a recursive search to find eww files in the workspace root folder.
1.0.1
- Fixes #38: IAR:Select Configuration does not autopopulate with options
1.0.0
- Add __root to default defines
- Add keywords so the extension is easier to find in the marketplace
- Add listeners to the define settings so the cpptools config file is generated when changed
- Fix issue when cpptools config file is empty or invalid: plugin would not load
- Add some more settings for default c and c++ standard configuration
- Correct relative include paths in cpptools config file
- Add
=
sign to default defines in settings
- Add a problem matcher
- Redisgned the extension
- Instead of completely command drive, status bar items are added to configure most things
- Automatically monitor the selected ewp file and auto generate the config file
- Only generate one config file
IAR
in the c_cpp_properties.json
file. Changing between projects/configurations will
automatically trigger an update of the IAR
config section in the json file.
- Move all settings from iar-vsc.json to the configuration file of vscode. This way configurations are reusable.
- Make extension platform aware so you can choose from all compilers from the selected workbench.
- Add new setting to define your own
defines
through the IAR settings. This way it is possible to define the intrinsics
of your compiler so you do not have to wait for extension updates.
- Add command to open IAR workbench. For now only the workbench opens without a workspace. See Issue #24 @ GitHub.
- Extension is now loaded when the workspace contains
.ewp
files.
- Added basic unit- and integrationtests.
- Probably a lot more...
0.0.3
- Fixes #1: Extension did not detect end of build command
- Fixes #3: Renamed iar-vsc.js to iar-vsc.json
0.0.2
Add system include paths
0.0.1
Initial release of iar-vsc
Road Map
Check the github project page for more information about the roadmap.