How to use Segger J-link with i.MX 93 processor to debug in VSCode

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

How to use Segger J-link with i.MX 93 processor to debug in VSCode

3,093 Views
PeterLendvai
Contributor I

Hi!

I've read the guide about debugging with j-link on i.MX 8 processors. I've tried this guide but with the iMX93. I've encountered a problem, when I wanted to connect to J-link GDB server application. The "MIMX9352_M33" processor device was missing.

Is it possible, that Segger haven't added the support for this device yet?

Thank you!

0 Kudos
Reply
12 Replies

3,085 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @PeterLendvai!

Please check the AN14120, in that we explain how to debug the M core using VS code and Segger J-Link!

https://docs.nxp.com/bundle/AN14120/page/topics/introduction.html?_gl=1*1q07fw6*_ga*MTU5OTEyNzU2MC4x....

Best Regards!

Chavira

0 Kudos
Reply

3,018 Views
PeterLendvai
Contributor I

Hi!

Thank you for the article!
I've tried the u-boot verison, but when I start the M33, the following error message shown in the consol, then the core restarts.

fatload mmc 1:1 80000000 sdk20-app.bin
12048 bytes read in 5 ms (2.3 MiB/s)
=> cp.b 0x80000000 0x201e0000 0x10000
=> bootaux 0x1ffe0000 0
"Synchronous Abort" handler, esr 0x96000006
elr: 0000000080204de8 lr : 0000000080204ef4 (reloc)
elr: 00000000bfef9de8 lr : 00000000bfef9ef4
x0 : 00000000bff943b0 x1 : 000000001ffe0000
x2 : 0000000000000010 x3 : 00000000bdf4901a
x4 : 0000000000000100 x5 : 0000000000000000
x6 : 00000000bff9395f x7 : 0000000000000044
x8 : 0000000000000010 x9 : 00000000d126d112
x10: 0000000000000000 x11: 00000000bdf1b290
x12: 0000000000000000 x13: 0000000000000200
x14: 00000000bdee9970 x15: 0000000000000020
x16: 00000000bfef9e40 x17: 0000000000000000
x18: 00000000bdef4d90 x19: 0000000000000000
x20: 00000000bdf0ab10 x21: 0000000000000003
x22: 00000000bdf0ab10 x23: 0000000000000003
x24: 00000000bffce404 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 00000000bdf49050 x29: 00000000bdee8d20

Code: f00004c0 910ec000 a9017bfd 910043fd (b9400422)
Resetting CPU ...

 

Currently I'm working on an Avnet Smarc MSC SM2S-IMX93 module. Maybe there will be some differences between this and the NXP's evk board.

And I've noticed this:

u-boot=> fatload mmc 1:1 80000000 sdk20-app.bin
u-boot=> cp.b 0x80000000 0x201e0000 0x10000
u-boot=> bootaux 0x1ffe0000 0

Shouldn't the bootaux call the 0x201e0000 address? If I change this, I'll get this text:

# Starting auxiliary core stack = 0x464C457F, pc = 0x00010101...

Thanks for the clarification!

0 Kudos
Reply

3,008 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @PeterLendvai!

 

Yes, you are right the Application note is wrong!

 

The correct steps are:

 

=> fatload mmc 1:1 0x80000000 m33_image.bin

=> cp.b 0x80000000 0x201e0000 0x10000

=> bootaux 0x201e0000

 

The correct steps for that can be found at the Getting Started with the i.MX93 EVK:

 

https://www.nxp.com/document/guide/getting-started-with-the-i-mx93-evk:GS-IMX93EVK?section=build-run

 

I will notify the error to the internal team.

 

Sorry for the mistake!

 

Best Regards!

Chavira

0 Kudos
Reply

2,950 Views
PeterLendvai
Contributor I

Dear @Chavira !

I've successfully built the Hello World project, and I was able to start the m33 core from u-boot.

After that I've tried to attach my segger j-link in VsCode, but I always get the following:

"Unable to start debugging. No process is associated with this object"

And my carrier board restarts.

What am I missing?

0 Kudos
Reply

2,034 Views
daniel_fudge
Contributor III

I'm hitting a very similar issue. I'm using VSCode with a i.MX 1170 EVK and also get the "Unable to start debugging. No process is associated with this object" error. Is there a patch for that as well?

0 Kudos
Reply

2,006 Views
cristi_lupascu
NXP Employee
NXP Employee

Hi @daniel_fudge 

The error message is pretty generic, but it indicates that something happened to the JLink process. Enabling logging might help narrow down the issue. To enable logging:

1. Go to the "project's directory > .vscode > launch.json" and set "logging": true

2. Start debugging and open "Debug Console" from the bottom pane. Please post all the output from this console here.

 

Best regards,

Cristi

0 Kudos
Reply

1,990 Views
daniel_fudge
Contributor III

This is my launch.json as well for reference.

{
  "configurations": [
    {
      "type": "cppdbg",
      "name": "Debug project configuration",
      "request": "launch",
      "cwd": "${workspaceRoot}",
      "MIMode": "gdb",
      "setupCommands": [
        {"text": "set remotetimeout 600"},
        {"text": "set debug-file-directory"}
      ],
      "program": "",
      "miDebuggerServerAddress": "", // Remote GDB server address. If this is provided, "debugServerPath" will not be auto-completed.
      "variables": {
        "mcuxStopAtSymbol": "main", // Initial breakpoint
        "mcuxSerialNumber": "723423158", // Probe serial number. If not specified, the one from the selected debug probe (in extension view) will be used.
        "mcuxAttach": "false", // Start debug in attach mode
        "mcuxRemoteProbeType": "", // Remote Probe Type ("LinkServer", "SEGGER", "PEmicro") used only when connecting to a remote server
        "mcuxSkipBuildWhenDebug": "false" // Skip build when debug
      },
      "logging": {
        "engineLogging": true
      }
    }
  ]
}
0 Kudos
Reply

1,991 Views
daniel_fudge
Contributor III

Here is the debug console output.

 

1: (43) LaunchOptions{"type":"cppdbg","name":"Debug project configuration","request":"launch","cwd":"/Users/danielfudge/code/MCUXpresso-VSCode/evkmimxrt1170_hello_world_demo_cm7","MIMode":"gdb","setupCommands":[{"text":"set remotetimeout 600"},{"text":"set debug-file-directory"}],"program":"/Users/danielfudge/code/MCUXpresso-VSCode/evkmimxrt1170_hello_world_demo_cm7/armgcc/debug/hello_world_demo_cm7.elf","miDebuggerServerAddress":"127.0.0.1:2348","variables":{"mcuxStopAtSymbol":"main","mcuxSerialNumber":"723423158","mcuxAttach":"false","mcuxRemoteProbeType":"","mcuxSkipBuildWhenDebug":"false","workspaceFolder":"/Users/danielfudge/code/MCUXpresso-VSCode/evkmimxrt1170_hello_world_demo_cm7","workspaceFolderBasename":"evkmimxrt1170_hello_world_demo_cm7"},"logging":{"engineLogging":true},"__configurationTarget":6,"__mcuxpresso":{"probeType":"SEGGER","gdbStart":2348,"gdb":2348,"semihost":2349,"swo":2350,"gdbPort":2348,"gdbStartPort":2348,"swoPort":2350},"miDebuggerPath":"/Users/danielfudge/.mcuxpressotools/arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb","debugServerPath":"/Applications/SEGGER/JLink_V796o/JLinkGDBServerCLExe","serverStarted":"Connected to target","stopAtEntry":true,"svdPath":"/Users/danielfudge/code/MCUXpresso-VSCode/SDK_2_16_000_MIMXRT1170-EVK_ARM-GCC/devices/MIMXRT1176/MIMXRT1176_cm7.xml","unknownBreakpointHandling":"stop","debugServerArgs":"-SettingsFile /Users/danielfudge/code/MCUXpresso-VSCode/evkmimxrt1170_hello_world_demo_cm7/armgcc/debug/JLink_hello_world_demo_cm7.jlink -nosilent -swoport 2350 -singlerun -endian little -noir -speed 4000 -port 2348 -vd -device MIMXRT1176xxxA_M7 -if SWD -halt -reportuseraction -select USB=723423158 ","postRemoteConnectCommands":[{"text":"monitor reset"},{"text":"load"},{"text":"tbreak main"},{"text":"monitor semihosting enable"},{"text":"monitor exec SetRestartOnClose=1"}],"__sessionId":"2eda37d3-2de4-417d-9457-63d7e2a7e3c3"}
1: (117) codeSign-stderr: Executable=/Users/danielfudge/.mcuxpressotools/arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-arm-none-eabi/bin/arm-none-eabi-gdb
1: (120) Starting: "/Applications/SEGGER/JLink_V796o/JLinkGDBServerCLExe" -SettingsFile /Users/danielfudge/code/MCUXpresso-VSCode/evkmimxrt1170_hello_world_demo_cm7/armgcc/debug/JLink_hello_world_demo_cm7.jlink -nosilent -swoport 2350 -singlerun -endian little -noir -speed 4000 -port 2348 -vd -device MIMXRT1176xxxA_M7 -if SWD -halt -reportuseraction -select USB=723423158
1: (162) ->SEGGER J-Link GDB Server V7.96o Command Line Version
1: (165) ->
1: (167) ->JLinkARM.dll V7.96o (DLL compiled Jun 26 2024 16:14:20)
1: (167) ->
1: (167) ->Command line: -SettingsFile /Users/danielfudge/code/MCUXpresso-VSCode/evkmimxrt1170_hello_world_demo_cm7/armgcc/debug/JLink_hello_world_demo_cm7.jlink -nosilent -swoport 2350 -singlerun -endian little -noir -speed 4000 -port 2348 -vd -device MIMXRT1176xxxA_M7 -if SWD -halt -reportuseraction -select USB=723423158
1: (167) ->-----GDB Server start settings-----
1: (167) ->GDBInit file: none
1: (167) ->GDB Server Listening port: 2348
1: (167) ->SWO raw output listening port: 2350
1: (167) ->Terminal I/O port: 2333
1: (167) ->Accept remote connection: yes
1: (168) ->Generate logfile: off
1: (168) ->Verify download: on
1: (168) ->Init regs on start: off
1: (168) ->Silent mode: off
1: (168) ->Single run mode: on
1: (168) ->Target connection timeout: 0 ms
1: (168) ->------J-Link related settings------
1: (168) ->J-Link Host interface: USB
1: (168) ->J-Link script: none
1: (168) ->J-Link settings file: /Users/danielfudge/code/MCUXpresso-VSCode/evkmimxrt1170_hello_world_demo_cm7/armgcc/debug/JLink_hello_world_demo_cm7.jlink
1: (168) ->------Target related settings------
1: (168) ->Target device: MIMXRT1176xxxA_M7
1: (168) ->Target device parameters: none
1: (168) ->Target interface: SWD
1: (168) ->Target interface speed: 4000kHz
1: (168) ->Target endian: little
1: (168) ->
1: (176) ->Connecting to J-Link...
1: (10159) <-logout
1: (10230) Send Event AD7MessageEvent

 

0 Kudos
Reply

1,935 Views
cristi_lupascu
NXP Employee
NXP Employee

Hi @daniel_fudge 

We've reproduced the issue. It looks like the J-Link process causes a segmentation fault, but it only occurs randomly on macOS. Their latest J-Link V7.96t  should fix the issue. Can you try downloading and installing it? VSCode should detect it automatically afterwards.

Best regards,

Cristi

0 Kudos
Reply

2,945 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @PeterLendvai!

Thank you for contacting NXP Support!

 

For iMX93 you should download a patch.

 

Please refer to this page:

 

https://docs.nxp.com/bundle/AN14120/page/topics/prepare_the_boards_for_the_debugger.html

 

After that, you can follow the next steps:

 

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/How-to-Use-Segger-J-Link-Plus-with-i-MX-...

 

Note: You have to connect the debugger before starting the board.

 

Best Regards!

Chavira

0 Kudos
Reply

2,901 Views
PeterLendvai
Contributor I

Dear @Chavira !

"Note: You have to connect the debugger before starting the board."

How can I achive that? With my MSC SM2-MB-EP1 carrier board, when I power on the carrier board, the module starts and I can stop only in u-boot. Until that I cannot connect the debugger, because there isn't detectable target voltage.

Your i.MX 93 EVK Evaluation Kit halts the processor until the switch won't turn on?

0 Kudos
Reply

2,881 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @PeterLendvai!
 
I refer to connecting the debugger to the computer first and then turning on the board.
You should stop the Linux boot and do the process on U-boot.
 
Please take our article as a reference.

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/How-to-Use-Segger-J-Link-Plus-with-i-MX-...

https://docs.nxp.com/bundle/AN14120/page/topics/prepare_the_boards_for_the_debugger.html
 
Best Regards!

Chavira

0 Kudos
Reply