Variables in IAR
----------------

To view Global Variables, do either of the following.

* Right-click on the variable.

  * Select Add to Watch: varName.

* Select ``View`` |rarr| ``Watch``

  * Enter the name of the variable.

.. figure:: /debugging/resources/iar_watch.png
    :align: center

    Variable watch window. Note that you can cast values, get address and
    sizeof, etc.

View --> Locals show the local variables in IAR.

.. figure:: /debugging/resources/iar_locals.png
    :align: center

    Local variables. This screenshot is taken during execution of the Simple
    Peripheral init function.

.. note::
    IAR may remove the variable during optimization and inline the usage of the
    value. If so, add the ``__root`` directive in front.
