Skip to main content

IAR Embedded Workbench for Arm 9.70.x

Displaying a power profile and analyzing the result

In this section:
To view the power profile:
  1. Choose Driver>SWO Configuration to open the SWO Configuration dialog box. Make sure the CPU clock option is set to the same value as the CPU clock value set by your application. This is necessary to set the SWO clock and to obtain a correct data transfer to the debug probe.

    This step requires a device with SWD SWO (Serial Wire Output) capability.

  2. Start the debugger.

  3. Choose Driver>Power Log Setup. In the ID column, make sure to select the alternatives for which you want to enable power logging.

  4. Choose Driver>Timeline to open the Timeline window.

  5. Right-click in the graph area and choose Enable from the context menu to enable the power graph you want to view.

  6. Choose Driver>Power Log to open the Power Log window.

  7. Optionally, if you want to correlate power values to specific interrupts or variables, right-click in the Interrupts or Data Logs graph area, respectively, and choose Enable from the context menu.

    For variables, you also need to set a Data Log breakpoint for each variable you want a graphical representation of in the Timeline window. See Data Log breakpoints dialog box (C-SPY hardware drivers).

    This step requires a device with SWD SWO (Serial Wire Output) capability.

  8. Optionally, before you start executing your application you can configure the viewing range of the Y-axis for the power graph. See Viewing Range dialog box.

  9. Click Go on the toolbar to start executing your application. In the Power Log window, all power values are displayed. In the Timeline window, you will see a graphical representation of the power values, and, if you are using a device with SWD SWO (Serial Wire Output) capability, of the data and interrupt logs if you enabled these graphs. For information about how to navigate on the graph, see Navigating in the graphs.

  10. To analyze power consumption (requires a device with SWD SWO capability):

    • Double-click on an interesting power value to highlight the corresponding source code in the editor window and in the Disassembly window. The corresponding log is highlighted in the Power Log window. For examples of when this can be useful, see Optimizing your source code for power consumption.

    • You can identify peripheral units to disable if they are not used. You can detect this by analyzing the power graph in combination with the other graphs in the Timeline window. See also Detecting mistakenly unattended peripherals.

    • For a specific interrupt, you can see whether the power consumption is changed in an unexpected way after the interrupt exits, for example, if the interrupt enables a power-intensive unit and does not turn it off before exit.

    • For function profiling, see Selecting a time interval for profiling information.