Thanks to visit codestin.com
Credit goes to github.com

Skip to content

iarsystems/modern-workflow

Repository files navigation

Modern Development Workflow with IAR

CXARM CI

This repository contains a project example that can be developed from within a Dev Container using Visual Studio Code with its remote development extensions.

A Dev Container provides a pre-configured development environment. It allows you to work in a development environment that has been specifically configured for your repository. It will have all the tools, scripts and configurations you need to work on that project. Everyone who works on that repository will have the same environment, reducing the ocurrence of environment-related problems. Each repository can have settings that will give contributors a ready-to-use, fit-for-purpose environment, and the environment on your local machine will be unchanged.

Out of the box, the demonstration project is set to work with the IAR STM32F429II-ACA board while the debugger lauches with the IAR C-SPY Simulator, or IAR I-jet, or the SEGGER J-Link probes. Also, the project sources can be modified for working with other boards.

IAR public container images

This project example makes use of one of the IAR public container images for Arm with device support.

Getting started

Perform the following:

  1. Launch Visual Studio Code.
  2. If running from Windows, connect to WSL.
Code_uC77i5JnhG Code_dbNBZZXXQ3
  1. Clone and open this repository.
image

Tip

This functionality depends on having Git installed. You might need to sudo apt install git or equivalent on your Linux distribution.

  1. A toaster notification in the lower right corner will offer to reopen the folder to develop in a container.
image

Tip

The toaster nofitication only appears for a short while. If you miss it, you can use the palette (CTRL+SHIFT+P) and use, for example, "Dev Containers: reopen in container".

  1. Once all project's submodules were cloned, clicking CMake extension's "Run CTest" will automatically build the project with the IAR Build Tools prior to running unit tests using the IAR C-SPY Simulator.

  2. The Dev Container also installs automatically the IAR Debug extension with support for the IAR C-SPY Simulator, IAR I-jet, and the SEGGER J-Link probes. Press F5 to run with the Simulator or select the desired launcher from the Debug menu.

Authenticate to the IAR Cloud License service

The IAR Build Tools require an user license to operate and, for that reason, the project will not build at first. Choose one of the following methods:

Via Entra ID

This method uses the Microsoft Entra ID technology and it requires your user mail account associated to this service.

  1. Choose Terminal/Run task.../IAR Cloud login.

  2. Select the authentication code and copy it to the clipboard (CTRL+C).

  3. CTRL+Click on the provided link, enter with the provided code, click "Connect" and then "Continue".

image
  1. Go back to Visual Studio Code and build the project using the IAR Build Tools.

Via Evaluation Token

Alternatively, it is possible to use a time-limited Evaluation Token provided by IAR.

  1. In your host environment, set the following variable:
export IAR_LMS_BEARER_TOKEN=<the-evaluation-token-you-received>
  1. From within your Dev Container, access the command pallete and select "Dev Containers: Rebuild Container".

It should now be possible to build the project using the IAR Build Tools.

Building from the command line

Amongst the many ways of building a CMake project with IAR, it is possible to use CMake Presets. The project comes with a preset for cxarm which generates its default build scripts. Below you will find some simple sequence of commands:

# Configure the project (Debug, Release, RelWithDebInfo, MinSizeRel)
$ cmake --preset cxarm

# Build the Debug configuration
$ cmake --build --preset debug

# Run unit tests using the previous build
$ ctest --test-dir build --preset debug

Tip

You can append --verbose when building the project or running ctest for additional details on what CMake is executing behind the scenes.

Summary

Dev Containers simplify bootstrapping the whole development environment with the IAR Build Tools in Visual Studio Code.

Additional reference information