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 8.32.3 is used in the following example. The IAR toolchain should correspond to the latest supported version, as described in the MCUXpresso SDK Release Notes FRDM-K32L3A6 (document ID: MCUXSDKK32RN).

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-K32L3A6 hardware platform as an example, the hello_world workspace is located in:

    <install_dir>/boards/frdmk32/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.

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

  4. 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. Connect the development platform to your PC via USB cable.

  2. 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

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

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

  5. Run the code by clicking the Go button.

  6. 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

Build a multicore example application

This section describes the steps to build and run a dual-core application. The demo applications workspace files are located in this folder:

<install_dir>/boards/<board_name>/multicore_examples/<application_name>/<core_type>/iar

Begin with a simple dual-core version of the Hello World application. The multicore Hello World IAR workspaces are located in this folder:

<install_dir>/boards/frdmk32l3a6/multicore_examples/hello_world/cm0plus/iar/hello_world_cm0plus.eww

<install_dir>/boards/frdmk32l3a6/multicore_examples/hello_world/cm4/iar/hello_world_cm4.eww

Build both applications separately by clicking the Make button. Build the application for the auxiliary core (cm0plus) first, because the primary core application project (cm4) needs to know the auxiliary core application binary when running the linker. It is not possible to finish the primary core linker when the auxiliary core application binary is not ready.

Parent topic:Run a demo application using IAR

Run a multicore example application

The primary core debugger handles flashing both primary and the auxiliary core applications into the SoC flash memory. To download and run the multicore application, switch to the primary core application project and perform steps 1 – 4 as described in Run an example application. These steps are common for both single core and dual-core applications in IAR.

After clicking the “Download and Debug” button, the auxiliary core project is opened in the separate EWARM instance. Both the primary and auxiliary image are loaded into the device flash memory and the primary core application is executed. It stops at the default C language entry point in the main() function.

Run both cores by clicking the “Start all cores” button to start the multicore application.

During the primary core code execution, the auxiliary core is released from the reset. The hello_world multicore application is now running and a banner is displayed on the terminal. If this does not appear, check the terminal settings and connections.

An LED controlled by the auxiliary core starts flashing, indicating that the auxiliary core has been released from the reset and is running correctly. When both cores are running, use the “Stop all cores” and “Start all cores” control buttons to stop or run both cores simultaneously.

![](../images/stop_start_all_cores_control_buttons.png “”Stop all cores” and “Start all cores” control buttons”)

Parent topic:Run a demo application using IAR