After some weeks of experience with Verdin iMX8M-Mini, I switched to iMX8M-Plus (because this is the best SoM for my project).
With iMX8M-Mini I was able to debug hello_world project wihtout any problem (setting breakpoints, step by step , …)
I configured the Cortex-M development as described here, and it’s basically the same as IMX8M-Mini.
I’m able to build the hello_world example supplied with MCUXpress SDK from NXP and load it using Segger J-Link debug probe and VS Code.
But what I see during the debug is not what I expect.
The first messages from gdb server seems ok to me
SEGGER J-Link GDB Server V7.86f Command Line Version
JLinkARM.dll V7.86f (DLL compiled Mar 29 2023 16:39:17)
Command line: -singlerun -nogui -if jtag -port 50000 -swoport 50001 -telnetport 50002 -device MIMX8ML8_M7 -jlinkscriptfile D:\repos\GAR\ERxx\cortex-m\SDK_2_13_0_MIMX8ML8xxxKZ/tools/iar_segger_support_patch_imx8mp/JLink/Devices/NXP/iMX8ML/NXP_iMX8M_Connect_CortexM7.JLinkScript
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 50000
SWO raw output listening port: 50001
Terminal I/O port: 50002
Accept remote connection: localhost only
Generate logfile: off
Verify download: off
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: D:\repos\GAR\ERxx\cortex-m\SDK_2_13_0_MIMX8ML8xxxKZ/tools/iar_segger_support_patch_imx8mp/JLink/Devices/NXP/iMX8ML/NXP_iMX8M_Connect_CortexM7.JLinkScript
J-Link settings file: none
------Target related settings------
Target device: MIMX8ML8_M7
Target device parameters: none
Target interface: JTAG
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V11 compiled Mar 28 2023 16:59:55
Hardware: V11.00
S/N: 601013959
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 1.80 V
Listening on TCP/IP port 50000
Connecting to target...
J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x5BA00477 (Cortex-M7)
Halting core...
Connected to target
Waiting for GDB connection...Connected to 0000:0000:0000:0000:0000:0000:0000:0001
GDB client (conn. 712) requested target.xml from GDB Server
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x00000000
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x00000000
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x00000000
Read register 'r5' (4 bytes) from hardware: 0x00000000
Read register 'r6' (4 bytes) from hardware: 0x00000000
Read register 'r7' (4 bytes) from hardware: 0x00000000
Read register 'r8' (4 bytes) from hardware: 0x00000000
Read register 'r9' (4 bytes) from hardware: 0x00000000
Read register 'r10' (4 bytes) from hardware: 0x00000000
Read register 'r11' (4 bytes) from hardware: 0x00000000
Read register 'r12' (4 bytes) from hardware: 0x00000000
Read register 'sp' (4 bytes) from hardware: 0x00000220
Read register 'lr' (4 bytes) from hardware: 0xFFFFFFFF
Read register 'pc' (4 bytes) from hardware: 0x08000000
Read register 'xpsr' (4 bytes) from hardware: 0x00000001
WARNING: Failed to read memory @ address 0x00000008
Received monitor command: halt
Halting target CPU...
But then I see
ERROR: Cannot read register 15 (R15) while CPU is running
...Target halted (PC = 0x00000000)
Received monitor command: reset
ERROR: Failed to halt CPU.
Resetting target
Received monitor command: halt
Halting target CPU...
ERROR: Cannot read register 15 (R15) while CPU is running
...Target halted (PC = 0x00000000)
Ant this seems sytrange to me.
The log goes on
Downloading 680 bytes @ address 0x00000000
Downloading 16 bytes @ address 0x00000400
Downloading 16112 bytes @ address 0x00000410
Downloading 1300 bytes @ address 0x00004300
Downloading 8 bytes @ address 0x00004814
Downloading 4 bytes @ address 0x0000481C
Downloading 4 bytes @ address 0x00004820
Downloading 4 bytes @ address 0x00004824
Writing register 'pc' = 0x0000048C
This should be the loading of the firmware, and the setting of PC register.
And I see it writes into the memory region which is the 128kB ITCM for Cortex-M7 (as per Hardware Reference Manual), as specified by the .ld
file used to compile.
Then a lot of errors come out:
Reading 64 bytes @ address 0x00003580
WARNING: Failed to read memory @ address 0x00003590
Reading 64 bytes @ address 0x00002BC0
WARNING: Failed to read memory @ address 0x00002BEC
Reading 64 bytes @ address 0x00000B80
WARNING: Failed to read memory @ address 0x00000B8A
WARNING: Failed to read memory @ address 0x00000B9E
WARNING: Failed to read memory @ address 0x0000048C
WARNING: Failed to read memory @ address 0xFFFFFFFE
Reading 64 bytes @ address 0x2001FFC0
ERROR: Cannot read register 17 (MSP) while CPU is running
Reading register 'msp' = 0xDEADBEEF
ERROR: Cannot read register 18 (PSP) while CPU is running
Reading register 'psp' = 0xDEADBEEF
ERROR: Cannot read register 24 (PRIMASK) while CPU is running
Reading register 'primask' = 0xDEADBEEF
ERROR: Cannot read register 88 (CM3_R??) while CPU is running
Reading register 'basepri' = 0xDEADBEEF
ERROR: Cannot read register 89 (CM3_R??) while CPU is running
Reading register 'faultmask' = 0xDEADBEEF
ERROR: Cannot read register 90 (CM3_R??) while CPU is running
Reading register 'control' = 0xDEADBEEF
ERROR: Cannot read register 21 (APSR) while CPU is running
Reading register 'apsr' = 0xDEADBEEF
ERROR: Cannot read register 22 (EPSR) while CPU is running
Reading register 'epsr' = 0xDEADBEEF
ERROR: Cannot read register 23 (IPSR) while CPU is running
Reading register 'ipsr' = 0xDEADBEEF
ERROR: Cannot read register 29 (IAPSR) while CPU is running
Reading register 'iapsr' = 0xDEADBEEF
ERROR: Cannot read register 30 (EAPSR) while CPU is running
Reading register 'eapsr' = 0xDEADBEEF
ERROR: Cannot read register 31 (IEPSR) while CPU is running
Reading register 'iepsr' = 0xDEADBEEF
ERROR: Cannot read register 32 (FPSCR) while CPU is running
Reading register 'fpscr' = 0xDEADBEEF
ERROR: Cannot read register 33 (FPS0) while CPU is running
Reading register 's0' = 0xDEADBEEF
ERROR: Cannot read register 34 (FPS1) while CPU is running
Reading register 's1' = 0xDEADBEEF
ERROR: Cannot read register 35 (FPS2) while CPU is running
Reading register 's2' = 0xDEADBEEF
ERROR: Cannot read register 36 (FPS3) while CPU is running
Reading register 's3' = 0xDEADBEEF
ERROR: Cannot read register 37 (FPS4) while CPU is running
Reading register 's4' = 0xDEADBEEF
ERROR: Cannot read register 38 (FPS5) while CPU is running
Reading register 's5' = 0xDEADBEEF
ERROR: Cannot read register 39 (FPS6) while CPU is running
Reading register 's6' = 0xDEADBEEF
ERROR: Cannot read register 40 (FPS7) while CPU is running
Reading register 's7' = 0xDEADBEEF
ERROR: Cannot read register 41 (FPS8) while CPU is running
Reading register 's8' = 0xDEADBEEF
ERROR: Cannot read register 42 (FPS9) while CPU is running
Reading register 's9' = 0xDEADBEEF
ERROR: Cannot read register 43 (FPS10) while CPU is running
Reading register 's10' = 0xDEADBEEF
ERROR: Cannot read register 44 (FPS11) while CPU is running
Reading register 's11' = 0xDEADBEEF
ERROR: Cannot read register 45 (FPS12) while CPU is running
Reading register 's12' = 0xDEADBEEF
ERROR: Cannot read register 46 (FPS13) while CPU is running
Reading register 's13' = 0xDEADBEEF
ERROR: Cannot read register 47 (FPS14) while CPU is running
Reading register 's14' = 0xDEADBEEF
ERROR: Cannot read register 48 (FPS15) while CPU is running
Reading register 's15' = 0xDEADBEEF
ERROR: Cannot read register 49 (FPS16) while CPU is running
Reading register 's16' = 0xDEADBEEF
ERROR: Cannot read register 50 (FPS17) while CPU is running
Reading register 's17' = 0xDEADBEEF
ERROR: Cannot read register 51 (FPS18) while CPU is running
Reading register 's18' = 0xDEADBEEF
ERROR: Cannot read register 52 (FPS19) while CPU is running
Reading register 's19' = 0xDEADBEEF
ERROR: Cannot read register 53 (FPS20) while CPU is running
Reading register 's20' = 0xDEADBEEF
ERROR: Cannot read register 54 (FPS21) while CPU is running
Reading register 's21' = 0xDEADBEEF
ERROR: Cannot read register 55 (FPS22) while CPU is running
Reading register 's22' = 0xDEADBEEF
ERROR: Cannot read register 56 (FPS23) while CPU is running
Reading register 's23' = 0xDEADBEEF
ERROR: Cannot read register 57 (FPS24) while CPU is running
Reading register 's24' = 0xDEADBEEF
ERROR: Cannot read register 58 (FPS25) while CPU is running
Reading register 's25' = 0xDEADBEEF
ERROR: Cannot read register 59 (FPS26) while CPU is running
Reading register 's26' = 0xDEADBEEF
ERROR: Cannot read register 60 (FPS27) while CPU is running
Reading register 's27' = 0xDEADBEEF
ERROR: Cannot read register 61 (FPS28) while CPU is running
Reading register 's28' = 0xDEADBEEF
ERROR: Cannot read register 62 (FPS29) while CPU is running
Reading register 's29' = 0xDEADBEEF
ERROR: Cannot read register 63 (FPS30) while CPU is running
Reading register 's30' = 0xDEADBEEF
ERROR: Cannot read register 64 (FPS31) while CPU is running
Reading register 's31' = 0xDEADBEEF
ERROR: Cannot read register 33 (FPS0) while CPU is running
ERROR: Cannot read register 34 (FPS1) while CPU is running
Reading register 'd0' = 0x00000000
ERROR: Cannot read register 35 (FPS2) while CPU is running
ERROR: Cannot read register 36 (FPS3) while CPU is running
Reading register 'd1' = 0x00000000
ERROR: Cannot read register 37 (FPS4) while CPU is running
ERROR: Cannot read register 38 (FPS5) while CPU is running
Reading register 'd2' = 0x00000000
ERROR: Cannot read register 39 (FPS6) while CPU is running
ERROR: Cannot read register 40 (FPS7) while CPU is running
Reading register 'd3' = 0x00000000
ERROR: Cannot read register 41 (FPS8) while CPU is running
ERROR: Cannot read register 42 (FPS9) while CPU is running
Reading register 'd4' = 0x00000000
ERROR: Cannot read register 43 (FPS10) while CPU is running
ERROR: Cannot read register 44 (FPS11) while CPU is running
Reading register 'd5' = 0x00000000
ERROR: Cannot read register 45 (FPS12) while CPU is running
ERROR: Cannot read register 46 (FPS13) while CPU is running
Reading register 'd6' = 0x00000000
ERROR: Cannot read register 47 (FPS14) while CPU is running
ERROR: Cannot read register 48 (FPS15) while CPU is running
Reading register 'd7' = 0x00000000
ERROR: Cannot read register 49 (FPS16) while CPU is running
ERROR: Cannot read register 50 (FPS17) while CPU is running
Reading register 'd8' = 0x00000000
ERROR: Cannot read register 51 (FPS18) while CPU is running
ERROR: Cannot read register 52 (FPS19) while CPU is running
Reading register 'd9' = 0x00000000
ERROR: Cannot read register 53 (FPS20) while CPU is running
ERROR: Cannot read register 54 (FPS21) while CPU is running
Reading register 'd10' = 0x00000000
ERROR: Cannot read register 55 (FPS22) while CPU is running
ERROR: Cannot read register 56 (FPS23) while CPU is running
Reading register 'd11' = 0x00000000
ERROR: Cannot read register 57 (FPS24) while CPU is running
ERROR: Cannot read register 58 (FPS25) while CPU is running
Reading register 'd12' = 0x00000000
ERROR: Cannot read register 59 (FPS26) while CPU is running
ERROR: Cannot read register 60 (FPS27) while CPU is running
Reading register 'd13' = 0x00000000
ERROR: Cannot read register 61 (FPS28) while CPU is running
ERROR: Cannot read register 62 (FPS29) while CPU is running
Reading register 'd14' = 0x00000000
ERROR: Cannot read register 63 (FPS30) while CPU is running
ERROR: Cannot read register 64 (FPS31) while CPU is running
Reading register 'd15' = 0x00000000
WARNING: Failed to read memory @ address 0xFFFFFFFE
WARNING: Failed to read memory @ address 0x00000000
WARNING: Failed to read memory @ address 0x00000004
WARNING: Failed to read memory @ address 0x00000008
WARNING: Failed to read memory @ address 0x0000000C
WARNING: Failed to read memory @ address 0x00000010
WARNING: Failed to read memory @ address 0x00000014
WARNING: Failed to read memory @ address 0x00000018
WARNING: Failed to read memory @ address 0x0000001C
WARNING: Failed to read memory @ address 0x00000020
WARNING: Failed to read memory @ address 0x00000022
WARNING: Failed to read memory @ address 0x00000024
WARNING: Failed to read memory @ address 0x00000028
WARNING: Failed to read memory @ address 0x0000002C
WARNING: Failed to read memory @ address 0x0000002D
At high level, the execution halts (apparently) inside fsl_uart.c
line 1504
I suspect that something is wrong with interrupts or interrupt handlers, because the call stack seems “broken”
and locals windows, more or less the same
Can someone help on what happens?