Skip to main content

IAR Embedded Workbench for RISC-V 3.40

Registering and executing using setup macros and setup files

In this section:

It can be convenient to register a macro file during the C-SPY startup sequence. To do this, specify a macro file which you load before starting the debug session. Your macro functions will be automatically registered each time you start the debugger.

If you use the reserved setup macro function names to define the macro functions, you can define exactly at which stage you want the macro function to be executed.

To define a setup macro function and load it during C-SPY startup:
  1. Create a new text file where you can define your macro function.

    For example:

    execUserSetup()
    {
     ...
     __registerMacroFile("MyMacroUtils.mac");
     __registerMacroFile("MyDeviceSimulation.mac");
    
    }

    This macro function registers the additional macro files MyMacroUtils.mac and MyDeviceSimulation.mac. Because the macro function is defined with the function name execUserSetup, it will be executed directly after your application has been downloaded.

  2. Save the file using the filename extension mac.

  3. Before you start C-SPY, choose Project>Options>Debugger>Setup. Select the Use macro file option, and choose the macro file you just created.

    The macros will now be registered during the C-SPY startup sequence.