Debugging Issues with J-Link and MCUxpresso 11.4.1 and 11.5.0

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

Debugging Issues with J-Link and MCUxpresso 11.4.1 and 11.5.0

7,408 Views
CraigCo
Contributor III

First, thank you so much for your patience and for reading my post. It is long. I've tried to be both thorough and concise.

Summary:

Debugging is very unstable using Segger J-Link Plus with MCUxpresso 11.4.1 and MCUxpresso 11.5.0. Using the debugger through MCUxpresso appears to attach and download but I cannot debug. The exact behavior varies. I’ve tried everything and I have workarounds that intermittently work. Details including debugger console output are below.

Version 11.2.1 was stable for me but my project requires upgrading to 11.4.1.

I am using a mature custom board using an imxrt1060. The debugging interface is SWD. I’ve been able to reproduce several of these issues on an evk with sdk examples. I have made a support ticket and one of my issues (unable to “Restart”) was able to be reproduced but I have many more.

SDK version is 2.8.6. I also tried 2.11 with MCUx 11.5.0

Details:

Behavior observed:

  • Debug RAM config
    • First breakpoint appears to be the hardfault handler. Pressing play halts at the same line. console output below. Look for WARNING: Failed to read memory @ address 0x10D7263A
    • No start breakpoint hit. Pausing shows the PC is in bootrom (0x200000 range). I know the boot mode is set correctly and can prove it if you aren't satisfied. Using serial download mode to erase/program does not fix it.
    • Gets to main but when I step even once it doesn't hit the next line/instruction it just appears to be running. When I press pause it has been in bootrom or flash and I want to say even RAM instructions but I cannot debug.
    • Works after multiple attempts - hit debug and PC is in bootrom, stop and re-debug and I get the hardfault issue, trying a third time gets to main and I can debug
    • Does not work with the "Reset before running" box checked in the “J-Link Debugger” tab of the debug configuration. I believe this option is supposed to be ignored for RAM configurations.
    • Runs to main. Press run and pause work debugging appears normal for a very brief time, then pausing moments later shows the PC in bootrom
  • Debug Flash config
    • Goes to main. Stepping does not hit the next line. Hitting pause shows the PC at flash memory locations (call stack will show 0x60000000 addresses) but no link to code. If I make an "attach only" configuration I can debug the application normally but only after power cycling the board
    • Latest behavior is that I cannot attach to it and after restarting / power cycling the board the program does not print anything to the console.
  • Debug RAM or Flash
    • Debugger "halts" at 0xdeadbeee. Pressing run goes to main and then I can debug normally (this also happens in MCUxpresso 11.2.1)
    • Using my work arounds and finally being able to debug - cannot restart a debug session with the Restart button. Hitting restart appears to do nothing only that the program is "running" because the pause and stop buttons are active and the play button is grey. Hitting pause usually shows the PC at the same location repeatedly.

What I have tried:

  • I've tried deleting and recreating debug configurations every way I know how: Quickstart > Debug, right click project > Debug As and using the debug configuration to add a configuration
  • Monitor sleep 500 command
  • Deleting the “monitor reset” command in J-Link debug config settings
  • Verified the JLink is working using Segger's utilities such as J-FLash and J-Commander
  • Using JFlash, erased flash and verified all 0xff's, then try to debug. Doesn't help
  • Use the MCUBootUtility to erase/program the board. Programming and erasing works but debugging has the same issues.
  • Ensure SEMC SDRAM is being initialized correctly
    • Used different versions of evkmimxrt1060_sdram_init.jlinkscript
    • Debugging a RAM config with an evk program in flash. Sometimes this has worked possibly from the DCD header being run before I can debug. Debugging still unstable.
  • Different Segger driver versions with varying levels of failures/successes, all unstable
    • 6.86 (version I have been using for months successfully with MCUx 11.2.1). I’m currently using this one as it seems to be the most successful
    • 6.98
    • 7.54 (comes with MCUx 11.4.1)
    • 7.60b (comes with MCUx 11.5.0)
    • 7.62a
  • J-Link Plus hardware versions 10 and 11.
  • I have uninstalled all (8?) versions of MCUxpresso (including deleting any eclipse cache folders) and JLink software and tried fresh installs of MCUx 11.4.1 and MCUx 11.5.0. Restart my computer. Use fresh workspace with only sdk examples and evk board. Unstable debugging still.
  • Co-worker trying on their machine. They experienced the same variety of issues.
  • Different boards – no change
  • Other J-Link's – no change
  • Updating the firmware on my J-Links of course – no change
  • Unplugging and plugging debugger back in
  • Power cycling the target

Console output when it starts at hardfault:

[08-4-2022 02:11:04] Executing Server: "C:\Program Files (x86)\SEGGER\JLink_V686\JLinkGDBServerCL.exe" -nosilent -swoport 2332 -select USB=851003997 -jlinkscriptfile C:\fwtemp\ThirdPartyLibraries\MQX\mqx\source\bsp\imxrt1062_fbd\gcc_mcux\evkmimxrt1060_sdram_init.jlinkscript -telnetport 2333 -singlerun -endian little -noir -speed auto   -port 2331    -vd -device MIMXRT1062xxx5A -if SWD -halt -reportuseraction
SEGGER J-Link GDB Server V6.86 Command Line Version

JLinkARM.dll V6.86 (DLL compiled Sep 24 2020 17:31:31)

Command line: -nosilent -swoport 2332 -select USB=851003997 -jlinkscriptfile C:\fwtemp\ThirdPartyLibraries\MQX\mqx\source\bsp\imxrt1062_fbd\gcc_mcux\evkmimxrt1060_sdram_init.jlinkscript -telnetport 2333 -singlerun -endian little -noir -speed auto -port 2331 -vd -device MIMXRT1062xxx5A -if SWD -halt -reportuseraction
-----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:            off
Silent mode:                   off
Single run mode:               on
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 C:\fwtemp\ThirdPartyLibraries\MQX\mqx\source\bsp\imxrt1062_fbd\gcc_mcux\evkmimxrt1060_sdram_init.jlinkscript
J-Link settings file:          none
------Target related settings------
Target device:                 MIMXRT1062xxx5A
Target interface:              SWD
Target interface speed:        auto
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Device "MIMXRT1062XXX5A" selected.
Firmware: J-Link V11 compiled Dec  9 2021 14:14:49
Hardware: V11.00
S/N: 851003997
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.36 V
Listening on TCP/IP port 2331
Connecting to target...
ConfigTargetSettings() start
Config JTAG Speed not changed
ConfigTargetSettings() end
InitTarget() start
InitTarget()
_TargetHalt: CPU halted
InitTarget() end
Found SW-DP with ID 0x0BD11477
DPIDR: 0x0BD11477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x04770041)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FD000
CPUID register: 0x411FC271. Implementer code: 0x41 (ARM)
Found Cortex-M7 r1p1, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ E00FD000
ROMTbl[0][0]: E00FE000, CID: B105100D, PID: 000BB4C8 ROM Table
ROMTbl[1] @ E00FE000
ROMTbl[1][0]: E00FF000, CID: B105100D, PID: 000BB4C7 ROM Table
ROMTbl[2] @ E00FF000
ROMTbl[2][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[2][1]: E0001000, CID: B105E00D, PID: 000BB002 DWT
ROMTbl[2][2]: E0002000, CID: B105E00D, PID: 000BB00E FPB-M7
ROMTbl[2][3]: E0000000, CID: B105E00D, PID: 000BB001 ITM
ROMTbl[1][1]: E0041000, CID: B105900D, PID: 001BB975 ETM-M7
ROMTbl[1][2]: E0042000, CID: B105900D, PID: 004BB906 CTI
ROMTbl[0][1]: E0040000, CID: B105900D, PID: 000BB9A9 TPIU-M7
ROMTbl[0][2]: E0043000, CID: B105F00D, PID: 001BB101 TSG
Cache: Separate I- and D-cache.

I-Cache L1: 32 KB, 512 Sets, 32 Bytes/Line, 2-Way
D-Cache L1: 32 KB, 256 Sets, 32 Bytes/Line, 4-Way
SetupTarget() start
Enabling i.MXRT SDRAM
DCDC trim value loaded.
Clock Init Done
SDRAM Init Done
SetupTarget() end
ConfigTargetSettings() start
Config JTAG Speed not changed
ConfigTargetSettings() end
InitTarget() start
InitTarget()
_TargetHalt: CPU halted
InitTarget() end
Found SW-DP with ID 0x0BD11477
DPIDR: 0x0BD11477
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FD000
CPUID register: 0x411FC271. Implementer code: 0x41 (ARM)
Found Cortex-M7 r1p1, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ E00FD000
ROMTbl[0][0]: E00FE000, CID: B105100D, PID: 000BB4C8 ROM Table
ROMTbl[1] @ E00FE000
ROMTbl[1][0]: E00FF000, CID: B105100D, PID: 000BB4C7 ROM Table
ROMTbl[2] @ E00FF000
ROMTbl[2][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[2][1]: E0001000, CID: B105E00D, PID: 000BB002 DWT
ROMTbl[2][2]: E0002000, CID: B105E00D, PID: 000BB00E FPB-M7
ROMTbl[2][3]: E0000000, CID: B105E00D, PID: 000BB001 ITM
ROMTbl[1][1]: E0041000, CID: B105900D, PID: 001BB975 ETM-M7
ROMTbl[1][2]: E0042000, CID: B105900D, PID: 004BB906 CTI
ROMTbl[0][1]: E0040000, CID: B105900D, PID: 000BB9A9 TPIU-M7
ROMTbl[0][2]: E0043000, CID: B105F00D, PID: 001BB101 TSG
Cache: Separate I- and D-cache.

I-Cache L1: 32 KB, 512 Sets, 32 Bytes/Line, 2-Way
D-Cache L1: 32 KB, 256 Sets, 32 Bytes/Line, 4-Way
SetupTarget() start
Enabling i.MXRT SDRAM
DCDC trim value loaded.
Clock Init Done
SDRAM Init Done
SetupTarget() end
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x80018CD6 (Data = 0x3328F8D3)
Read 4 bytes @ address 0x80015FB8 (Data = 0xB084B580)
Reading 64 bytes @ address 0x8007AFC0
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x80018CD6 (Data = 0x3328F8D3)
Read 4 bytes @ address 0x80015FB8 (Data = 0xB084B580)
Reading 64 bytes @ address 0x8007AFC0
Downloading 16128 bytes @ address 0x80000000 - Verified OK
Downloading 15984 bytes @ address 0x80003F00 - Verified OK
Downloading 16080 bytes @ address 0x80007D70 - Verified OK
Downloading 16080 bytes @ address 0x8000BC40 - Verified OK
Downloading 16064 bytes @ address 0x8000FB10 - Verified OK
Downloading 15936 bytes @ address 0x800139D0 - Verified OK
Downloading 16016 bytes @ address 0x80017810 - Verified OK
Downloading 16064 bytes @ address 0x8001B6A0 - Verified OK
Downloading 16160 bytes @ address 0x8001F560 - Verified OK
Downloading 16192 bytes @ address 0x80023480 - Verified OK
Downloading 16144 bytes @ address 0x800273C0 - Verified OK
Downloading 16128 bytes @ address 0x8002B2D0 - Verified OK
Downloading 16064 bytes @ address 0x8002F1D0 - Verified OK
Downloading 16096 bytes @ address 0x80033090 - Verified OK
Downloading 16080 bytes @ address 0x80036F70 - Verified OK
Downloading 16048 bytes @ address 0x8003AE40 - Verified OK
Downloading 16032 bytes @ address 0x8003ECF0 - Verified OK
Downloading 16048 bytes @ address 0x80042B90 - Verified OK
Downloading 16128 bytes @ address 0x80046A40 - Verified OK
Downloading 16080 bytes @ address 0x8004A940 - Verified OK
Downloading 16112 bytes @ address 0x8004E810 - Verified OK
Downloading 16176 bytes @ address 0x80052700 - Verified OK
Downloading 16144 bytes @ address 0x80056630 - Verified OK
Downloading 16128 bytes @ address 0x8005A540 - Verified OK
Downloading 16064 bytes @ address 0x8005E440 - Verified OK
Downloading 16016 bytes @ address 0x80062300 - Verified OK
Downloading 16096 bytes @ address 0x80066190 - Verified OK
Downloading 16192 bytes @ address 0x8006A070 - Verified OK
Downloading 16336 bytes @ address 0x8006DFB0 - Verified OK
Downloading 16320 bytes @ address 0x80071F80 - Verified OK
Downloading 7212 bytes @ address 0x80075F40 - Verified OK
Downloading 4 bytes @ address 0x80077B6C - Verified OK
Downloading 4 bytes @ address 0x80077B70 - Verified OK
Downloading 3116 bytes @ address 0x80077B78 - Verified OK
Writing register (PC = 0x8000031c)
Read 4 bytes @ address 0x8000031C (Data = 0xB672B510)
Reading all registers
Read 4 bytes @ address 0x8000031C (Data = 0xB672B510)
Reading 64 bytes @ address 0x80004E00
Read 2 bytes @ address 0x80004E0E (Data = 0xF042)
Received monitor command: semihosting enable
Semi-hosting enabled (Handle on BKPT)
Received monitor command: exec SetRestartOnClose=1
Executed SetRestartOnClose=1
Setting breakpoint @ address 0x80004E0E, Size = 2, BPHandle = 0x0001
Starting target CPU...
Debugger requested to halt target...
...Target halted (PC = 0x800003AA)
Reading all registers
Removing breakpoint @ address 0x80004E0E, Size = 2
Read 4 bytes @ address 0x800003AA (Data = 0xE7FEE7FE)
Read 4 bytes @ address 0xE00FD000 (Data = 0x00001003)
Read 4 bytes @ address 0xE00FEFF4 (Data = 0x00000010)
Read 4 bytes @ address 0xE00FD004 (Data = 0xFFF43003)
Read 4 bytes @ address 0xE0040FF4 (Data = 0x00000090)
Read 4 bytes @ address 0xE00FD008 (Data = 0xFFF46003)
Reading register (MSP = 0x2001C7A0)
Read 4 bytes @ address 0xE0043FF4 (Data = 0x000000F0)
Read 4 bytes @ address 0xE00FD00C (Data = 0x1FF03002)
Read 4 bytes @ address 0x2001C7BC (Data = 0x8100008A)
Reading 64 bytes @ address 0x2001C780
WARNING: Failed to read memory @ address 0x10D7263A
Read 4 bytes @ address 0x800005BA (Data = 0xBC08B672)
Reading 64 bytes @ address 0x80000580
Read 4 bytes @ address 0x800005BA (Data = 0xBC08B672)
Read 4 bytes @ address 0x2001C7A0 (Data = 0x0000008A)
Read 4 bytes @ address 0xE00FD010 (Data = 0x00000000)
Read 4 bytes @ address 0x2001C7A4 (Data = 0xBF082E8E)
Read 4 bytes @ address 0xE00FE000 (Data = 0x00001003)
Read 4 bytes @ address 0xE0040FE0 (Data = 0x000000A9)
Read 4 bytes @ address 0xE0040FE4 (Data = 0x000000B9)
Read 4 bytes @ address 0xE0040FE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE0040FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0040FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0040FBC (Data = 0x00000000)
Read 4 bytes @ address 0xE0040FCC (Data = 0x00000011)
Read 4 bytes @ address 0x2001C7A8 (Data = 0x10D7263B)
Read 4 bytes @ address 0xE00FFFF4 (Data = 0x00000010)
Read 4 bytes @ address 0xE00FE004 (Data = 0xFFF43003)
Read 4 bytes @ address 0x2001C7AC (Data = 0xFFFFFFFF)
Read 4 bytes @ address 0xE0041FF4 (Data = 0x00000090)
Read 4 bytes @ address 0xE00FE008 (Data = 0xFFF44003)
Read 4 bytes @ address 0x2001C7B0 (Data = 0x00000000)
Read 4 bytes @ address 0xE0042FF4 (Data = 0x00000090)
Read 4 bytes @ address 0xE00FE00C (Data = 0x1FF02002)
Read 4 bytes @ address 0x2001C7B4 (Data = 0x800005BB)
Read 4 bytes @ address 0xE00FE010 (Data = 0x00000000)
Read 4 bytes @ address 0x2001C7B8 (Data = 0x10D7263A)
Read 4 bytes @ address 0xE00FF000 (Data = 0xFFF0F003)
Read 4 bytes @ address 0xE0041FE0 (Data = 0x00000075)
Read 4 bytes @ address 0xE0041FE4 (Data = 0x000000B9)
Read 4 bytes @ address 0xE0041FE8 (Data = 0x0000001B)
Read 4 bytes @ address 0xE0041FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0041FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0041FBC (Data = 0x47704A13)
Read 4 bytes @ address 0xE0041FCC (Data = 0x00000013)
Read 4 bytes @ address 0xE0042FE0 (Data = 0x00000006)
Read 4 bytes @ address 0xE0042FE4 (Data = 0x000000B9)
Read 4 bytes @ address 0xE0042FE8 (Data = 0x0000004B)
Read 4 bytes @ address 0xE0042FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0042FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0042FBC (Data = 0x00000000)
Read 4 bytes @ address 0xE0042FCC (Data = 0x00000014)
Read 4 bytes @ address 0x2001C7BC (Data = 0x8100008A)
Read 4 bytes @ address 0xE000EFF4 (Data = 0x000000E0)
Read 4 bytes @ address 0xE00FF004 (Data = 0xFFF02003)
Reading 64 bytes @ address 0x10D72600
WARNING: Failed to read memory @ address 0x10D72600
WARNING: Failed to read memory @ address 0x10D7263A
Reading 64 bytes @ address 0x800005C0
Reading 64 bytes @ address 0x80000600
Read 4 bytes @ address 0xE000ED28 (Data = 0x00000100)
Read 4 bytes @ address 0xE0001FF4 (Data = 0x000000E0)
Read 4 bytes @ address 0xE00FF008 (Data = 0xFFF03003)
Read 1 bytes @ address 0xE000ED28 (Data = 0x00)
Read 4 bytes @ address 0xE0002FF4 (Data = 0x000000E0)
Read 4 bytes @ address 0xE00FF00C (Data = 0xFFF01003)
Read 1 bytes @ address 0xE000ED29 (Data = 0x01)
Read 4 bytes @ address 0xE0000FF4 (Data = 0x000000E0)
Read 4 bytes @ address 0xE00FF010 (Data = 0xFFF41002)
Read 2 bytes @ address 0xE000ED2A (Data = 0x0000)
Read 4 bytes @ address 0xE00FF014 (Data = 0xFFF42002)
Read 4 bytes @ address 0xE000ED2C (Data = 0x40000000)
Read 4 bytes @ address 0xE00FF018 (Data = 0x00000000)
Read 4 bytes @ address 0xE000ED30 (Data = 0x00000001)
Read 4 bytes @ address 0xE000EFE0 (Data = 0x0000000C)
Read 4 bytes @ address 0xE000EFE4 (Data = 0x000000B0)
Read 4 bytes @ address 0xE000EFE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE000EFEC (Data = 0x00000000)
Read 4 bytes @ address 0xE000EFD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0001FE0 (Data = 0x00000002)
Read 4 bytes @ address 0xE0001FE4 (Data = 0x000000B0)
Read 4 bytes @ address 0xE0001FE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE0001FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0001FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0002FE0 (Data = 0x0000000E)
Read 4 bytes @ address 0xE0002FE4 (Data = 0x000000B0)
Read 4 bytes @ address 0xE0002FE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE0002FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0002FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0000FE0 (Data = 0x00000001)
Read 4 bytes @ address 0xE0000FE4 (Data = 0x000000B0)
Read 4 bytes @ address 0xE0000FE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE0000FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0000FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE000ED34 (Data = 0x00000000)
Read 4 bytes @ address 0xE000ED38 (Data = 0x00000000)
Read 4 bytes @ address 0xE000EFA8 (Data = 0x00000000)

Console output when debugging and it suddenly goes to bootrom:

Debugger requested to halt target...
...Target halted (PC = 0x800162F8)
Reading all registers
Read 4 bytes @ address 0x800162F8 (Data = 0x6B737461)
Read 4 bytes @ address 0x80014392 (Data = 0x74616B73)
Reading 64 bytes @ address 0x2001C700
Reading 64 bytes @ address 0x2001C780
Read 4 bytes @ address 0x800162F8 (Data = 0x6B737461)
Read 4 bytes @ address 0x80014392 (Data = 0x74616B73)
Read 4 bytes @ address 0x80004E84 (Data = 0x6B737461)
Reading 64 bytes @ address 0x2001C740
Reading register (MSP = 0x2001C730)
Read 4 bytes @ address 0x2001C730 (Data = 0x6FF8513C)
Read 4 bytes @ address 0x2001C734 (Data = 0x8164A21F)
Read 4 bytes @ address 0x2001C738 (Data = 0x2001C748)
Read 4 bytes @ address 0x2001C73C (Data = 0x2001C748)
Read 4 bytes @ address 0x2001C740 (Data = 0x00000000)
Read 4 bytes @ address 0x2001C744 (Data = 0x401F81CC)
Read 4 bytes @ address 0x2001C748 (Data = 0x2001C758)
Read 4 bytes @ address 0x2001C74C (Data = 0x8006DB74)
Reading 64 bytes @ address 0x401F81C0
Reading 64 bytes @ address 0x401F8200
Read 4 bytes @ address 0xE000ED28 (Data = 0x00000500)
Read 1 bytes @ address 0xE000ED28 (Data = 0x00)
Read 1 bytes @ address 0xE000ED29 (Data = 0x05)
Read 2 bytes @ address 0xE000ED2A (Data = 0x0000)
Read 4 bytes @ address 0xE000ED2C (Data = 0x40000000)
Read 4 bytes @ address 0xE000ED30 (Data = 0x00000001)
Read 4 bytes @ address 0xE000ED34 (Data = 0x00000000)
Read 4 bytes @ address 0xE000ED38 (Data = 0x00000000)
Read 4 bytes @ address 0xE000EFA8 (Data = 0x00000208)
Starting target CPU...
ERROR: Cannot read register 15 (R15) while CPU is running
Reading all registers
ERROR: Cannot read register 0 (R0) while CPU is running
ERROR: Cannot read register 1 (R1) while CPU is running
...
ERROR: Cannot read register 64 (FPS31) while CPU is running
WARNING: Failed to read memory @ address 0xDEADBEEE
WARNING: Failed to read memory @ address 0xDEADBEEE
ERROR: Cannot read register 18 (PSP) while CPU is running
Reading register (PSP = 0xDEADBEEF)
WARNING: Failed to read memory @ address 0xDEADBEEE
Starting target CPU...
Debugger requested to halt target...
...Target halted (PC = 0x0020D108)
Reading all registers
Read 4 bytes @ address 0x0020D108 (Data = 0x203CF647)
Read 2 bytes @ address 0x0020D108 (Data = 0xF647)
Read 4 bytes @ address 0x0020D108 (Data = 0x203CF647)
Read 2 bytes @ address 0x0020D108 (Data = 0xF647)
Read 4 bytes @ address 0x0020ED48 (Data = 0x28007F20)
Read 2 bytes @ address 0x0020ED48 (Data = 0x7F20)
Read 4 bytes @ address 0x0020ED48 (Data = 0x28007F20)
Read 2 bytes @ address 0x0020ED48 (Data = 0x7F20)

 Console output when it shows 0xdeadbeee in callstack and pressing play gets to main okay and debugging works:

[08-4-2022 03:15:06] Executing Server: "C:\Program Files (x86)\SEGGER\JLink_V686\JLinkGDBServerCL.exe" -nosilent -swoport 2332 -select USB=851003997  -telnetport 2333 -singlerun -endian little -ir -speed auto   -port 2331    -vd -device MIMXRT1062xxx5A -if SWD -halt -reportuseraction
SEGGER J-Link GDB Server V6.86 Command Line Version

JLinkARM.dll V6.86 (DLL compiled Sep 24 2020 17:31:31)

Command line: -nosilent -swoport 2332 -select USB=851003997 -telnetport 2333 -singlerun -endian little -ir -speed auto -port 2331 -vd -device MIMXRT1062xxx5A -if SWD -halt -reportuseraction
-----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:                 MIMXRT1062xxx5A
Target interface:              SWD
Target interface speed:        auto
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Device "MIMXRT1062XXX5A" selected.
Firmware: J-Link V11 compiled Dec  9 2021 14:14:49
Hardware: V11.00
S/N: 851003997
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.35 V
Listening on TCP/IP port 2331
Connecting to target...
InitTarget() start
InitTarget()
_TargetHalt: CPU halted
InitTarget() end
Found SW-DP with ID 0x0BD11477
DPIDR: 0x0BD11477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x04770041)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FD000
CPUID register: 0x411FC271. Implementer code: 0x41 (ARM)
Found Cortex-M7 r1p1, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ E00FD000
ROMTbl[0][0]: E00FE000, CID: B105100D, PID: 000BB4C8 ROM Table
ROMTbl[1] @ E00FE000
ROMTbl[1][0]: E00FF000, CID: B105100D, PID: 000BB4C7 ROM Table
ROMTbl[2] @ E00FF000
ROMTbl[2][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[2][1]: E0001000, CID: B105E00D, PID: 000BB002 DWT
ROMTbl[2][2]: E0002000, CID: B105E00D, PID: 000BB00E FPB-M7
ROMTbl[2][3]: E0000000, CID: B105E00D, PID: 000BB001 ITM
ROMTbl[1][1]: E0041000, CID: B105900D, PID: 001BB975 ETM-M7
ROMTbl[1][2]: E0042000, CID: B105900D, PID: 004BB906 CTI
ROMTbl[0][1]: E0040000, CID: B105900D, PID: 000BB9A9 TPIU-M7
ROMTbl[0][2]: E0043000, CID: B105F00D, PID: 001BB101 TSG
Cache: Separate I- and D-cache.

I-Cache L1: 32 KB, 512 Sets, 32 Bytes/Line, 2-Way
D-Cache L1: 32 KB, 256 Sets, 32 Bytes/Line, 4-Way
InitTarget() start
InitTarget()
_TargetHalt: CPU halted
InitTarget() end
Found SW-DP with ID 0x0BD11477
DPIDR: 0x0BD11477
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FD000
CPUID register: 0x411FC271. Implementer code: 0x41 (ARM)
Found Cortex-M7 r1p1, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ E00FD000
ROMTbl[0][0]: E00FE000, CID: B105100D, PID: 000BB4C8 ROM Table
ROMTbl[1] @ E00FE000
ROMTbl[1][0]: E00FF000, CID: B105100D, PID: 000BB4C7 ROM Table
ROMTbl[2] @ E00FF000
ROMTbl[2][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[2][1]: E0001000, CID: B105E00D, PID: 000BB002 DWT
ROMTbl[2][2]: E0002000, CID: B105E00D, PID: 000BB00E FPB-M7
ROMTbl[2][3]: E0000000, CID: B105E00D, PID: 000BB001 ITM
ROMTbl[1][1]: E0041000, CID: B105900D, PID: 001BB975 ETM-M7
ROMTbl[1][2]: E0042000, CID: B105900D, PID: 004BB906 CTI
ROMTbl[0][1]: E0040000, CID: B105900D, PID: 000BB9A9 TPIU-M7
ROMTbl[0][2]: E0043000, CID: B105F00D, PID: 001BB101 TSG
Cache: Separate I- and D-cache.

I-Cache L1: 32 KB, 512 Sets, 32 Bytes/Line, 2-Way
D-Cache L1: 32 KB, 256 Sets, 32 Bytes/Line, 4-Way
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00000000 (Data = 0x1853A3BE)
Read 2 bytes @ address 0x00000000 (Data = 0xA3BE)
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x00000000 (Data = 0x1853A3BE)
Read 2 bytes @ address 0x00000000 (Data = 0xA3BE)
Received monitor command: reset
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Resetting target
Downloading 8192 bytes @ address 0x60000000 - Verified OK
Downloading 16112 bytes @ address 0x60002000 - Verified OK
Downloading 16032 bytes @ address 0x60005EF0 - Verified OK
Downloading 16112 bytes @ address 0x60009D90 - Verified OK
Downloading 16048 bytes @ address 0x6000DC80 - Verified OK
Downloading 16032 bytes @ address 0x60011B30 - Verified OK
Downloading 9244 bytes @ address 0x600159D0 - Verified OK
Downloading 8 bytes @ address 0x60017DEC - Verified OK
Downloading 2632 bytes @ address 0x60017DF4 - Verified OK
J-Link: Flash download: Bank 0 @ 0x60000000: 1 range affected (131072 bytes)
J-Link: Flash download: Total: 2.191s (Prepare: 0.459s, Compare: 0.129s, Erase: 0.000s, Program & Verify: 1.599s, Restore: 0.004s)
J-Link: Flash download: Program & Verify speed: 79 KB/s
Writing register (PC = 0x6000231c)
Read 4 bytes @ address 0x6000231C (Data = 0xB672B510)
Reading all registers
Read 4 bytes @ address 0x6000231C (Data = 0xB672B510)
Reading 64 bytes @ address 0x6000E580
Read 2 bytes @ address 0x6000E588 (Data = 0xF007)
Received monitor command: exec SetRestartOnClose=1
Executed SetRestartOnClose=1
Setting breakpoint @ address 0x6000E588, Size = 2, BPHandle = 0x0001
Starting target CPU...
ERROR: Cannot read register 15 (R15) while CPU is running
Reading all registers
ERROR: Cannot read register 0 (R0) while CPU is running
ERROR: Cannot read register 1 (R1) while CPU is running
ERROR: Cannot read register 2 (R2) while CPU is running
ERROR: Cannot read register 3 (R3) while CPU is running
ERROR: Cannot read register 4 (R4) while CPU is running
ERROR: Cannot read register 5 (R5) while CPU is running
ERROR: Cannot read register 6 (R6) while CPU is running
ERROR: Cannot read register 7 (R7) while CPU is running
ERROR: Cannot read register 8 (R8) while CPU is running
ERROR: Cannot read register 9 (R9) while CPU is running
ERROR: Cannot read register 10 (R10) while CPU is running
ERROR: Cannot read register 11 (R11) while CPU is running
ERROR: Cannot read register 12 (R12) while CPU is running
ERROR: Cannot read register 13 (R13) while CPU is running
ERROR: Cannot read register 14 (R14) while CPU is running
ERROR: Cannot read register 15 (R15) while CPU is running
ERROR: Cannot read register 16 (XPSR) while CPU is running
ERROR: Cannot read register 17 (MSP) while CPU is running
ERROR: Cannot read register 18 (PSP) while CPU is running
ERROR: Cannot read register 24 (PRIMASK) while CPU is running
ERROR: Cannot read register 25 (BASEPRI) while CPU is running
ERROR: Cannot read register 26 (FAULTMASK) while CPU is running
Removing breakpoint @ address 0x6000E588, Size = 2
WARNING: Failed to read memory @ address 0xDEADBEEE
Read 4 bytes @ address 0xE00FD000 (Data = 0x00001003)
WARNING: Failed to read memory @ address 0xDEADBEEE
Read 4 bytes @ address 0xE00FEFF4 (Data = 0x00000010)
Read 4 bytes @ address 0xE00FD004 (Data = 0xFFF43003)
Read 4 bytes @ address 0xE0040FF4 (Data = 0x00000090)
Read 4 bytes @ address 0xE00FD008 (Data = 0xFFF46003)
Reading register (PSP = 0x2001FFF0)
Read 4 bytes @ address 0xE0043FF4 (Data = 0x000000F0)
Read 4 bytes @ address 0xE00FD00C (Data = 0x1FF03002)
Read 4 bytes @ address 0xE00FD010 (Data = 0x00000000)
Read 4 bytes @ address 0xE00FE000 (Data = 0x00001003)
Read 4 bytes @ address 0xE0040FE0 (Data = 0x000000A9)
Read 4 bytes @ address 0xE0040FE4 (Data = 0x000000B9)
Read 4 bytes @ address 0xE0040FE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE0040FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0040FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0040FBC (Data = 0x00000000)
Read 4 bytes @ address 0xE0040FCC (Data = 0x00000011)
Read 4 bytes @ address 0xE00FFFF4 (Data = 0x00000010)
Read 4 bytes @ address 0xE00FE004 (Data = 0xFFF43003)
Read 4 bytes @ address 0xE0041FF4 (Data = 0x00000090)
Read 4 bytes @ address 0xE00FE008 (Data = 0xFFF44003)
Read 4 bytes @ address 0xE0042FF4 (Data = 0x00000090)
Read 4 bytes @ address 0xE00FE00C (Data = 0x1FF02002)
Read 4 bytes @ address 0xE00FE010 (Data = 0x00000000)
Read 4 bytes @ address 0xE00FF000 (Data = 0xFFF0F003)
Read 4 bytes @ address 0xE0041FE0 (Data = 0x00000075)
Read 4 bytes @ address 0xE0041FE4 (Data = 0x000000B9)
Read 4 bytes @ address 0xE0041FE8 (Data = 0x0000001B)
Read 4 bytes @ address 0xE0041FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0041FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0041FBC (Data = 0x47704A13)
Read 4 bytes @ address 0xE0041FCC (Data = 0x00000013)
Read 4 bytes @ address 0xE0042FE0 (Data = 0x00000006)
Read 4 bytes @ address 0xE0042FE4 (Data = 0x000000B9)
Read 4 bytes @ address 0xE0042FE8 (Data = 0x0000004B)
Read 4 bytes @ address 0xE0042FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0042FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0042FBC (Data = 0x00000000)
Read 4 bytes @ address 0xE0042FCC (Data = 0x00000014)
Read 4 bytes @ address 0xE000EFF4 (Data = 0x000000E0)
Read 4 bytes @ address 0xE00FF004 (Data = 0xFFF02003)
Read 4 bytes @ address 0xE0001FF4 (Data = 0x000000E0)
Read 4 bytes @ address 0xE00FF008 (Data = 0xFFF03003)
Read 4 bytes @ address 0xE0002FF4 (Data = 0x000000E0)
Read 4 bytes @ address 0xE00FF00C (Data = 0xFFF01003)
Read 4 bytes @ address 0xE0000FF4 (Data = 0x000000E0)
Read 4 bytes @ address 0xE00FF010 (Data = 0xFFF41002)
Read 4 bytes @ address 0xE00FF014 (Data = 0xFFF42002)
Read 4 bytes @ address 0xE00FF018 (Data = 0x00000000)
Read 4 bytes @ address 0xE000EFE0 (Data = 0x0000000C)
Read 4 bytes @ address 0xE000EFE4 (Data = 0x000000B0)
Read 4 bytes @ address 0xE000EFE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE000EFEC (Data = 0x00000000)
Read 4 bytes @ address 0xE000EFD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0001FE0 (Data = 0x00000002)
Read 4 bytes @ address 0xE0001FE4 (Data = 0x000000B0)
Read 4 bytes @ address 0xE0001FE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE0001FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0001FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0002FE0 (Data = 0x0000000E)
Read 4 bytes @ address 0xE0002FE4 (Data = 0x000000B0)
Read 4 bytes @ address 0xE0002FE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE0002FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0002FD0 (Data = 0x00000004)
Read 4 bytes @ address 0xE0000FE0 (Data = 0x00000001)
Read 4 bytes @ address 0xE0000FE4 (Data = 0x000000B0)
Read 4 bytes @ address 0xE0000FE8 (Data = 0x0000000B)
Read 4 bytes @ address 0xE0000FEC (Data = 0x00000000)
Read 4 bytes @ address 0xE0000FD0 (Data = 0x00000004)
Setting breakpoint @ address 0x6000E588, Size = 2, BPHandle = 0x0002
Starting target CPU...
...Breakpoint reached @ address 0x6000E588
Reading all registers
Removing breakpoint @ address 0x6000E588, Size = 2
Read 4 bytes @ address 0x6000E588 (Data = 0xFB2FF007)
Reading 64 bytes @ address 0x2001FFC0
Performing single step...
...Breakpoint reached @ address 0x60015BEA
Reading all registers
Read 4 bytes @ address 0x60015BEA (Data = 0xAF00B580)
Read 4 bytes @ address 0x6000E58C (Data = 0xFBFCF000)
Reading 64 bytes @ address 0x2001FFC0
Read 2 bytes @ address 0x6000E58C (Data = 0xF000)
Setting breakpoint @ address 0x6000E58C, Size = 2, BPHandle = 0x0003
Starting target CPU...
...Breakpoint reached @ address 0x6000E58C
Reading all registers
Read 4 bytes @ address 0x6000E58C (Data = 0xFBFCF000)
Reading 64 bytes @ address 0x2001FFC0
Removing breakpoint @ address 0x6000E58C, Size = 2
Read 4 bytes @ address 0x6000E58C (Data = 0xFBFCF000)

 

0 Kudos
13 Replies

7,270 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @CraigCo ,

     Our IDE expert also tested the MIMXRT1060-EVK with the external JLINK pro, he can't reproduce the issues.

    The attached is the log from our IDE expert.

     So, could you please make your project which can reproduce the issues on the MIMXRT1060-EVK board?

provide the issue project, issue debug log to me, then I can send to our expert, and test your project on our side with external JLINK.

    Our expert is using:

  1. Board: MIMXRT1060-EVK (SCH-31357 Rev A1)
  2. Debug Probe: External J-Link Pro (V4.4) with V7.62c firmware
  3. Connections:

               a. J-Link Pro connected to J21

               b. Board powered using J9

               c.Isolation jumpers disconnected J47, J48, J49, J50

               d. Boot config set to QSPI flash (SW7 configuration 0,0,1,0)

              e. J1 on position 3-4

 

      4. OS used: macOS 12.3.1 and Windows 10

      5. IDE: MCUXpresso IDE 11.5.0 official release

 

Best Regards,

Kerry

 

   

0 Kudos

7,259 Views
CraigCo
Contributor III

I made a small project from my flash project that reproduces the flash debugging issue on the EVK. It is attached along with the debug console.

When I hit main and step once, I loose the debug session. When I hit pause it is at a flash address as described previously. This can be seen in the log at this line:

Halting target CPU...
...Target halted (PC = 0x610FA140)

I then restart and am able to single step correctly.

I am using 

  1. Board: MIMXRT1060-EVK (SCH-31357 Rev A2)
  2. Debug Probe: External J-Link Plus (V11.00) with V7.60b firmware
  3. Connections:

               a. J-Link Plus connected to J21

               b. Board powered using J41 (usb cmsis dap)

               c. Isolation jumpers disconnected J47, J48, J49, J50

               d. Boot config set to QSPI flash (SW7 configuration 0,0,1,0)

              e. J1 on position 5-6

      4. OS used: Windows 10

      5. IDE: MCUXpresso IDE 11.5.0 official release

 

I also learned that both hello_world and iled_blinky debug with a ram configuration on my target normally but not with flash.

I believe I am also having a caching issue that I'll try to describe in more detail in a separate reply.

0 Kudos

7,253 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @CraigCo ,

    To be honest, I am a little lost and confusing about your issues, I even don't very clear about your detailed situation now.

1. Previously, you mentioned EVK can run with the led_blinky and hello_world, but here can't work with flash again.  Which detail issues newest? Still stop and not stay in the flash and report the error windows?

Our AE and the IDE expert all can make it works, and I also attached the related log previously.

2. About your project attached which can reproduce the issues, which detail issues? As I checked the log, when stop, the code still stop in the flash, not other area. Any error windows report? or can't continue debug?

Can you give a screen operation .mp4 that can indicate the issues? Then I can talk with our IDE side clearly.

Please give me the .mp4 which records issues for both the EVK with the sdk hello_world and your own project.

BTW, the old case 00454442 will be closed, any issues, we can talk here in the community, more easy to check the whole picture and logs.

Thanks a lot for your understanding.

Best Regards,

Kerry

 

 

 

 

 

 

   

0 Kudos

7,228 Views
CraigCo
Contributor III

To be honest, I am a little lost and confusing about your issues, I even don't very clear about your detailed situation now.

So am I @kerryzhou. So am I. I'm sorry for the confusion. Sometimes everything is working for brief moments and then suddenly it is not. I think I have more than one issue and so it is hard to keep things straight. This morning I am able to reliably reproduce one of my issues which is the flash issue I was describing. I have a video file attached as requested. This was also what the previous project I attached was doing in my last reply.

Project: evkmimxrt1060_hello_world

SDK: 2.11

MCUxpresso: 11.5.0

J-Link Plus v11.00

This issue does not exist when I use the CMSIS-DAP on the evk board.

Issue: runs to main, single step appears to run, not to go to the next line. Pausing shows the PC at some random flash location with no link to code. Attempting to single step produces this error:

CraigCo_0-1650381635206.png

The Restart debug button works as it goes back to main. Now debugging works normally.

If I don't use the restart button and just try to terminate and debug the same issue persists. Restarting is required to debug successfully in this case.

If I rebuild with cache disabled the issue is the same.

If I link to RAM it debugs normally in this case.

If I erase flash then re-debug the debugger shows 0xdeadbeee. I press run and it goes to main. Debugging works normally after this (video attached). Re-debugging again reproduces the same flash issue as before, have to restart to debug. 

 

0 Kudos

7,167 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @CraigCo ,

   The video tested code evkmimxrt1060_hello_world is from the SDK code, right?

   Our IDE expert already tested your customer code, this is the related information:

-----------------------------------------------------------------------------

We also did some further testing and observed that in the client’s application, there seems to be a problem inside the startup code at the .bss initialization:

-at the first debug attempt with break at ResetISR, we noticed that in bss_init the value for “start” and “len” are wrong.

kerryzhou_0-1650506363024.png

 

 

-after restarting the debug session(using restart button) everything looks fine

kerryzhou_1-1650506365030.png

 

 

Looks like a problem after initial application is downloaded in flash(J-Link or project configuration problem). Since the projects from SDK are working fine, please advise the client to try to make a diff between his application and an SDK one (like iled_blinky).

-----------------------------------------------------------------------------

To the SDK code, our expert tested for several times on the MIMXRT1060-EVK board and the external JLINK plus, didn't meet the issues.

So, can you do the MIMXRT1060-EVK board flash mass erase at first, then test the SDK code, whether still like the .mp4 issues? Just let it reproduce with the NXP EVK board and SDK code, then it will be useful to our internal side.

Please help to confirm your attached .mp4 already the NXP EVK+SDK demo+external JLINK.

 

Best Regards,

Kerry

0 Kudos

7,158 Views
CraigCo
Contributor III

 

Thanks again @kerryzhou for the prompt response.

The video tested code evkmimxrt1060_hello_world is from the SDK code, right?

...

Please help to confirm your attached .mp4 already the NXP EVK+SDK demo+external JLINK.

Yes the .mp4 from my last response was the 2.11 SDK code running on the MIMXRT1060-EVK with an external JLINK Plus v2.11.

So, can you do the MIMXRT1060-EVK board flash mass erase at first, then test the SDK code, whether still like the .mp4 issues? Just let it reproduce with the NXP EVK board and SDK code, then it will be useful to our internal side.

Yes I did this and here is what I said:

If I erase flash then re-debug the debugger shows 0xdeadbeee. I press run and it goes to main. Debugging works normally after this (video attached). Re-debugging again reproduces the same flash issue as before, have to restart to debug.

So erasing and reprogramming I got 0xdeadbeee and then normal debugging. However the very next time I try to debug I get the same issue as in the .mp4 with the SDK code on the MIMXRT1060-EVK using the external JLink.

Regarding the IDE expert's comments:

-at the first debug attempt with break at ResetISR, we noticed that in bss_init the value for “start” and “len” are wrong.

I had not noticed this yet so I will look into it thanks. These are just based on linker symbols and SDK code so I don't know why it would be incorrect one time and restarting would fix it. Perhaps it is bad data cache? The MPU hasn't been setup by this point as that happens in main() at BOARD_ConfigMPU() but SCB_EnableDCache() would have been called inside the CMSIS's SystemInit() assuming cache has not been disabled in the build. 

Looks like a problem after initial application is downloaded in flash(J-Link or project configuration problem). Since the projects from SDK are working fine, please advise the client to try to make a diff between his application and an SDK one (like iled_blinky).

Well the SDK project isn't working fine for me but I appreciate the feedback. The invalid bss initialization values are interesting and I'll try to see what I can find regarding this.

0 Kudos

7,142 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @CraigCo ,

   I get the new information from our expert:

since the debug session works for the “restart scenario”, there seems to be a problem related to initialization / reset / timings because the problem occurs when the debug session is terminated and restarted.

An idea would be to try to debug the startup code using “Instruction” stepping  and looking at data_init and bss_init.

 

kerryzhou_0-1650592305401.png

 

 

kerryzhou_1-1650592305446.png

 

 

Another idea would be to try with different SWD wire speeds.

Can you try these on your side with the EVK+SDK code, as now, no one from our side can reproduce the issues, seems your side is not stable, use slow SWD speed, check whether it has any difference or not?

 

Best Regards,

Kerry

 

0 Kudos

7,369 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @CraigCo ,

    Thanks for your detail information, and effort.

   I already contact with our IDE expert now, and some colleague who can test MIMXRT1060-EVK with external Segger JLINK plus.

   Now, to keep the same platform and code, could you please use the NXP MIMXRT1060-EVK board test with external Segger JLINK again?

  MCUXpresso 11.5.0

  SDK_2_11_1_EVK-MIMXRT1060

  Import hello_world project and led_blinky project. Test hello_world at first, as the led_blinky led connect to the JTAG_TDI, which may have influence.

  1. Board settings: remove on board jumper: J47-J50.

kerryzhou_0-1649737456179.png

  2. MIMXRT1060-EVK board do the mass erase at first.

    You can enter the serial download mode, then use the MCUBootUtility tool to erase it.

kerryzhou_1-1649737726226.png

Just make sure the external memory is clean.

  3.  close the MCUXpresso IDE , open it with the new workspace, import the helloworld at first from SDK2.11.0 for RT1060-EVK.

   Debug it directly.

   Then share the related:

  1) debug result, include the breakpoint, reset button.

  2) JLINK debug configuration

kerryzhou_2-1649737873907.png

to helloworld, it contains the JLINKSCRIPT for SDRAM

kerryzhou_3-1649737917976.png

3) whole debug log

This afternoon, my colleague will share his testing result based on MIMXRT1060-EVK+external Segger JLINK, and he already can debug it now. the same above software and hardware.

And our IDE expert is also checking this post about your issues. 

Thanks a lot for your patient and understanding.

 

Best Regards,

Kerry

 

 

 

0 Kudos

7,344 Views
CraigCo
Contributor III

@kerryzhou , I followed your instructions and I was able to debug both ram and flash configs using the hello_world sdk 2.11 example on both the evk with no issues at all. All debug functions worked that I tried including the restart button.

I've been using a flash program of mine that hasn't change at all in terms of code/project files for months to do sanity checks. I tried it again in this same workspace and got the same flash debugging issues I mentioned in my original post. I compared debug configurations with the hello_world. I made sure to use the same 2.11 sdk jlinkscript and it did not change, still the same behavior.

So this is good news, but also infuriating because I thought I've tried this exactly before. Mostly I was using MCUxpresso 11.4.1 so maybe one of the issues was fixed.

Still having the same debug issues with my projects for some reason. The flash project especially doesn't make sense since it had no changes. I start debug, gets to main, step and it doesn't hit the next line. Pressing pause shows it in flash somewhere. Restart doesn't work. Clicking terminate and re-debugging a second time works normally. still same RAM debug issues. 

0 Kudos

7,340 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @CraigCo ,

  It's really good news, as previously, I misunderstand you, both the EVK and the custom board even can't work with hello_world with external Segger JLINK.

  Could you please also help to test this code:  sdk led_blinky, whether it works? As this led pin is the JTAG_TDI, it may influence the external JLINK. But my colleague also can make it work. Just confirm it on your side with IDE 11.5.0.

  Please also help to check your own project, do you have control the JTAG related pins?

  Can you reproduce the issues on the MIMXRT1060-EVK +external Segger JLINK with your own project in MCUXpresso 11.5.0?

   If yes, you can send us your project, we can also help to check it. As we don't have your customer board, then we can use the MIMXRT1060-EVK to reproduce the issues and keep the same test platform.

This is the IDE expert comment for you after checking your original question:

  • It seems a lot of scenarios revolve around the use of SDRAM. Being board memory external to the MCU, this RAM block must be initialised before it can be used. An XIP Flash header contains the DCD data for the BootROM to use to initialize this RAM memory. Alternatively the project specifies a debug jlink script that initializes this SDRAM.

Make sure the SDRAM initialization sequence in the script is correct (matches the intialization via DCD). Otherwise, it may explain why it works in one case and doesn't work in the other case

  • Check if the debug stability problems are related to caching: SDRAM (being board memory) can be cached. Debugging code in cacheable memories can be problematic if the cache coherence is not properly maintained by the debugger probe. Verify if enabling/disabling caches affects the stability.
  • The PDF guide for using RT1064 with MCUXIDE mentioned above includes a warning against placing the stack in uncached region at the end of SDRAM. Check if this might be the case. https://community.nxp.com/t5/Blogs/Overview-of-using-the-MIMXRT1060-4-EVK-with-MCUXpresso-IDE/ba-p/1... 

So, I think you can check, try disable the cache in your own project, whether has any improvement or not?

Best Regards,

Kerry

 

0 Kudos

7,186 Views
CraigCo
Contributor III

@kerryzhou ,

Can you please let me know what the proper method is for disabling cache?

I have been trying to use some variation of disabling through the CMSIS api, mainly defining __DCACHE_PRESENT and __ICACHE_PRESENT both to zero.

Should I be using the MPU settings in BOARD_ConfigMPU() to make each memory section non-cacheable?

Or is there another preferred way?

0 Kudos

7,328 Views
CraigCo
Contributor III

@kerryzhou ,

Thanks for the response. 

I tried to disable caching and it did not fix the issue (details below). I also tried my old jlinkscript that has been working vs the sdk 2.11 one.

I will work more on validating the SDRAM setup in the jlinkscript is correct for my board but I have had this working and even old projects with the same DCD header are giving me issues.

For my board I only have the SWD signals connected:

CraigCo_0-1649887905966.png

"both the EVK and the custom board even can't work with hello_world with external Segger JLINK."

Regarding your comments, you understood me correctly before. That was true yesterday. I'm going to try to give you a picture of what this issue has been like because whatever is causing this issue feels very random. Something like the SDRAM setup or caching does feel like it is on the right track.

Today, this morning the hello world sdk example worked on both my target and the evk. I tried the iled_blinky example. It failed to debug on both the evk and my board. I saw something I've never seen before even with all the issues I've had. I got the following message: 

CraigCo_0-1649882614427.png

I found for some reason the wrong JFlash was being called, it was the JFlash-SPI. After fixing that issue this error when away.

I can still debug on the evk. In fact this afternoon I can now debug normally hello_world and also iled_blinky on the evk. I can no longer debug either successfully on my board. This afternoon on my board I only get bootrom, it never loads to main. It is not in serial download mode. I do not have my jumpers on for this and MCUBootUtility does not find it because it is not in serial download mode. But still when I debug hello_world, which was working yesterday and this morning, this afternoon I get no load to main and when I pause the PC is always in bootrom. This was all with the flash configuration. I was able to link hello_world to ram and was able to debug normally first try no issues and restart even works. This may be different when I try tomorrow.

I diff'd the jlinkscripts from the new SDK vs the one I have been using and there are a lot of differences actually. I tried my old script with a new project on the evk and got some issues. These issues may shed more light on what has been happening. They appear to be fixed by using the 2.11 jlinkscript, at least this afternoon that is what happened. The debug view shows the PC at address 0xdeadbeee. pressing run did not go to main and the application appeared to just be running (common issue I've seen). Then I paused and it stopped at a line of code. Stepping worked. Running and pausing worked. Terminating and debugging again did not load to main, pressing pause did not appear to respond. Pressing terminate did not respond. I looked in the task manager and expanded MCUXpresso's task and there were 2 sub-tasks named arm-none-eabi-gdb.exe. I clicked "End Task" for both of these. The debugging in MCUxpresso then closed and I was able to retry to debug again. This time it ran to main and I was able to step through lines no problem, use breakpoints. HOWEVER! Then I tried to use the Restart button and it did not work. Pausing no longer worked. Terminating no longer worked. 

Retried to debug later and it loaded to ResetISR. Pressed play, debugger appeared unresponsive then got the following message:

CraigCo_1-1649886479292.png

CraigCo_2-1649886530496.png

And then noticed the debugger was at my breakpoint at SystemInit in ResetISR. Tried to step and debugger was unresponsive and attempting to "pause" did not work. Pressing terminate was slow to respond but eventually terminated the debug session. This was with the cache disabled (see below on how), using the sdk 2.11 jlinkscript on the evk.

On disabling cache:

The way I disabled cache was putting an #if 0  block around the contents of SCB_EnableDCache and SCB_EnableICache. I defined DATA_IS_CACHEABLE to 0. I also added some explicit disable cache calls in SystemInit. I don't know if there is a better way such as in the jlinkscript. This did not change the behavior so I undid these changes. 

 

 

 

 

 

/**
  \brief   Enable D-Cache
  \details Turns on D-Cache
  */
__STATIC_FORCEINLINE void SCB_EnableDCache (void)
{
#if 0
  #if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
    uint32_t ccsidr;
    uint32_t sets;
    uint32_t ways;

    if (SCB->CCR & SCB_CCR_DC_Msk) return;  /* return if DCache is already enabled */

    SCB->CSSELR = 0U;                       /* select Level 1 data cache */
    __DSB();

    ccsidr = SCB->CCSIDR;

                                            /* invalidate D-Cache */
    sets = (uint32_t)(CCSIDR_SETS(ccsidr));
    do {
      ways = (uint32_t)(CCSIDR_WAYS(ccsidr));
      do {
        SCB->DCISW = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) |
                      ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk)  );
        #if defined ( __CC_ARM )
          __schedule_barrier();
        #endif
      } while (ways-- != 0U);
    } while(sets-- != 0U);
    __DSB();

    SCB->CCR |=  (uint32_t)SCB_CCR_DC_Msk;  /* enable D-Cache */

    __DSB();
    __ISB();
  #endif
#endif
}

 

 

 

 

 

 

 

 

 

 

 

__STATIC_FORCEINLINE void SCB_EnableICache (void)
{
#if 0
  #if defined (__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
    if (SCB->CCR & SCB_CCR_IC_Msk) return;  /* return if ICache is already enabled */

    __DSB();
    __ISB();
    SCB->ICIALLU = 0UL;                     /* invalidate I-Cache */
    __DSB();
    __ISB();
    SCB->CCR |=  (uint32_t)SCB_CCR_IC_Msk;  /* enable I-Cache */
    __DSB();
    __ISB();
  #endif
#endif
}

 

 

 

 

 

 

 

 

 

 

 

void SystemInit (void) {
  SCB_DisableICache();
  SCB_DisableDCache();
...
}

 

 

 

 

 

 

0 Kudos

7,322 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @CraigCo ,

   Really so long reply, thanks for your effort.

  Please help to check my understanding is correct on your situation or not?

1. MIMXRT1060-EVK, both the sdk led_blinky and hello world works OK.

2. Customer board, no one works, stop in ROM, right?

3. Disable cache, no improvement. Do you test it on the SDK or the customer code?

   Board is EVK or customer board?

4. Now, even switch back to your old MCUXPresso 11.2.1, still can't work with old JLINK driver and old project?

5. Issue feels very random, even with EVK and SDK code, sometimes work, sometimes not with MCUXPresso 11.5.0, right?

 

-------------------------

Do you have any way to reproduce the issues on EVK with the specific project, even your customer project, you can delete the important code to you, just leave the code which can reproduce the issues on EVK and customer board.

Our side, just can test EVK.

 

To you customer board can't test the SDK code again, you can use this code, run in RAM:

SDK_2_11_1_EVK-MIMXRT1060\boards\evkmimxrt1060\driver_examples\flexspi\nor\polling_transfer

Change the erase location from 0X60000000, this also can realize the mass erase.

After erase the external flash, your customer board should can works again.

Any updated information, kindly let me know.

Best Regards,

Kerry

0 Kudos