Command line debugging with cspybat.exe

Technical Note 26068






2015/11/6 10:51


In some cases, downloading and debugging the application with cspybat.exe fails, even though it works to download and debug the application from inside IAR Embedded Workbench.

Reason for the issue

Something differs between the settings in the cspy.bat file and the settings in the IDE.


To create a correct contents in the cspy.bat file(s), make sure to do the following:

  1. Delete all *.bat file(s) in <project directory>\settings.
  2. From inside the IDE, build and debug the application.
  3. Go to <project directory>\settings and have a look at the generated file <project>.cspy.bat.
    Note that some versions of IAR Embedded Workbench generates a cspy.bat file that needs some editing, please check the comments in the file. Also note that some versions of IAR Embedded Workbench generates <project>.driver.xcl, and <project>.general.xcl files, that contain the command line options.
  4. In a command prompt, go to <project directory>\settings and do:
    <project>.cspy.bat <path to output file>
    For a "GettingStarted" project in IAR Embedded Workbench for ARM, the syntax is:
    GettingStarted.cspy.bat "..\Flash Debug\Exe\GettingStarted.out"


CSpybat is documented in IAR Embedded Workbench manuals. Depending on the version, the location is:

  1. Help -> Embedded Workbench Debugging Guide, or Embedded Workbench User Guide, chapter 'The C-SPY Command Line Utility—cspybat'.
  2. In another pdf file provided with the installation.
  3. In the html files provided with the installation.


All product names are trademarks or registered trademarks of their respective owners.



We do no longer support Internet Explorer. To get the best experience of, we recommend upgrading to a modern browser such as Chrome or Edge.