Building Your First Sample Application with the IAR Embedded Workbench

This section guides you through importing and building your first sample application, named blinky. This application makes the LED (DIO6) blink on the RSL15 Evaluation and Development Board. The procedure described in this section assumes that you have installed the SDK.

For more information about the sample applications, see the readme files accompanying the code.

Import the Sample Code

Import the sample code to your workspace as follows:

  1. In the IDE’s CMSIS Manager, click on the Examples tab to list all the example projects included in the RSL15 CMSIS-Pack.
  2. Choose the example project called blinky, and click the Copy button to import it into your workspace (see the "IAR Embedded Workbench CMSIS Manager: Examples Tab" figure). Choose a destination folder for a copy of the sample code.

Figure: IAR Embedded Workbench CMSIS Manager: Examples Tab

For the blinky sample, the Startup, HAL and GPIO components are preconfigured with the source variant, so the source code of these libraries is included directly (see the "RTE Configuration for the Blinky Example Project in the IAR Embedded Workbench CMSIS Manager Window" figure and the "RTE Configuration for the Blinky Example Project in the IAR Embedded Workbench Window" figure).

Figure: RTE Configuration for the Blinky Example Project in the IAR Embedded Workbench Window

Figure: RTE Configuration for the Blinky Example Project in the IAR Embedded Workbench CMSIS Manager Window

Building the Sample Code

To build the sample code:

  1. Right click on the folder for blinky and choose Rebuild All. Alternatively, you can use the icon shown in the "Starting a Project Build in the IAR Embedded Workbench" figure.

Figure: Starting a Project Build in the IAR Embedded Workbench

  1. When the build is running, the output of the build is displayed in the Build Output view in the IDE, as illustrated in the "Example of Build Output" figure.

Figure: Example of Build Output

  1. The key resulting output shown in Project Explorer in the IDE includes:
    • blinky.hex: HEX file for loading into flash memory
    • blinky.out: Arm executable file, used for debugging
    • blinky.map: map file of the sections and memory usage

Debugging the Sample Code

Debugging Applications

IDE debug configurations are already set in the CMSIS pack. To debug an application:

  1. Make sure the EVB is connected to the PC via a USB-C cable.
  2. Select Project > Download and Debug, or click the icon shown in the Start/Stop Debug Session Icon, then accept the J-Link pop-up dialog in order to use the flash breakpoints (as shown in the J-Link “Out of breakpoints” Pop-up Dialog).

Figure: Start/Stop Debug Session Icon

Figure: J-Link “Out of breakpoints” Pop-up Dialog

  1. The application runs up to the first breakpoint in main. You can press F5 or click the Run icon (as shown in Figure 38) multiple times to step through the code and observe that the LED changes its state when the application executes the line gpio->ToggleValue(SYSTICK_STATES_GPIO). To stop the debug session, press the Stop icon.

Figure: Debug Session in the IAR Embedded Workbench