-
Notifications
You must be signed in to change notification settings - Fork 18
CTest with IAR Embedded Workbench for Arm
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.
The filenames used in this article apply to the following products and versions
- IAR Build Tools for Arm V9.70.1
- IAR Embedded Workbench for Arm V9.70.1
Note
This guide should be applicable to other product versions with minor or no modifications required.
The non-interactive C-SPY Command Line interface (CSpyBat
) offers drivers and plugins under <path/to/installation-dir>/arm/bin
for the simulator and supported debug probes. These drivers differ slightly between the supported operating systems. These differences are highlighted in the table below.
Driver/Plugin | Filename on Linux (case-sensitive) | Filename on Windows (case-insensitive) |
---|---|---|
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 |
The examples below use the default install location for IAR Embedded Workbench for Arm V9.70.1 (C:/iar/ewarm-9.70.1
).
The output ELF file is referred by $<TARGET_FILE:tgt>
where tgt
will be tutorial
for following examples.
Important
When using real hardware, the executable must be linked with an appropriate memory layout (--config <path-to>/<ilink-configuration-file>
). For example, when using the STM32F407VG device with the tutorial project, rebuild the project using its stock linker configuration:
target_link_options(tutorial PRIVATE
--config C:/iar/ewarm-9.70.1/arm/config/linker/ST/stm32f407xG.icf
--cpu=cortex-m4
--semihosting
)
For adding a test for the Tutorial example with parameters adjusted for simulating a generic Arm Cortex-M4 target environment you can use:
add_test(NAME tutorialTest
COMMAND C:/iar/ewarm-9.70.1/common/bin/CSpyBat
# C-SPY drivers for the Arm simulator via command line interface
C:/iar/ewarm-9.70.1/arm/bin/armproc.dll
C:/iar/ewarm-9.70.1/arm/bin/armsim2.dll
--plugin=C:/iar/ewarm-9.70.1/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 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.70.1/common/bin/CSpyBat
# C-SPY drivers for the Arm target via command line interface
C:/iar/ewarm-9.70.1/arm/bin/armproc.dll
C:/iar/ewarm-9.70.1/arm/bin/armjet.dll
--plugin=C:/iar/ewarm-9.70.1/arm/bin/armLibsupportUniversal.dll
# I-jet flash loader
--flash_loader=C:/iar/ewarm-9.70.1/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.70.1/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
)
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.70.1/common/bin/CSpyBat
# C-SPY drivers for the Arm target via command line interface
C:/iar/ewarm-9.70.1/arm/bin/armproc.dll
C:/iar/ewarm-9.70.1/arm/bin/armjlink.dll
--plugin=C:/iar/ewarm-9.70.1/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.70.1/arm/config/debugger/ST/STM32F407VG.ddf
# J-Link: communication port
--drv_communication=USB0
# J-Link: driver interface
--drv_interface=SWD
)
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.70.1"
):
add_test(NAME tutorialTest
COMMAND C:/IAR\ Systems/EW/ARM/9.70.1/common/bin/CSpyBat
# C-SPY drivers for the Arm simulator via command line interface
C:/IAR\ Systems/EW/ARM/9.70.1/arm/bin/armproc.dll
C:/IAR\ Systems/EW/ARM/9.70.1/arm/bin/armsim2.dll
--plugin=C:/IAR\ Systems/EW/ARM/9.70.1/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
)
This is the cmake-tutorial wiki. Back to Wiki Home
- IAR Compiler options in a CMake project
- IAR ILINK options in a CMake project
- Language-specific target options
- Selecting build types
- Using Ninja Multi-Config
- Filing a build log
- Multi-file compilation
- Invoking IAR binary utilities
- Use the IAR ELF Tool to convert executable targets to their binary formats