Hi,
I'm trying to use JLink debugging with CLion, so far so good. I managed to connect the GDB Server, flash the device, debug, read registers etc.. wonderfully.
However, when I make a change and want to start debugging again, the JLink flash download erases the flash, but doesn't seem to program the device.
When the flash&erase fails:
Display Spoiler
SEGGER J-Link GDB Server V7.56d GUI Version
JLinkARM.dll V7.56d (DLL compiled Oct 29 2021 14:01:36)
-----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: off
Init regs on start: on
Silent mode: off
Single run mode: off
Target connection timeout: 5000 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: STM32H735VG
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V11 compiled Oct 26 2021 16:23:48
Hardware: V11.00
S/N: redacted
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.38 V
Listening on TCP/IP port 2331
Connecting to target...
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 2 bytes @ address 0x08049BF4 (Data = 0xB508)
Read 4 bytes @ address 0x00000000 (Data = 0xA7D18CB9)
Read 2 bytes @ address 0x00000000 (Data = 0x8CB9)
Downloading 716 bytes @ address 0x08000000
Downloading 16032 bytes @ address 0x080002D0
Downloading 16064 bytes @ address 0x08004170
Downloading 16016 bytes @ address 0x08008030
Downloading 15904 bytes @ address 0x0800BEC0
Downloading 15968 bytes @ address 0x0800FCE0
Downloading 15904 bytes @ address 0x08013B40
Downloading 15920 bytes @ address 0x08017960
Downloading 15968 bytes @ address 0x0801B790
Downloading 15984 bytes @ address 0x0801F5F0
Downloading 16032 bytes @ address 0x08023460
Downloading 16160 bytes @ address 0x08027300
Downloading 16160 bytes @ address 0x0802B220
Downloading 16176 bytes @ address 0x0802F140
Downloading 16192 bytes @ address 0x08033070
Downloading 16080 bytes @ address 0x08036FB0
Downloading 16080 bytes @ address 0x0803AE80
Downloading 16032 bytes @ address 0x0803ED50
Downloading 16080 bytes @ address 0x08042BF0
Downloading 16128 bytes @ address 0x08046AC0
Downloading 7184 bytes @ address 0x0804A9C0
Downloading 16288 bytes @ address 0x0804C5D0
Downloading 16352 bytes @ address 0x08050570
Downloading 16320 bytes @ address 0x08054550
Downloading 16320 bytes @ address 0x08058510
Downloading 16288 bytes @ address 0x0805C4D0
Downloading 16352 bytes @ address 0x08060470
Downloading 10344 bytes @ address 0x08064450
Downloading 8 bytes @ address 0x08066CB8
Downloading 220 bytes @ address 0x08066CC0
Downloading 20 bytes @ address 0x08066D9C
Downloading 228 bytes @ address 0x08066DB0
Writing register (PC = 0x 800e8b4)
Read 2 bytes @ address 0x08049BF4 (Data = 0xB508)
Received monitor command: reset
Resetting target
Starting target CPU...
...Target halted (DBGRQ, PC = 0xFFFFFFFE)
Reading all registers
WARNING: Failed to read memory @ address 0xFFFFFFFE
Read 4 bytes @ address 0x24021A04 (Data = 0x240088C4)
Read 4 bytes @ address 0x2400891C (Data = 0x0000000E)
Read 4 bytes @ address 0x24008924 (Data = 0x00000000)
Read 4 bytes @ address 0x240088C4 (Data = 0x24008874)
Read 4 bytes @ address 0x240088AC (Data = 0x08015ECD)
Read 4 bytes @ address 0x240088F4 (Data = 0x240080C4)
Reading 32 bytes @ address 0x240088F8
Read 4 bytes @ address 0x240088F0 (Data = 0x00000000)
Read 4 bytes @ address 0x240088C4 (Data = 0x24008874)
Read 4 bytes @ address 0x240088EC (Data = 0x00000000)
Read 4 bytes @ address 0x24008918 (Data = 0x240088C0)
Reading 2044 bytes @ address 0x240080C4
Reading 64 bytes @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFFE
Reading 64 bytes @ address 0xFFFFFBC0
WARNING: Failed to read memory @ address 0xFFFFFBC0
WARNING: Failed to read memory @ address 0xFFFFFBFE
WARNING: Failed to read memory @ address 0xFFFFFFF4
Reading 64 bytes @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFF0
Reading 64 bytes @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFF0
GDB ends with the following output:
For reference, the diff between a success and a failure log is the following:
Display Spoiler
Display All
Running the program again makes it all work correctly where the old code is overwritten and it flashes happily.
My question then is, is it possible to force JLinkGDBServerCL to erase the storage? And if not, how could I fix this?
For completeness, the GDB server args I'm passing are:
I'm trying to use JLink debugging with CLion, so far so good. I managed to connect the GDB Server, flash the device, debug, read registers etc.. wonderfully.
However, when I make a change and want to start debugging again, the JLink flash download erases the flash, but doesn't seem to program the device.
When the flash&erase fails:
SEGGER J-Link GDB Server V7.56d GUI Version
JLinkARM.dll V7.56d (DLL compiled Oct 29 2021 14:01:36)
-----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: off
Init regs on start: on
Silent mode: off
Single run mode: off
Target connection timeout: 5000 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: STM32H735VG
Target interface: SWD
Target interface speed: 4000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V11 compiled Oct 26 2021 16:23:48
Hardware: V11.00
S/N: redacted
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 3.38 V
Listening on TCP/IP port 2331
Connecting to target...
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 2 bytes @ address 0x08049BF4 (Data = 0xB508)
Read 4 bytes @ address 0x00000000 (Data = 0xA7D18CB9)
Read 2 bytes @ address 0x00000000 (Data = 0x8CB9)
Downloading 716 bytes @ address 0x08000000
Downloading 16032 bytes @ address 0x080002D0
Downloading 16064 bytes @ address 0x08004170
Downloading 16016 bytes @ address 0x08008030
Downloading 15904 bytes @ address 0x0800BEC0
Downloading 15968 bytes @ address 0x0800FCE0
Downloading 15904 bytes @ address 0x08013B40
Downloading 15920 bytes @ address 0x08017960
Downloading 15968 bytes @ address 0x0801B790
Downloading 15984 bytes @ address 0x0801F5F0
Downloading 16032 bytes @ address 0x08023460
Downloading 16160 bytes @ address 0x08027300
Downloading 16160 bytes @ address 0x0802B220
Downloading 16176 bytes @ address 0x0802F140
Downloading 16192 bytes @ address 0x08033070
Downloading 16080 bytes @ address 0x08036FB0
Downloading 16080 bytes @ address 0x0803AE80
Downloading 16032 bytes @ address 0x0803ED50
Downloading 16080 bytes @ address 0x08042BF0
Downloading 16128 bytes @ address 0x08046AC0
Downloading 7184 bytes @ address 0x0804A9C0
Downloading 16288 bytes @ address 0x0804C5D0
Downloading 16352 bytes @ address 0x08050570
Downloading 16320 bytes @ address 0x08054550
Downloading 16320 bytes @ address 0x08058510
Downloading 16288 bytes @ address 0x0805C4D0
Downloading 16352 bytes @ address 0x08060470
Downloading 10344 bytes @ address 0x08064450
Downloading 8 bytes @ address 0x08066CB8
Downloading 220 bytes @ address 0x08066CC0
Downloading 20 bytes @ address 0x08066D9C
Downloading 228 bytes @ address 0x08066DB0
Writing register (PC = 0x 800e8b4)
Read 2 bytes @ address 0x08049BF4 (Data = 0xB508)
Received monitor command: reset
Resetting target
Starting target CPU...
...Target halted (DBGRQ, PC = 0xFFFFFFFE)
Reading all registers
WARNING: Failed to read memory @ address 0xFFFFFFFE
Read 4 bytes @ address 0x24021A04 (Data = 0x240088C4)
Read 4 bytes @ address 0x2400891C (Data = 0x0000000E)
Read 4 bytes @ address 0x24008924 (Data = 0x00000000)
Read 4 bytes @ address 0x240088C4 (Data = 0x24008874)
Read 4 bytes @ address 0x240088AC (Data = 0x08015ECD)
Read 4 bytes @ address 0x240088F4 (Data = 0x240080C4)
Reading 32 bytes @ address 0x240088F8
Read 4 bytes @ address 0x240088F0 (Data = 0x00000000)
Read 4 bytes @ address 0x240088C4 (Data = 0x24008874)
Read 4 bytes @ address 0x240088EC (Data = 0x00000000)
Read 4 bytes @ address 0x24008918 (Data = 0x240088C0)
Reading 2044 bytes @ address 0x240080C4
Reading 64 bytes @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFFE
Reading 64 bytes @ address 0xFFFFFBC0
WARNING: Failed to read memory @ address 0xFFFFFBC0
WARNING: Failed to read memory @ address 0xFFFFFBFE
WARNING: Failed to read memory @ address 0xFFFFFFF4
Reading 64 bytes @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFF0
Reading 64 bytes @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFC0
WARNING: Failed to read memory @ address 0xFFFFFFF0
GDB ends with the following output:
For reference, the diff between a success and a failure log is the following:
Difference-File
- diff --git a/logs b/logs-failed
- index aa40178..663a02a 100644
- --- a/logs
- +++ b/logs-failed
- @@ -82,4 +82,32 @@ Writing register (PC = 0x 800e8b4)
- Read 2 bytes @ address 0x08049BF4 (Data = 0xB508)
- Received monitor command: reset
- Resetting target
- -Starting target CPU...
- \ No newline at end of file
- +Starting target CPU...
- +...Target halted (DBGRQ, PC = 0xFFFFFFFE)
- +Reading all registers
- +WARNING: Failed to read memory @ address 0xFFFFFFFE
- +Read 4 bytes @ address 0x24021A04 (Data = 0x240088C4)
- +Read 4 bytes @ address 0x2400891C (Data = 0x0000000E)
- +Read 4 bytes @ address 0x24008924 (Data = 0x00000000)
- +Read 4 bytes @ address 0x240088C4 (Data = 0x24008874)
- +Read 4 bytes @ address 0x240088AC (Data = 0x08015ECD)
- +Read 4 bytes @ address 0x240088F4 (Data = 0x240080C4)
- +Reading 32 bytes @ address 0x240088F8
- +Read 4 bytes @ address 0x240088F0 (Data = 0x00000000)
- +Read 4 bytes @ address 0x240088C4 (Data = 0x24008874)
- +Read 4 bytes @ address 0x240088EC (Data = 0x00000000)
- +Read 4 bytes @ address 0x24008918 (Data = 0x240088C0)
- +Reading 2044 bytes @ address 0x240080C4
- +Reading 64 bytes @ address 0xFFFFFFC0
- +WARNING: Failed to read memory @ address 0xFFFFFFC0
- +WARNING: Failed to read memory @ address 0xFFFFFFFE
- +Reading 64 bytes @ address 0xFFFFFBC0
- +WARNING: Failed to read memory @ address 0xFFFFFBC0
- +WARNING: Failed to read memory @ address 0xFFFFFBFE
- +WARNING: Failed to read memory @ address 0xFFFFFFF4
- +Reading 64 bytes @ address 0xFFFFFFC0
- +WARNING: Failed to read memory @ address 0xFFFFFFC0
- +WARNING: Failed to read memory @ address 0xFFFFFFF0
- +Reading 64 bytes @ address 0xFFFFFFC0
- +WARNING: Failed to read memory @ address 0xFFFFFFC0
- +WARNING: Failed to read memory @ address 0xFFFFFFF0
- \ No newline at end of file
Running the program again makes it all work correctly where the old code is overwritten and it flashes happily.
My question then is, is it possible to force JLinkGDBServerCL to erase the storage? And if not, how could I fix this?
For completeness, the GDB server args I'm passing are: