Run a demo application using IAR

This section describes the steps required to build, run, and debug example applications provided in the MCUXpresso SDK.

Note: IAR Embedded Workbench for Arm version 9.50.2 is used in the following example. The IAR toolchain should correspond to the latest supported version, as described in the MCUXpresso SDK Release Notes (document ID: MCUXSDKRN). IAR/Segger still does not support RW61x well. Therefore, contact the support team to get iar_support_patch_frdmrw612_0.zip and install the IAR patch before opening the IAR project.

Build an example application

Do the following steps to build the hello_world example application.

  1. Open the desired demo application workspace. Most example application workspace files can be located using the following path:

    <install_dir>/boards/<board_name>/<example_type>/<application_name>/iar
    

    Using the FRDM-RW612 hardware platform as an example, the hello_world workspace is located in:

    <install_dir>/boards/frdmrw612/demo_apps/hello_world/iar/hello_world.eww
    

    Other example applications may have additional folders in their path.

  2. Select the desired build target from the drop-down menu.

    For this example, select hello_worlddebug.

    |

|

  1. To build the demo application, click Make, highlighted in red in Figure 2.

    |

|

  1. The build completes without errors.

Parent topic:Run a demo application using IAR

Run an example application

To download and run the application, perform these steps:

  1. See the table in Default debug interfaces to determine the debug interface that comes loaded on your specific hardware platform.

  2. Connect the development platform to your PC via USB cable.

  3. Open the terminal application on the PC, such as PuTTY or TeraTerm, and connect to the debug COM port (to determine the COM port number, see How to determine COM port). Configure the terminal with these settings:

    1. 115200 or 9600 baud rate, depending on your board (reference BOARD_DEBUG_UART_BAUDRATE variable in the board.h file)

    2. No parity

    3. 8 data bits

    4. 1 stop bit |

|

  1. In IAR, click the Download and Debug button to download the application to the target.

    |

|

  1. The application is then downloaded to the target and automatically runs to the main() function.

    |

|

  1. Run the code by clicking the Go button.

    |

|

  1. The hello_world application is now running and a banner is displayed on the terminal. If it does not appear, check your terminal settings and connections.

    |

|

Parent topic:Run a demo application using IAR

IAR RAM debugging notes

In the SDK examples, there are many build configurations. For example, debug, release, flash_debug, and flash_release. The debug/release configuration demonstrates the application running in RAM, while flash_debug/flash_release runs in the flash (XIP).

XIP debugging is clean with the “boot from flash” setting on the board because the debugging has the same sequence as a normal boot.

The debugging steps are as follows:

  1. The debugger downloads the image to the flash.

  2. The debugger resets the device and boots from ROM.

  3. The debugger halts the device and waits for the command from the user.

However, with RAM debugging with the boot from flash setting on the board, the situation is complicated.

  1. The debugger downloads the image to the RAM.

  2. The debugger resets the device and boots it from ROM.

    Note: The image downloaded for debugging and the image running from the flash are different. The images are different because the image in flash might be written by the previous debugging.

  3. The debugger halts the device and sets the PC register value to the entry address of the downloaded image.

The problem here is that step 2 might overwrite the RAM written in step 1. The other issue is that the hardware status is undetermined when PC is set to the start of the RAM application.

To avoid the RAM debugging issue, MCUX IDE/armgcc/MDK provides a plain load feature. To get a clean debugging status, the RAM image is downloaded to the flash.

IAR needs a special setting to achieve the plain load feature as follows:

  1. Right-click the project and select Options.

  2. Select Debugger > Download in the **Options for node “<project_name>”**dialog box.

  3. Clear the Verify download checkbox because the download address is different from the real address.

  4. Select the Override default.board file option.

  5. Copy the default *.board file to the IAR workspace folder.

  6. Change the *.board file path.

  7. Click the Edit button.

  8. Create a range for RAM.

  9. Set the memory range, relocate offset, and flashloader path.

    The new RAM range appears in the flashloader overview.

  10. Follow the instructions in Run an example application and now it is safe to debug the RAM application. As a result, the downloaded RAM application can also boot on reset.

Parent topic:Run a demo application using IAR