This is the documentation for the latest (main) development branch of mcuxpresso sdk. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

Run a demo using Arm GCC

This section describes the steps to configure the command line Arm GCC tools to build, run, and debug demo applications and necessary driver libraries provided in the MCUXpresso SDK. The hello_world demo application targeted for i.MX 93 is used as an example, though these steps can be applied to any board, demo or example application in the MCUXpresso SDK.

Linux OS host

The following sections provide steps to run a demo compiled with Arm GCC on Linux host.

Set up toolchain

This section contains the steps to install the necessary components required to build and run a MCUXpresso SDK demo application with the Arm GCC toolchain, as supported by the MCUXpresso SDK.

Install GCC Arm embedded tool chain

Download and run the installer from launchpad.net/gcc-arm-embedded. This is the actual toolset (in other words, compiler, linker, and so on). The GCC toolchain should correspond to the latest supported version, as described in the MCUXpresso SDK Release Notes (document MCUXSDKRN).

Note: See Host setup for Linux OS before compiling the application.

Parent topic:Set up toolchain

Add a new system environment variable for ARMGCC_DIR

Create a new system environment variable and name it ARMGCC_DIR. The value of this variable should point to the Arm GCC Embedded tool chain installation path. For this example, the path is:

$ export ARMGCC_DIR=/work/platforms/tmp/gcc-arm-none-eabi-9-2019-q4-major
$ export PATH= $PATH:/work/platforms/tmp/gcc-arm-none-eabi-9-2019-q4-major

Parent topic:Set up toolchain

Parent topic:Linux OS host

Build an example application

To build an example application, follow these steps.

  1. Change the directory to the example application project directory, which has a path similar to the following:

    <install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc.

    For this example, the exact path is: <install_dir>/boards/mcimx93autoevk/demo_apps/hello_world/armgcc.

  2. Run the build_debug.sh script on the command line to perform the build. The output is shown as below:

    $ ./build_debug.sh
    -- TOOLCHAIN_DIR: /work/platforms/tmp/gcc-arm-none-eabi-9-2019-q4-major
    -- BUILD_TYPE: debug
    -- TOOLCHAIN_DIR: /work/platforms/tmp/gcc-arm-none-eabi-9-2019-q4-major
    -- BUILD_TYPE: debug
    -- The ASM compiler identification is GNU
    -- Found assembler: /work/platforms/tmp/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc
    -- Configuring done
    -- Generating done
    -- Build files have been written to:
    /work/platforms/tmp/nxp/MCIMX93AUTO\_EVK/boards/mcimx93autoevk/demo\_apps/hello\_world/armgcc/demo\_apps/hello\_world/armgcc
    Scanning dependencies of target hello_world.elf
    \[ 6%\] Building C object CMakeFiles/hello\_world.elf.dir/work/platforms/tmp/nxp/MCIMX93AUTO\_EVK/boards/mcimx93autoevk/demo\_apps/hello\_world/hello\_world.c.obj
     < -- skipping lines -- >
    [100%] Linking C executable debug/hello_world.elf
    [100%] Built target hello_world.elf
    

Parent topic:Linux OS host

Run an example application

To run a demo application using J-Link GDB Server application, perform the following steps.

  1. Connect the development platform to your PC via USB cable between the DBG USB connector (J26) and the PC USB connector.

  2. Connect 12 V ~ 20 V power supply and J-Link Plus to the device.

  3. Switch SW5[1:4] to the M core boot and ensure that the image is not available on the boot source. For example, 0b0101 for MicroSD boot. Keep the SD slot empty.

  4. Open the terminal application on the PC, such as PuTTY or TeraTerm, connect to the debug COM port, see How to determine COM port, and configure the terminal with these settings:

    1. 115200 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. Power on the board.

  2. Open the J-Link GDB Server application. Assuming the J-Link software is installed, the application can be launched from a new terminal for the MIMX9352_M33 device:

    $ JLinkGDBServer -jlinkscriptfile /opt/SEGGER/JLink/Devices/NXP/iMX93/NXP_iMX93_Connect_CortexM33.JLinkScript -device MIMX9352_M33 -if SWD
    -----GDB Server start settings-----
    GDBInit file:                  none
    GDB Server Listening port:     2331
    SWO raw output listening port: 2332
    Terminal I/O port:             2333
    Accept remote connection:      localhost only
    Generate logfile:              off
    Verify download:               off
    Init regs on start:            off
    Silent mode:                   off
    Single run mode:               off
    Target connection timeout:     5000 ms
    ------J-Link related settings------
    J-Link Host interface:         USB
    J-Link script:                 Devices\NXP\iMX93\NXP_iMX93_Connect_CortexM33.JLinkScript
    J-Link settings file:          none
    ------Target related settings------
    Target device:                 MIMX9352_M33
    Target interface:              SWD
    Target interface speed:        4000kHz
    Target endian:                 little
    
    Connecting to J-Link...
    J-Link is connected.
    Firmware: J-Link V9 compiled May  7 2021 16:26:12
    Hardware: V9.60
    S/N: 59611220
    Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
    Checking target voltage...
    Target voltage: 1.98 V
    Listening on TCP/IP port 2331
    Connecting to target...
    Connected to target
    Waiting for GDB connection...
    
  3. Change to the directory that contains the example application output. The output can be found in using one of these paths, depending on the build target selected:

    <install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc/debug

    <install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc/release

    For this example, the path is:

    *<install\_dir\>/boards/mcimx93autoevk/demo\_apps/hello\_world/armgcc/debug*

  4. Start the GDB client:

    $ arm-none-eabi-gdb hello_world.elf
    GNU gdb (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 8.3.0.20190709-git
    Copyright (C) 2019 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
       <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from hello_world.elf...
    (gdb)
    
  5. Connect to the GDB server and load the binary by running the following commands:

    1. target remote localhost:2331

    2. monitor reset

    3. monitor halt

    4. load

    
    (gdb) target remote localhost:2331
    Remote debugging using localhost:2331
    0x00000008 in \_\_isr\_vector \(\)
    (gdb) monitor reset
    Resetting target
    (gdb) monitor halt
    (gdb) load
    Loading section .interrupts, size 0x240 lma 0x0
    Loading section .text, size 0x3ab8 lma 0x240
    Loading section .ARM, size size 0x8 lma 0x3cf8
    Loading section .init\_array, size 0x4 lma 0x3d00
    Loading section .fini\_array, size 0x4 lma 0x3d04
    Loading section .data, size 0x64 lma 0x3d08
    Start address 0x2f4, load size 15724
    Transfer rate: 264 KB/sec, 2620 bytes/write.
    \(gdb\)
    
    
    

The application is now downloaded and halted at the reset vector. Execute the monitor go command to start the demo application.

(gdb) monitor go

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: If the software is already running on the M core, the debugger loading image into TCM may get HardFault or a data verification issue. NXP recommends you to follow the steps above to use the debugger. Repowering the board is required to restart the debugger.

Parent topic:Linux OS host

Parent topic:Run a demo using Arm GCC

Windows OS host

The following sections provide steps to run a demo compiled with Arm GCC on Windows OS host.

Set up toolchain

This section contains the steps to install the necessary components required to build and run a MCUXpresso SDK demo application with the Arm GCC toolchain on Windows OS, as supported by the MCUXpresso SDK.

Install GCC Arm Embedded tool chain

Download and run the installer from GNU Arm Embedded Toolchain. This is the actual toolset (in other words, compiler, linker, and so on). The GCC toolchain should correspond to the latest supported version, as described in MCUXpresso SDK Release Notes.

Note: See Host setup for Windows OS before compiling the application.

Parent topic:Set up toolchain

Add a new system environment variable for ARMGCC_DIR

Create a new system environment variable and name it ARMGCC_DIR. The value of this variable should point to the Arm GCC Embedded tool chain installation path.

C:\Program Files (x86)\GNU Tools Arm Embedded\9 2019-q4-major

Reference the installation folder of the GNU Arm GCC Embedded tools for the exact path name.

|

|

Parent topic:Set up toolchain

Parent topic:Windows OS host

Build an example application

To build an example application, follow these steps.

  1. Open a GCC Arm Embedded tool chain command window. To launch the window, from the Windows operating system Start menu, go to Programs -> GNU Tools Arm Embedded <version> and select GCC Command Prompt.

    |

|

  1. Change the directory to the example application project directory, which has a path similar to the following:

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

    For this example, the exact path is:

    <install_dir>/boards/mcimx93autoevk/demo_apps/hello_world/armgcc
    
  2. Type build_debug.bat on the command line or double click on the build_debug.bat file in Windows Explorer to perform the build. The output is as shown in Figure 2.

    |

|

Parent topic:Windows OS host

Run an example application

This section describes steps to run a demo application using J-Link GDB Server application.

To perform this exercise, the following step must be done.

  1. Connect the development platform to your PC via USB cable between the DBG USB connector (J26) and the PC USB connector.

  2. Connect 12 V ~ 20 V power supply and J-Link Plus to the device.

  3. Switch SW5[1:4] to the M core boot and ensure that the image is not available on the boot source. For example, 0b0101 for MicroSD boot. Keep the SD slot empty.

  4. Open the terminal application on the PC, such as PuTTY or TeraTerm, connect to the debug COM port, see How to determine COM port, and configure the terminal with these settings:

    1. 115200 baud rate

    2. No parity

    3. 8 data bits

    4. 1 stop bit

      |

|

  1. Power on the board.

  2. Open the J-Link GDB Server application. Assuming the J-Link software is installed, the application can be launched by going to the Windows operating system Start menu and selecting Programs -> SEGGER -> J-Link <version> J-Link GDB Server.

  3. Modify the settings as shown in Figure 2. The target device selection chosen for this example is MIMX9352_M33 .

    |

|

  1. After GDB server is running, the screen should resemble Figure 3:

    |

|

  1. If not already running, open a GCC Arm Embedded tool chain command window. To launch the window, from the Windows operating system Start menu, go to Programs -> GNU Tools Arm Embedded <version> and select GCC Command Prompt.

    |

|

  1. Change to the directory that contains the example application output. The output can be found in using one of these paths, depending on the build target selected:

    <install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc/debug
    
    <install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc/release
    

    For this example, the path is:

    <install_dir>/boards/mcimx93autoevk/demo_apps/hello_world/armgcc/debug
    
  2. Run the command of arm-none-eabi-gdb.exe <application_name>.elf. For this example, it is arm-none-eabi-gdb.exe hello_world.elf.

    |

|

  1. Run these commands:

    1. target remote localhost:2331

    2. monitor reset

    3. monitor halt

    4. load

  2. The application is now downloaded and halted at the reset vector. Execute the monitor go command to start the demo 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: If the software is already running on the M core, the debugger loading image into TCM may get HardFault or a data verification issue. NXP recommends you to follow the steps above to use the debugger. Repowering the board is required to restart the debugger.

Parent topic:Windows OS host

Parent topic:Run a demo using Arm GCC