Run a demo application using IAR

Note:

When erasing flash on IAR, IAR will show all range that can connect to flash. Please only check address flash connect to practically. Take the evkmimxrt1160 for example:

  • M7: 0x30000000-0x3fffffff

  • M4: 0x8000000-0x17ffffff

When using IAR download/debug flexspi_nor related targets, make sure the boot switch is put to internal flash boot mode SW1[1:4]:0010.

This section describes the steps required to build, run, and debug example applications provided in the MCUXpresso SDK. The hello_world demo application targeted for the MIMXRT1160-EVK hardware platform is used as an example, although these steps can be applied to any example application in the MCUXpresso SDK.

Build an example application

Do the following steps to build the hello_world demo 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>/<core_type>/iar

    Using the MIMXRT1160-EVK hardware platform as an example, the hello_world workspace is located in:

    <install_dir>/boards/evkmimxrt1160/demo_apps/hello_world/cm7/iar/hello_world_demo_cm7.eww

    Other example applications may have additional folders in their path.

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

    There are twelve project configurations (build targets) supported across MCUXpresso SDK projects:

    • Debug– Compiler optimization is set to low, and debug information is generated for the executable. The linker file is RAMlinker, where text and data section is put in internal TCM.

    • Release– Compiler optimization is set to high, and debug information is not generated. The linker file is RAM linker, where text and data section is put in internal TCM.

    • ram_0x1400_debug– Project configuration is same as the debug target. The linker file is RAM_0x1400linker, where text is put in ITCM with offset 0x1400 and data put in DTCM.

    • ram_0x1400_release– Project configuration is same as the release target. The linker file is RAM_0x1400 linker, where text is put in ITCM with offset 0x1400 and data put in DTCM.

    • sdram_debug– Project configuration is same as the debug target. The linker file is SDRAMlinker, where text is put in internal TCM and data put in SDRAM.

    • sdram_release– Project configuration is same as the release target. The linker file is SDRAMlinker, where text is put in internal TCM and data put in SDRAM.

    • sdram_txt_debug– Project configuration is same as the debug target. The linker file is SDRAM_txtlinker, where text is put in SDRAM and data put in OCRAM.

    • sdram_txt_release– Project configuration is same as the release target. The linker file is SDRAM_txtlinker, where text is put in SDRAM and data put in OCRAM.

    • flexspi_nor_debug– Project configuration is same as the debug target. The linker file is flexspi_nor linker, where text is put in flash and data put in TCM.

    • flexspi_nor_release– Project configuration is same as the release target. The linker file is flexspi_nor linker, where text is put in flash and data put in TCM.

    • flexspi_nor_sdram_release- Project configuration is same as the release target. The linker file is flexspi_nor_sdramlinker, where text is put in flash and data put in SDRAM.

    • flexspi_nor_sdram_debug– Project configuration is same as the debug target. The linker file is flexspi_nor_sdramlinker, where text is put in flash and data put in SDRAM. For some examples need large data memory, only sdram_debugand sdram_releasetargets are supported. 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. This board supports the CMSIS-DAP/mbed/DAPLink debug probe by default. Visit MBED and follow the instructions to install the Windows® operating system serial driver. If running on Linux OS, this step is not required.

  2. Connect the development platform to your PC via USB cable. Connect the USB cable to J11 and make sure SW1[1:4] is 0010b.

  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_BAUDRATEvariable in the board.hfile)

    2. No parity

    3. 8 data bits

    4. 1 stop bit

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

    • When using CMSIS-DAP to debug cm4 project on IAR, an extra option needs to be specified in debugger settings. Check and fill in –macro_param enable_core=1 in Debugger -> Extra Options -> Command line options, as shown in Figure 3.

    • If debugging with JLINK as probe, jlinkscript file is needed.

      • When downloading the cm7 project, check Use command line options, as shown in Figure 4.

      • When downloading the cm4 project, uncheck Use flash loader(s), as shown in Figure 5, and change the contents of command line options as below:

        • Target with SDRAM

          --jlink_script_file=$PROJ_DIR$/../evkmimxrt1160_connect_cm4_cm4side_sdram.jlinkscript
          
        • Other target

          --jlink_script_file=$PROJ_DIR$/../evkmimxrt1160_connect_cm4_cm4side.jlinkscript
          

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

  6. Run the code by clicking the Go button to start the application.

  7. The hello_world application is now running and a banner is displayed on the terminal. If this is not true, check your terminal settings and connections.

Note: There are some limitations on MCUXpresso IDE debugging. For details, see Section 8.6 IAR debug limitation in MCUXpresso SDK Release Notes for MIMXRT1160-EVK (document MCUXSDKMIMXRT116XRN).

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/evkmimxrt1160/multicore_examples/hello_world/cm4/iar/hello_world_cm4.eww

<install_dir>/boards//evkmimxrt1160/multicore_examples/hello_world/cm7/iar/hello_world_cm7.eww

Build both applications separately by clicking the Make button. Build the application for the auxiliary core (cm4) first, because the primary core application project (cm7) 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.

Because the auxiliary core runs always from RAM, only debug and release RAM targets are present in the project. When building the primary core project, it is possible to select either debug/release RAM targets or flexspi_nor_debug/flexspi_nor_release Flash targets. When choosing Flash targets (preferred) the auxiliary core binary is linked with the primary core image and stored in the external SPI Flash memory. During the primary core execution the auxiliary core image is copied from flash into the CM4 RAM and executed.

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 buttons to stop or run both cores simultaneously.

Note: On IAR, the feature to simultaneously debug two cores is only supported by CMSIS-DAP debugger.

Parent topic:Run a demo application using IAR