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 evkbmimxrt1170 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 MIMXRT1170-EVKB 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.
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 MIMXRT1170-EVKB hardware platform as an example, the
hello_world
workspace is located in:<install_dir>/boards/evkbmimxrt1170/demo_apps/hello_world/cm7/iar/hello_world_demo_cm7.eww
Other example applications may have additional folders in their path.
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 isRAM
linker, 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 isRAM
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 isRAM_0x1400
linker, 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 isRAM_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 isSDRAM
linker, 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 isSDRAM
linker, 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 isSDRAM_txt
linker, 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 isSDRAM_txt
linker, 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 isflexspi_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 isflexspi_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 isflexspi_nor_sdram
linker, 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 isflexspi_nor_sdram
linker, where text is put in flash and data put in SDRAM. For some examples need large data memory, onlysdram_debug
andsdram_release
targets are supported. For this example, select hello_world – debug.
To build the demo application, click Make, highlighted in red in Figure 2.
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:
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.
Connect the development platform to your PC via USB cable. Connect the USB cable to J11 and make sure SW1[1:4] is 0010b.
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:
115200 or 9600 baud rate, depending on your board (reference
BOARD_DEBUG_UART_BAUDRATE
variable in the board.hfile)No parity
8 data bits
1 stop bit
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 need 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 debug 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 loaders, as shown in Figure 5, and change the contents of command line options as below:Target with SDRAM
_ --jlink_script_file=$PROJ_DIR$/../evkbmimxrt1170_connect_cm4_cm4side_sdram.jlinkscript
Other target
--jlink_script_file=$PROJ_DIR$/../evkbmimxrt1170_connect_cm4_cm4side.jlinkscript
The application is then downloaded to the target and automatically runs to the
main()
function.Run the code by clicking the Go button to start the application.
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 MIMXRT1170-EVKB (document MCUXSDKMIMXRT117XBRN).
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/evkbmimxrt1170/multicore_examples/hello_world/cm4/iar/hello_world_cm4.eww
<install_dir>/boards//evkbmimxrt1170/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 Figure 5. 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