BullseyeCoverage Up Contents Search

IAR Embedded Workbench

The IAR integrated development environment cannot be configured to build using BullseyeCoverage. However, you can build from the command prompt as described below.

Convert Project to Ninja Build File

Use this method if you want to use Ninja and your version of the IAR utility iarbuild recognizes the -ninja option.

  1. Run iarbuild with -ninja. For example:

    C:\HelloWorld> "C:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\iarbuild" HelloWorld.ewp -ninja Debug
    IAR Command Line Build Utility V9.1.9.10638
    Copyright 2002-2023 IAR Systems AB.
    HelloWorld - Debug
    Reading project nodes...
    Ninja file generated in C:\HelloWorld\Debug
    
  2. See the instructions for integrating with Ninja.

Convert Project to a Script

Use this method if you do not want to use Ninja.

These steps show how to convert an IDE project to a script. Before enabling BullseyeCoverage, make sure the script successfully builds your project without BullseyeCoverage.

  1. Invoke a command prompt and add to the PATH environment variable the IAR Systems common\bin and arch\bin directories. For example:
    set PATH=%PATH%;C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.4\common\bin
    set PATH=%PATH%;C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.4\arm\bin
    
  2. Run iarbuild with -log all to obtain a detailed log.
    iarbuild project.ewp -build config -log all >log.txt
    

    The config parameter is typically either Debug or Release. Look at the project in the IAR IDE to determine this name.

  3. Extract the compiler, assembler and linker command lines from the detailed log. You can use grep to extract these lines as shown below.
    grep -F .exe log.txt >build.bat
    

    The grep command can be found in Cygwin or MSYS2 .

  4. Fix up build.bat by shortening the compiler names and quoting other filenames that contain spaces. Use the directory separator forward slash / rather than backslash \ to avoid escaping quotes. For example, change
    C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.4\arm\bin\iccarm.exe
    	C:\Program Files\IAR Systems\Embedded Workbench 8.4 Kickstart\arm\examples\Actel\CoreMP7\Blinky\blinky.c
    	-o C:\Program Files\IAR Systems\Embedded Workbench 8.4 Kickstart\arm\examples\Actel\CoreMP7\Blinky\Debug RAM\Obj\
    	...
    
    to:
    iccarm
    	"C:\Program Files\IAR Systems\Embedded Workbench 8.4 Kickstart\arm\examples\Actel\CoreMP7\Blinky\blinky.c"
    	-o "C:\Program Files\IAR Systems\Embedded Workbench 8.4 Kickstart\arm\examples\Actel\CoreMP7\Blinky\Debug RAM\Obj/"
    	...
    
  5. Invoke build.bat to verify you can build your project without BullseyeCoverage.

    .\build.bat
    

Build Project

Make sure the BullseyeCoverage/bin is first in the PATH environment variable.

set PATH=%ProgramFiles%\BullseyeCoverage\bin;%PATH%
cov01 -1
.\build.bat

Run-Time Library Built Automatically

By default, BullseyeCoverage automatically compiles the run-time library run/libcov-iar.c and adds the resulting object file to linker invocations. This source implements the small footprint configuration. You can override this behavior by one of the alternatives below.

Saving Coverage

Add a call to cov_dumpData into your program. The output file BullseyeCoverage.data-1 is written in the project directory.

#if _BullseyeCoverage
    cov_dumpData();
#endif

Run under Debugger

The BullseyeCoverage run-time source file for IAR Systems, BullseyeCoverage/run/libcov-iar.c, uses the overridable low-level i/o functions. If you do not have implementations of these low-level i/o functions, configure to run under the simulator. If you need to run on real hardware, see Embedded Systems.

After building your application using build.bat, return to the IDE and start the debugger.

BullseyeCoverage run-time error messages are written to standard error. After starting the debugger, use the command View Terminal I/O so that you can see any error messages that might occur.

Updated: 31 Jul 2024