Note: This guide is specifically for use with VS Code. For standalone with Segger software please refer to this guide. (How to Use Segger J-Link Plus with i.MX 8M Process... - NXP Community)
In this guide we will describe the process to start using VS Code to debug an SDK application. 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.
This guide covers the following topics:
- Hardware requirements
- Software requirements
- How to find, build, and download the i.MX SDK
- Debug Probe and i.MX 8M Nano EVK connection
- Create an SDK Application with MCUXpresso for VS Code
- Run and debug your SDK Application with MCUXpresso for VS Code
Hardware requirements
Software requirements
How to find, build, and download the i.MX 8M Nano SDK
- Enter Welcome | MCUXpresso SDK Builder (nxp.com)
- Click on "Select Development Board"
- Select EVK-MIMX8MN (MIMX8MN6xxxJZ) from Boards -> i.MX -> EVK-MIMX8MN
- Click on the Build MCUXpresso SDK button
- Click on Download SDK, you'll be redirected to the MCUXpresso SDK Dashboard
- Look for the i.MX 8M Nano SDK and click on Download SDK
- Click on Download SDK archive and documentation, accept the Software Terms and Conditions and the .zip file for the SDK will be downloaded.
Debug Probe and i.MX 8M Nano EVK connection
- Connect the debug cable (USB-UART) to the board and the other end to your PC.
- Connect the power cable to the second USB-C port and to a wall socket. Don't turn on the board yet.
- Connect the JLink Plus to your PC with the USB cable.
- 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 identifies pin 7 identifiable by a "non-connect pin".
For the i.MX 8M Nano, you can identify easily with a number 1 in one corner of the connectors.
- The whole setup should look similar to this:
Create an SDK Application with MCUXpresso for VS Code
Before delving into the details of creating an SDK Application it is important to recognize the sections of VS Code User Interface. This will help us to describe accurately the buttons' position.
- Click on MCUXpresso for VS Code extension icon from the Activity Bar.
- In the section “Quickstart Panel” located in the Side Bar click on “Import Repository.”
- On this window, go to “Local” and select your previously downloaded SDK folder location. Then, click on “Import.”
- Expand the section “Installed Repositories” from Side Bar and verify your selected SDK.
- Expand the section “Projects” from Side Bar and click on “Import Example from Repository” and complete the options:
- Choose a toolchain
- Choose a board
- Choose a template
- Name
- Location
Finally, click on the "Create" button.
- Click on the gear icon located in the project folder to build the code.
- In “Projects” expand the “Settings” options and select “mcuxpresso-tools.json.” Here you will find a JSON file with different parameters. Defines the device that will be used to connect with the J-Link Plus.
Code:
“segger”: {
“device”: “MIMX8MN6_M7”
}
- Expand the section “Debug Probes” and verify that your J-Link Plus debug probe appears.
- Start SEGGER J-Link GDB Server.
- On section “Target Device” select MIMX8MN6_M7 and click “OK”.
- You will see the following window.
Run and debug your SDK Application with MCUXpresso for VS Code
- Click on “Debug” located in the project folder, to start with the debugging session.
- In the Panel click on “Serial Monitor,” set it to the serial debug port with the lowest numbered port with the following settings:
- Baud rate: 115200
- Line ending: None
Click on "Start Monitoring"
- Use the debug controls to run the code.
- Verify your code output in the “Serial Monitor.”