10.2.1. Creating a macro

Complete the following steps to create a macro for use with a debug target:

  1. Connect to your target and load an image, for example dhrystone.axf.

  2. Select Debug → Add/Edit Debugger Macros... to display the Add/Edit Macros dialog box.

    When you first open this dialog box, the Existing Macros display list is empty because no macros have been defined or loaded into RealView Debugger.

    The Macro Entry Area gives advice on how to use the buttons, New, Show, and Copy. This area shows the definition of the macro when it has been created.

  3. Click New to create the macro. This inserts the default name int Macro() in the Name data entry field and inserts {} in the Macro Entry Area ready for editing.

  4. Edit the default macro name so that it shows int tutorial(var1).

  5. Enter the macro contents to show:

    int var1;
    
    {
    $printf “value=%d\n”,var1$;
    }
    

    The Add/Edit Macros dialog looks like the example shown in Figure 10.1.

    Figure 10.1. Creating a macro

    Creating a macro
  6. Click Update to pass the macro definition to RealView Debugger, where it is stored in the symbol table. This adds the new macro to the Existing Macros display list.

    If there are any errors in the macro text, you are notified when you try to pass the macro to RealView Debugger.

  7. View the Output pane message:

    def int tutorial(var1)
    
  8. Click Save... to display the Select file to save/append into dialog box where you can choose where to save the new macro definition file for later re-use.

    The macro name has been entered automatically with the extension .inc.

  9. Save the new macro, with the default name, in your program_directory\home directory.

    If the chosen file already exists, RealView Debugger displays a warning message and gives you the option to append the new file or to overwrite the existing contents.

  10. Click Close to close the Add/Edit Macros dialog box and return to the Code window.

Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0234B
Non-Confidential