Skip to content

CTest with IAR Embedded Workbench for Arm

Felipe Torrezan edited this page Oct 28, 2024 · 5 revisions

Introduction

Setting up ctest with IAR Embedded Workbench for Arm faces minor differences in the filenames for drivers and support libraries when compared to the IAR Build Tools for Arm. These differences relate to the operating system in which the tools are used. This article illustrates these differences.

This article expands the Run section found in the tutorial.

Applies to

The filenames used in this article apply to the following products and versions

  • IAR Build Tools for Arm V9.60.2
  • IAR Embedded Workbench for Arm V9.60.2

Note

Might apply for newer product versions with minor or no modifications required.

Description

The CSpyBat drivers and plugins have similar but different filenames on the supported operating systems. These differences are highlighted in the table below.

Driver/Plugin Filename on Linux Filename on Windows
Processor driver libarmPROC.so armproc.dll
Simulator driver libarmSIM2.so armsim2.dll
I-jet driver libarmJET.so armjet.dll
J-Link driver libarmJLINK.so armjlink.dll
Support plugin libarmLibsupportUniversal.so armLibsupportUniversal.dll

Note

  • The aforementioned files are located under <path/to/installation-dir>/arm/bin.
  • Filenames are case-sensitive on Linux-based operating systems.

Examples

The examples below use the default install location for IAR Embedded Workbench for Arm V9.60.2 (C:/iar/ewarm-9.60.2).

Adding a simulated test using the C-SPY Simulator

For adding a test for the Tutorial example with parameters adjusted for simulating a generic Arm Cortex-M4 target environment:

add_test(NAME tutorialTest
         COMMAND C:/iar/ewarm-9.60.2/common/bin/CSpyBat
         # C-SPY drivers for the Arm simulator via command line interface
         C:/iar/ewarm-9.60.2/arm/bin/armproc.dll
         C:/iar/ewarm-9.60.2/arm/bin/armsim2.dll
         --plugin=C:/iar/ewarm-9.60.2/arm/bin/armLibsupportUniversal.dll
         # The target executable (built with debug information)
         --debug_file=$<TARGET_FILE:tutorial>
         # C-SPY driver options
         --backend
           # Selected CPU architecture
           --cpu=cortex-m4
           # Arm semihosting support (for `printf()`)
           --semihosting
)

Adding a hardware test using the IAR I-jet

Adding a test that will be performed directly on hardware requires additional parameters for driving the used probe correctly. The example below uses the IAR I-jet probe for attaching to a STM32F407VG target:

add_test(NAME tutorialTest
         COMMAND C:/iar/ewarm-9.60.2/common/bin/CSpyBat
         # C-SPY drivers for the Arm target via command line interface
         C:/iar/ewarm-9.60.2/arm/bin/armproc.dll
         C:/iar/ewarm-9.60.2/arm/bin/armjet.dll
         --plugin=C:/iar/ewarm-9.60.2/arm/bin/armLibsupportUniversal.dll
         # I-jet flash loader
         --flash_loader=C:/iar/ewarm-9.60.2/arm/config/flashloader/ST/FlashSTM32F4xxx.board
         # The target executable (built with debug information)
         --debug_file=$<TARGET_FILE:tutorial>
         # Limit the maximum execution time (milliseconds)
         --timeout=5000
         # C-SPY driver options
         --backend
           # Selected CPU architecture
           --cpu=cortex-m4
           # Selected FPU
           --fpu=VFPv4_SP
           # Arm semihosting support (for `printf()`)
           --semihosting
           # Target device
           --device=STM32F407VG
           # Device Description File
           -p C:/iar/ewarm-9.60.2/arm/config/debugger/ST/STM32F407VG.ddf
           # I-jet: Power the target (up to 420 mA)
           --jet_power_from_probe=switch_off
           # I-jet: driver interface
           --drv_interface=SWD
)

Caution

To use real hardware, the executable must be linked with the appropriate memory layout. For the STM32F407VG example, rebuild the project after updating the linker configuration to match the target specifications:

target_link_options(tutorial PRIVATE
 --config C:/iar/ewarm-9.60.2/arm/config/linker/ST/stm32f407xG.icf
 --cpu=cortex-m4
 --semihosting
)

Adding a hardware test using the SEGGER J-Link

Adding a test that will be performed directly on hardware requires additional parameters for driving the used probe correctly. The example below uses the SEGGER J-Link probe for attaching to a STM32F407VG target:

add_test(NAME tutorialTest
         COMMAND C:/iar/ewarm-9.60.2/common/bin/CSpyBat
         # C-SPY drivers for the Arm target via command line interface
         C:/iar/ewarm-9.60.2/arm/bin/armproc.dll
         C:/iar/ewarm-9.60.2/arm/bin/armjlink.dll
         --plugin=C:/iar/ewarm-9.60.2/arm/bin/armLibsupportUniversal.dll
         # The target executable (built with debug information)
         --debug_file=$<TARGET_FILE:tutorial>
         # Limit the maximum execution time (milliseconds)
         --timeout=5000
         # C-SPY driver options
         --backend
           # Selected CPU architecture
           --cpu=cortex-m4
           # Selected FPU
           --fpu=VFPv4_SP
           # Arm semihosting support (for `printf()`)
           --semihosting
           # Target device
           --device=STM32F407VG
           # Device Description File
           -p C:/iar/ewarm-9.60.2/arm/config/debugger/ST/STM32F407VG.ddf
           # J-Link: communication port
           --drv_communication=USB0
           # J-Link: driver interface
           --drv_interface=SWD
)

Caution

To use real hardware, the executable must be linked with the appropriate memory layout. For the STM32F407VG example, rebuild the project after updating the linker configuration to match the target specifications:

target_link_options(tutorial PRIVATE
 --config C:/iar/ewarm-9.60.2/arm/config/linker/ST/stm32f407xG.icf
 --cpu=cortex-m4
 --semihosting
)

Known issues

Path names containing blank spaces

Install locations containing blank spaces require escaping them with a backslash before each blank space as in the example below, for a custom install location ("C:/IAR Systems/EW/ARM/9.60.2"):

add_test(NAME tutorialTest
         COMMAND C:/IAR\ Systems/EW/ARM/9.60.2/common/bin/CSpyBat
         # C-SPY drivers for the Arm simulator via command line interface
         C:/IAR\ Systems/EW/ARM/9.60.2/arm/bin/armproc.dll
         C:/IAR\ Systems/EW/ARM/9.60.2/arm/bin/armsim2.dll
         --plugin=C:/IAR\ Systems/EW/ARM/9.60.2/arm/bin/armLibsupportUniversal.dll
         # The target executable (built with debug information)
         --debug_file=$<TARGET_FILE:tutorial>
         # C-SPY driver options
         --backend
           --cpu=cortex-m4
           --semihosting
)
Clone this wiki locally