How to Use Segger J-Link Plus with i.MX 8M Processors EVKs to Debug an SDK Application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Use Segger J-Link Plus with i.MX 8M Processors EVKs to Debug an SDK Application

How to Use Segger J-Link Plus with i.MX 8M Processors EVKs to Debug an SDK Application

Note: This guide is specifically for use with Segger software. For steps to use with the MCUXpresso extension for VSCode please refer to How to Use Segger J-Link Plus with i.MX 8M Process... - NXP Community

This guide aims to be a technical reference to start using the SEGGER J-Link Plus debug probe on the i.MX 8M Family processors. The board used for this guide specifically is the i.MX 8M Nano EVK, but it also applies to all processors of the i.MX 8M Family.

Here we will describe the process using the following structure:

  • Hardware requirements
  • Software requirements
  • How to find, build, and download the i.MX SDK
  • Host setup
  • Build an example application
  • Target setup
  • Run an example application


Hardware requirements

Software requirements

 

How to find, build, and download the i.MX 8M Nano SDK

  1. Enter Welcome | MCUXpresso SDK Builder (nxp.com)
  2. Click on "Select Development Board" 
    hector_delgado_1-1697746581517.png
  3. Select EVK-MIMX8MN (MIMX8MN6xxxJZ) from Boards -> i.MX -> EVK-MIMX8MN
    hector_delgado_2-1697746609185.png
  4. Click on the Build MCUXpresso SDK button
    hector_delgado_3-1697746626426.png
  5. Click on Download SDK, you'll be redirected to the MCUXpresso SDK Dashboard
    hector_delgado_4-1697746644373.png
  6. Look for the i.MX 8M Nano SDK and click on Download SDK
    hector_delgado_5-1697746661949.png
  7. Click on Download SDK archive and documentation, accept the Software Terms and Conditions and the .zip file for the SDK will be downloaded.
    hector_delgado_6-1697746676556.png

 

Host Setup

  1. J-Link Software and Documentation Pack for Windows
    1. Download J-Link Software and Documentation Pack for Windows (https://www.segger.com/products/debug-probes/j-link/models/j-link-plus/)
      hector_delgado_7-1697746800599.png
    2. Execute .exe file downloaded and then click on "Next"
      hector_delgado_8-1697746827080.png
    3. Follow the installation wizard with default parameters and click on "Finish".

      hector_delgado_9-1697746850436.png

       

  2. MinGW
    1. Download the MinGW installer from MinGW - Minimalist GNU for Windows - Browse /Installer at SourceForge.net. Follow the installer instructions leaving all options in their default values.
      mingw1.png
    2. Click on Continue when the installer finishes.
    3. A MinGW Installation Manager window will pop up, select mingw32-base and msys-base from basic setup. Click on the Installation menu and select Apply Changes.
      hector_delgado_10-1697747573684.png
    4. On the next window, click on Apply and wait for the package to finish downloading.
    5. Add the appropriate item to the Windows operating system path environment variable. It can be found under Control Panel->System and Security->System->Advanced System Settings in the Environment Variables... section. The path is: \bin. Assuming the default installation path, "C:\MinGW". If the path is not set correctly, the toolchain does not work. Note: If you have C:\MinGW\msys\x.x\bin in your PATH variable (as required by KSDK 1.0.0), remove it to ensure that the new GCC build system works correctly.
      hector_delgado_0-1698081697030.png

       

  3. CMake
    1. Download CMake Windows x64 Installer from  Download CMake. Scroll down to find the latest release for the installer:
      hector_delgado_11-1697747685180.png
    2. Run the installer and follow the instructions. Make sure to check the Add CMake to system PATH for all users option during the installation process.
    3. Restart your PC to apply changes.
  4. GNU ARM Embedded Toolchain
    1. Download the GNU ARM Embedded Toolchain installer from Downloads | GNU Arm Embedded Toolchain Downloads – Arm Developer, scroll down to find the latest release for the installer:
      hector_delgado_12-1697747745177.png
    2. Follow the installer instructions and check the Add to PATH option at the end of the process.
    3. Add a new system environment variable named ARMGCC_DIR with the GNU ARM embedded Toolchain installation path as its value
      ARMGCC_DIR=ARMGCC_DIR=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10​
      hector_delgado_1-1698081860179.png

 

Build and example application

  1. Press the Windows Key and search for GCC Command Prompt and run it.
    hector_delgado_0-1697748886816.png
  2. Change the directory to the example application project directory (inside the armgcc folder), for example:
    C:\Users/<user>\Documents\8MNANO\boards\evkmimx8mn\demo_apps\hello_world\armgcc
  3. Type build_debug.bat on the command line or double click the build_debug.bat file (inside the armgcc folder of the application project) through Windows Explorer
  4. Wait for the building process to end and make sure no error messages are shown.


Target Setup

  1. Connect the debug cable (USB-UART) to the board and the other end to your PC.
    hector_delgado_1-1697749079954.png
  2. Connect the power cable to the second USB-C port and to a wall socket. Don't turn on the board yet.
    hector_delgado_2-1697749135391.png
  3. Connect the JLink Plus to your PC with the USB cable.
    hector_delgado_3-1697749187156.png
  4. Connect the JLink Plus to the JTAG of the i.MX 8M Nano EVK board
    In this part we will need to identify pin number 1 from the 9 Pin Cortex-M adapter and from the i.MX 8M Nano EVK board. For the first one identify pin 7 identifiable by a "Non-connect pin".
    hector_delgado_4-1697749207742.png

    For the i.MX 8M Nano, you can identify easily with a number 1 in one corner of the connectors.

    hector_delgado_7-1697749286806.png

     

    hector_delgado_6-1697749236838.png
  5.  The whole setup should look similar to this:
    hector_delgado_8-1697749313545.png


Run an example application

  1. Open a terminal application (TeraTerm, PuTTY, etc.) on your host PC and set it to the serial debug port with the lowest numbered port with the following settings:

    Speed: 115200
    Data: 8-bit
    Parity: none
    Stop bits: 1 bit
    Flow Control: none

    hector_delgado_9-1697749388369.png
    hector_delgado_10-1697749412044.png
  2. Start SEGGER J-Link GDB Server.
  3. On section “Target Device” select MIMX8MN6_M7 and click “OK”.
    hector_delgado_11-1697749448118.png
  4. You will see the following window.
    hector_delgado_13-1697749479981.png
  5. Open a new instance of GCC Command Prompt.
  6. Change to the directory with the example previously compiled. Here is the path to folder that contains the files:
    <install_dir>/boards/<boad_name>/<example_type>/<application_name>/armgcc/debug​
  7. Run the command:
    arm-none-eabi-gdb.exe <application_name>.elf.​

    Example:
    hector_delgado_14-1697749552001.png
  8. At this point you are in the GDB Command Prompt, run the following commands:
    target remote localhost:2331
    monitor reset
    monitor halt
    load
    monitor go
    hector_delgado_15-1697749699907.png
  9. The application will be now running and you can see the “hello world” on your terminal (PuTTY,Tera Term, etc.).
    hector_delgado_16-1697749753161.png

     

100% helpful (1/1)
Version history
Last update:
‎10-30-2023 11:33 AM
Updated by: