Monday, February 19th 2018, 8:33pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

1

Thursday, February 1st 2018, 3:31pm

JLINK GDB and ARM MCU Eclipse for MX7D M4

Hello everyone,

after being able to connect to my target hardware (i.MX7D) using JLink.exe I wanted to integrate the JLINK in ARM MCU Eclipse.

I configured Eclipse based on https://gnu-mcu-eclipse.github.io/debug/jlink/

ON starting a debug session, Eclipse creates an error:

J-Link GDB Server failed:
Could not connect to target. Please check if target is powered and if ribbon cable is plugged properly.
For more details, see the JLinkGDBServerCL.exe console.


and my console outputs the following:


SEGGER J-Link GDB Server V6.22g Command Line Version


JLinkARM.dll V6.22g (DLL compiled Jan 17 2018 16:39:42)


Command line: -if swd -device MCIMX7D7_M4 -endian little -speed 100 -port 2331 -swoport 2332 -telnetport 2333 -vd -ir -localhostonly 1 -singlerun -strict -timeout 0 -nogui
-----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: on
Init regs on start: on
Silent mode: off
Single run mode: on
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: MCIMX7D7_M4
Target interface: SWD
Target interface speed: 100kHz
Target endian: little


Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V10 compiled Jan 11 2018 10:41:05
Hardware: V10.10
S/N: 50117772
Feature(s): GDB
Checking target voltage...
Target voltage: 1.81 V
Listening on TCP/IP port 2331
Connecting to target...WARNING: CPU could not be halted
Halting target device failed. Trying again with reset
WARNING: CPU could not be halted
Failed to halt target device on connect
ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
Shutting down...
Could not connect to target.
Please check power, connection and settings.

Any idea why this might happen? I realized there is no script file attached.

Interesting is the target device that is listed as MCIMX7D7_M4, because in the project settings i have selected an MCIMX7D2 type. Manually changing the projectname_debug.launch file to the D2 results in

Failed to set device (MCIMX7D2_M4). Unknown device selected?ERROR : Failed to set device.

On the Segger compatible devices page, i dont see the MX7 being listed. May the JLink not be used with an MX7 in eclipse?

____________
On changing the device from M4 to A7_0 (without actually changing the project settings or target core or anything else) i get the following output (that doesnt work as expected, but connects at least):


Command line: -if swd -device MCIMX7D5_A7_0 -endian little -speed 100 -port 2331 -swoport 2332 -telnetport 2333 -vd -ir -localhostonly 1 -singlerun -strict -timeout 0 -nogui
[..]
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: MCIMX7D5_A7_0
[..]


Connecting to J-Link...
J-Link is connected.
[...]
Connecting to target...ERROR: Cortex-A/R-SWD (connect): Could not identify core via peripheral ID registers.
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00000000 (Data = 0xE59FF018)
Read 4 bytes @ address 0x00000000 (Data = 0xE59FF018)
Received monitor command: speed 1000
Target interface speed set to 1000 kHz
Received monitor command: clrbp
Received monitor command: reset
Resetting target
Received monitor command: halt
Halting target CPU...
...Target halted (PC = 0x00000C60)
Received monitor command: regs
[...]
Reading all registers
Received monitor command: speed auto
Select auto target interface speed (1000 kHz)
Received monitor command: flash breakpoints 1
Flash breakpoints enabled
Received monitor command: semihosting enable
Semi-hosting enabled (SVC Addr = 0x08)
Received monitor command: semihosting IOClient 1
Semihosting I/O set to TELNET Client
Received monitor command: SWO DisableTarget 0xFFFFFFFF
SWO disabled successfully.
Received monitor command: SWO EnableTarget 80000000 1000000 0x1 0
SWO enabled successfully.
WARNING: Failed to read memory @ address 0x00000C60
Downloading 12 bytes @ address 0x00008000 - Verify failed
[.. multiple failed attempts ..]
Writing register (PC = 0x0000800C)
Received monitor command: clrbp
Received monitor command: reset
Resetting target
Received monitor command: halt
Halting target CPU...
...Target halted (PC = 0x10084000)
WARNING: Failed to read memory @ address 0x0000800C
Received monitor command: regs
[.. multiple commands ..]
Reading all registers
Starting target CPU...
ERROR: Could not start CPU core. (ErrorCode: -1)
WARNING: Mis-aligned memory read: Address: 0xFFFFFFFF, NumBytes: 4, Alignment: 4 (Word-aligned)
Reading all registers
WARNING: Failed to read memory @ address 0x10084000
[...]

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

2

Thursday, February 1st 2018, 3:39pm

Some additional info:

I enabled log file output.
From the log file:

02-00000000-00-00000306-01E9: Found Cortex-M4 r0p1, Little endian. -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU_ReadMem(4 bytes @ 0xE0002000)

[.. many more romtbl reads ..]


02-00000000-00-00000310-00A2: T2448 000:310 JLINK_GetIdData(...) >0x0D TIF> >0x21 TIF> ScanLen=4 NumDevices=1 aId[0]=0x5BA02477 aIrRead[0]=0 aScanLen[0]=0 aScanRead[0]=0 (0001ms, 0308ms total)
02-00000000-00-00000310-0048: T2448 000:311 JLINK_GetDeviceFamily() returns 14 (0000ms, 0308ms total)
02-00000000-00-00000310-004D: T2448 000:311 JLINK_CORE_GetFound() returns 0xE0000FF (0000ms, 0308ms total)
02-00000000-00-00000310-0044: T2448 000:311 JLINK_IsHalted() returns ERROR (0000ms, 0308ms total)
03-00000000-00-00000310-0023: ERROR: Could not connect to target.

03-00000000-00-00000310-0035: Target connection failed. GDBServer will be closed...
03-00000000-00-00000321-0037: Restoring target state and closing J-Link connection...
02-00000000-00-00000321-0041: T2448 000:322 JLINK_IsOpen() returns 0x01 (0000ms, 0308ms total)
02-00000000-00-00000321-0058: T2448 000:322 JLINK_ExecCommand("ClrAllBPs", ...). returns 0x00 (0000ms, 0308ms total)
03-00000000-00-00000341-0010: Shutting down...

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

3

Thursday, February 1st 2018, 4:22pm

I have found out how to add a script file based on https://wiki.segger.com/Eclipse

This is the output for the SABRE board:



------J-Link related settings------
J-Link Host interface: USB
J-Link script: C:\Eclipse_MCU_And_Toolchains\JLink\File_NXP_iMX7D_Connect_CortexM4.JLinkScript
J-Link settings file: none
[...]

eature(s): GDB
Checking target voltage...
Target voltage: 3.33 V
Listening on TCP/IP port 2331
Connecting to target...ERROR: Error while compiling J-Link script file: Error while compiling. Line 1, column 8:
<!DOCTYPE html>
Pragma unknown

Bad JTAG communication: Write to IR: Expected 0x1, got 0xF (TAP Command : 10) @ Off 0x5.
Could not find core in Coresight setup

Ant output for our custom board (giving a different error):

Checking target voltage...
Target voltage: 1.81 V
Listening on TCP/IP port 2331
Connecting to target...ERROR: Error while compiling J-Link script file: Error while compiling. Line 1, column 8:
<!DOCTYPE html>
Pragma unknown




J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x5BA00477 (Cortex-M4)
WARNING: CPU could not be halted
Halting target device failed. Trying again with reset
WARNING: CPU could not be halted
WARNING: CPU could not be halted
ERROR: Error while compiling J-Link script file: Error while compiling. Line 1, column 8:
<!DOCTYPE html>
Pragma unknown


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 699

4

Thursday, February 1st 2018, 5:13pm

Hello,

Thank you for your inquiry.
The JLinkScript you are using, is it from the J-Link software install folder?
Did you modify the JLinkScript in some way?
What J-Link software version are you using in Eclipse? Make sure it is the latest one and that you use the JLinkScript from the install folder.

Best regards,
Nino

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

5

Thursday, February 1st 2018, 5:55pm

Quoted

The JLinkScript you are using, is it from the J-Link software install folder?
I used a downloaded the version from your wiki page. I checked the content of the downloaded version ... it was actually a web page and not a script so I probably screwed up the file download.
Switched to the script in the install folder.

Quoted

Did you modify the JLinkScript in some way?
Nope.

Quoted

What J-Link software version are you using in Eclipse?
First console output in OP:
SEGGER J-Link GDB Server V6.22g Command Line Version

JLinkARM.dll V6.22g (DLL compiled Jan 17 2018 16:39:42)
should be the latest version. Was downloaded a few days ago._____________________________
What is interesting as well:
Error when i try to debug the M4 on the Sabre board:
"Feature(s): GDB
Checking target voltage...
Target voltage: 3.32 V
Listening on TCP/IP port 2331
Connecting to target...ERROR: Bad JTAG communication: Write to IR: Expected 0x1, got 0xF (TAP Command : 10) @ Off 0x5.
Could not find core in Coresight setup
ERROR: Could not connect to target."


While trying to debug on the M4 on custom hardware a different error occurs:Feature(s): GDB
Checking target voltage...
Target voltage: 1.81 V
Listening on TCP/IP port 2331
Connecting to target...
J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x5BA00477 (Cortex-M4)
WARNING: CPU could not be halted
Halting target device failed. Trying again with reset
WARNING: CPU could not be halted
Failed to halt target device on connect
ERROR: Could not connect to target.




Connecting via JLink.exe and not through Eclipse:
SABRE:
Speed>300
Device "MCIMX7D7_M4" selected.


Connecting to target via JTAG
*************************************************
J-Link script: iMX7D Cortex-M4 core J-Link script
*************************************************
TotalIRLen = 4, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x5BA00477, IRLen: 04, CoreSight JTAG-DP
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[1]: APB-AP (IDR: Not set)
AP[2]: CUSTOM-AP (IDR: Not set)
AP[3]: CUSTOM-AP (IDR: Not set)
AP[4]: AHB-AP (IDR: Not set)
AP[4]: Skipped. Could not read CPUID register
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[1]: APB-AP (IDR: Not set)
AP[2]: CUSTOM-AP (IDR: Not set)
AP[3]: CUSTOM-AP (IDR: Not set)
AP[4]: AHB-AP (IDR: Not set)
AP[4]: Skipped. No ROM table (AHB-AP ROM base: 0x00000000)
*************************************************
J-Link script: iMX7D Cortex-M4 core J-Link script
*************************************************
*************************************************
J-Link script: iMX7D Cortex-M4 core J-Link script
*************************************************

****** Error: Bad JTAG communication: Write to IR: Expected 0x1, got 0xF (TAP Command : 10) @ Off 0x5.
Could not find core in Coresight setup


CUSTOM:
Specify target interface speed [kHz]. : 4000 kHz
Speed>300
Device "MCIMX7D3_M4" selected.


Connecting to target via JTAG
*************************************************
J-Link script: iMX7D Cortex-M4 core J-Link script
*************************************************
TotalIRLen = 4, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x5BA00477, IRLen: 04, CoreSight JTAG-DP
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[1]: APB-AP (IDR: Not set)
AP[2]: CUSTOM-AP (IDR: Not set)
AP[3]: CUSTOM-AP (IDR: Not set)
AP[4]: AHB-AP (IDR: Not set)
AP[4]: Core found
AP[4]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
ROMTbl[0][7]: E0043000, CID: B105900D, PID: 001BB908 CSTF
ROMTbl[0][8]: E0044000, CID: B105900D, PID: 004BB906 CTI
Cortex-M4 identified.

Most of all i wonder why the results between the sabre and the custom board are different. I mean, ofc they can be different as in the custom hardware doesn't work as intendet ... but I'd expect the SABRE to work rather well.What may or may not be important:
Our custom hardware actually uses an MX7D2... device. Only D3, D5 and D7 are available in the jlink tools.

Any ideas on what might be going wrong?[/size]

This post has been edited 3 times, last edit by "LHE" (Feb 1st 2018, 5:58pm)


LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

6

Friday, February 2nd 2018, 10:05am

Another piece of info:
On the SABRE board I can see the reset line being pulled low several times while on the custom board the reset signal is always remaining high.

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

7

Friday, February 2nd 2018, 11:57am

And some more info:

The SoC has two external reset signals:
TRST# and POR# (jtag reset and power on reset).

On the custom board, TRST is connected to the JTAG header and the processors TRST pin.
POR is connected to a PMIC (open drain), the processors POR pin and to TRST via shottky diode (to prevent overvoltage on the POR pin in case the emulator has been set up incorrectly).

JTAG is running on 1V8.
POR was 2V2 with the diode attached and 3V3 with the diode removed.
Means i cannot have the 2 pins connected.

based on figure 4-36 (reset system) in the MX7 datasheet I understand it does not really matter if POR or TRST are pulled low, as they are connected to the internal system via AND. I am just wondering if this AND can operate correctly if one input is 1V8 and one is 3V3 ...

With the diode removed, the JLINK pulls down TRST for 20ms (and the processor may or may not reset). I guess I have to figure out how to fix this in hardware?!

Thanks!

This post has been edited 1 times, last edit by "LHE" (Feb 2nd 2018, 12:06pm)


LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

8

Friday, February 2nd 2018, 2:31pm

Alright, I have added 2 FETs so the reset signals are on 1V8 / 3V3 and get pulled down correctly.

However, the error remains ..



Feature(s): GDB
Checking target voltage...
Target voltage: 1.81 V
Listening on TCP/IP port 2331
Connecting to target...
J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x5BA00477 (Cortex-M4)
WARNING: CPU could not be halted
Halting target device failed. Trying again with reset
WARNING: CPU could not be halted
WARNING: CPU could not be halted
WARNING: CPU could not be halted
Failed to halt target device on connect
ERROR: Could not connect to target.
Target connection failed. GDBServer will be closed...Restoring target state and closing J-Link connection...
Shutting down...
Could not connect to target.
Please check power, connection and settings.
C:\Program Files (x86)\SEGGER\JLink_V622g>

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

9

Friday, February 2nd 2018, 3:56pm

i.MX7D connect to M4 / A7 - not halted / waiting for GBD connection

Hello again,

after kind of adding information all over the place in my last thread i decided to simply create a new one.

The current state is:
I seem to not be able to connect to the MX7's M4.

I have attached the log files for the following four scenarios:
- connect to the NXP SABRE A7_0
- connect to the NXP SABRE M4
- connect to the CUSTOM BOARD A7_0
- connect to the CUSTOM BOARD M4



On both boards, connecting to the A7 seems to work well.
Connecting to the M4 ends in different error messages for the two boards, but at least on the custom board the M4 is found in the JTAG chain. However, it can not be halted.



I am wondering ... do I need to run the scripts for A7_0, A7_1 and M4 one after another? Or is it okay to run only the M4 script file?
LHE has attached the following files:
  • SABRE_A7_con.txt (13.51 kB - 13 times downloaded - Last download: Yesterday, 11:45am)
  • SABRE_M4_con.txt (8.37 kB - 15 times downloaded - Last download: Yesterday, 11:45am)
  • CUSTOM_A7_con.txt (13.62 kB - 13 times downloaded - Last download: Yesterday, 11:46am)
  • CUSTOM_M4_con.txt (9.15 kB - 14 times downloaded - Last download: Yesterday, 11:46am)

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 699

10

Monday, February 5th 2018, 4:09pm

*This thread has been merged with a previously opened thread for the same topic.*

Hello,

I merged this thread to keep information at one place. Please do not open new threads with the same topic even if it got "messy".
Try to keep information at one place.

Quoted

I am wondering ... do I need to run the scripts for A7_0, A7_1 and M4 one after another? Or is it okay to run only the M4 script file?

You only need to run the M4 Script file to connect to the M4.
Attached is the J-Link Commander output I get with our SABRE board.

Best regards,
Nino
SEGGER - Nino has attached the following image:
  • Capture.PNG

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

11

Tuesday, February 6th 2018, 10:32am

Quoted

Try to keep information at one place.
Understood!

I tried to connect to the board with and without SD card (including uboot/Linux).
With SD card, i cannot connect to the M4 using JLink.exe and JLinkGDBServerCL.exe. Outputs have been attached.

After removing the SD card and doing a power cycle, JLink.exe is able to identify the M4.
JLinkGDBServerCL still comlpains about not being able to halt the CPU. Log file has been attached.

I realized you are using version 6.30, while I am using version 6.22 so I installed v6.30b.
On opening JLink I was asked to update the Emulators firmware. The Firmware update timed out and I am no longer able to connect to the JLink. :|
"Cannot connect to J-Link via USB.
Failed to connect.
Could not establish a connection to the J-Link".

So .. what do I do now?


Happened when opening JFlash.exe. On opening JLink.exe I was asked to update the firmware again, this time the update completed.
I can still not connect to the M4 using the GDBServerCL, as the target CPU cannot be halted.
LHE has attached the following file:
  • CUSTOM_M4_con.txt (9.15 kB - 14 times downloaded - Last download: Yesterday, 11:49am)

This post has been edited 2 times, last edit by "LHE" (Feb 6th 2018, 10:36am)


LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

12

Tuesday, February 6th 2018, 3:30pm

I have found a ressource in the NXP Forum that describes/achieved what I want to do.
After adjusting the startup and debugging options as described I no longer get the previous error when starting a debug session in Eclipse.
Screenshots of the settings are attached.

But I run into a different problem now:

Quoted


Error in services launch sequence
Starting J-Link GDB Server timed out.
I have already adjusted the timeout setting as described here , but no success.
No difference if running Eclipse as an admin. Path to the GBDServerCL is set up correctly/automatically by Eclipse.

Any ideas on what might be missing or setup wrong?
Thanks and regards!
LHE has attached the following images:
  • eclipse_GDBtimeout_DebugSettings.PNG
  • eclipse_GDBtimeout_StartupSettings.PNG
  • JLINK_connect_script_waitingGDB.PNG

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

13

Tuesday, February 6th 2018, 4:42pm

With the script provided in the NXP Forum thread mentioned in my previous post I am able to have the JLinkGDBserver connect to the M4, waiting for the GDB connection.

So I think this part is all good now. I just dont know how to get the GDB connection up.

When I started the JLinkGDBServer through the win command prompt and then start e debug sesion in eclipse, the session is started. But i do not see any debug output. Or any other hint for the system to be alive.

This post has been edited 1 times, last edit by "LHE" (Feb 6th 2018, 4:51pm)


LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

14

Wednesday, February 7th 2018, 9:50am

Alright, some more information:

The debug process did not start because the Eclipse settings pointed to the JLinkRemoteServerCL.exe instead of the JLinkGDBServerCL.exe.
A debug session is now created but i do not see any output.

When switching to the JLink Control Panel - CPU Regs tab and click "read all registers" the following result is shown:



I guess these registers should be initialized by .. probably eclipse, through jlink? Not sure if this being 0 is a result of:
- Jlink misconfiguration
- Eclipse misconfiguration
- Read error

How are these registers usually set up? I assume Eclipse would need to tell the Jlink what these registers should be set to?

This post has been edited 1 times, last edit by "LHE" (Feb 7th 2018, 10:06am)


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 699

15

Wednesday, February 7th 2018, 11:17am

Hello,

What Eclipse IDE are you using currently?
How are you calling the JLinkGDBServer.exe exactly?
I see that you use some modified version of the JLinkScript for the M4 core. Could you attach it? What does it do differently then the one in the J-Link software package?

How to properly set up Eclipse for J-Link is described here: https://www.segger.com/products/debug-pr…y/ides/eclipse/

Make sure that you followed the linked tutorials step by step. Should you configure something differently it might not work.

Please understand that we can't put much time into this as J-Link is connecting correctly to the target with GDBServer and using our other tools. The Eclipse Plugin is not maintained nor supported by us. Please contact the plug in maintainer if the linked setup guide on our website does not work.

Best regards,
Nino

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

16

Wednesday, February 7th 2018, 5:51pm

Quoted

Please understand that we can't put much time into this as J-Link is connecting correctly to the target with GDBServer and using our other tools. The Eclipse Plugin is not maintained nor supported by us. Please contact the plug in maintainer if the linked setup guide on our website does not work.
Ye sure, I am aware of that.
So far, I am not entirely sure if this is an issue that can be resolved on the JLink side or not.
Probably not, but Ill keep posting here until this is resolved for the unlikely case of someone having the same struggles.

The latest problem was that I had not added a linker script file that was provided as part of the board support package in the Eclipse settings under
Project Preferences - C/C++ Build - Settings - GNU ARM Cross C Linker - General - Script files


After adding this, the .elf file grew from 33kB to 2900kB.
I can start a debug session using the "JLinkGSBServer" and "arm-none-eabi-gdb.exe" and through eclipse.


However, there is still one problem:
The CPU cannot be halted properly. It halts just once at startup, but then it does not halt ever again.

Eclipse is setting up a breakpoint at main(), and the console output shows

Quoted


Reading all registers
Setting breakpoint @ address 0x202141A6, Size = 2, BPHandle = 0x0001
Starting target CPU...
Debugger requested to halt target...
WARNING: CPU could not be halted

I assume the debugger halt request is the breakpoint that is hit, but the CPU does not care.
Can the (not) halt behaviour be influenced through the jlink tools? Is this behaviour known for the MX7's M4?
I am not sure if changes onthe jlink side could help with this or not.


I had run into the "CPU could not be halted" problem before, it kept me from starting any debug session until I found the customized script.
it adds a cutom function to reset the target and is attached to this thread: https://community.nxp.com/thread/461296



From the JLinkGDB log file, with the custom script:
T1374 000:250 JLINK_IsHalted() returns FALSE (0002ms, 0248ms total)
T1374 000:252 JLINK_Halt()CPU could not be halted returns 0x01 (0004ms, 0250ms total)
T1374 000:256 JLINK_Reset() J-Link Script File: Executing ResetTarget() ***** Custom ResetTarget called ***** Performing customized ResetType 0 *** -- CPU is running -- CPU_WriteMem(4 bytes @ 0x3039000C) -- CPU is running -- CPU_WriteMem(4 bytes @ 0x00180000) -- CPU is running -- CPU_WriteMem(4 bytes @ 0x00180004) -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE000EDFC) -- CPU is running -- CPU_WriteMem(4 bytes @ 0x3039000C)T-bit of XPSR is 0 but should be 1. Changed to 1.
-- CPU_WriteMem(4 bytes @ 0xE0002000) -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) (0033ms, 0283ms total)

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

17

Friday, February 9th 2018, 10:04am

JLink.exe has an TestHaltGo command.

When connecting to the A7_0 core, 1000 halt/go cycles are done within ~3,5s and no problem occurs.
On trying the same test while connected to the M4 i simply get "WARNING: CPU could not be halted".

I do not know if this is a hardware/layout problem, Jlink problem, silicon problem or setup problem.
(Although i can probably exclude layout problem, as i see the same behaviour on three different hardware platforms, one being the SABRE).

I am absolutely stuck here. Any advice is very welcome.

v01d

Beginner

Date of registration: Feb 29th 2016

Posts: 87

18

Friday, February 9th 2018, 11:20am


On trying the same test while connected to the M4 i simply get "WARNING: CPU could not be halted".

Well helloouu there, friend. :P

Just a quick question: do you know that M4 is enabled & running before you connecting to it and trying to halt?

LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

19

Friday, February 9th 2018, 12:16pm

Hello!

Quoted



Just a quick question: do you know that M4 is enabled & running before you connecting to it and trying to halt?
Well when opening the JLink conrtol panel - CPU Regs - Read all registers (after starting a debug session) the console prints: ERROR: Can not read register 20 (CFBP) while CPU is running

So I guess its running.

This post has been edited 1 times, last edit by "LHE" (Feb 9th 2018, 12:19pm)


LHE

Beginner

Date of registration: Jan 31st 2018

Posts: 18

20

Friday, February 9th 2018, 4:53pm

Interestingly, everything seems to work fine when using GDB command line tools (at least: uploading binarys).

However i cannot really execute them.
Even using the example projects that come with batch files for building (just needed to install MinGW and cmake) I cannot get the CPU running properly.
The program counter seems to always get out of hand and points to some reserved.

By setting manual breakpoints, I can see that the Reset_Handler routine is called, but the CPU never gets to the main thread.

I have tried this using:
* MX7 driver example - UART polling
* GPIO IMX example
* MX7 driver example - UART polling with recreating the project in a custom eclipse environment

They all show the same behaviour.