1

I want to read the content of specific RAM addresses from a microcontroller application via a ST-Link via SWD. For now I do this with command line, but later I want to build a data logger with this.

So first I setup the connection to the target with following command which is working:

openocd -f interface/stlink.cfg -c "transport select hla_swd" -f target/stm32g4x.cfg

The from a new command window I start gdb and connect to the server:

gdb-multiarch
target extended-remote localhost:3333

Then I can successfully read a variable content from a memory address with

p/x *0x20003C48

The problem I have is that as soon as I connect to the target with "target extended-remote" the program execution on the microcontroller stops and I can only read while the controller is in stop.

I found the chapter "20.5 Using GDB as a non-intrusive memory inspector" here. What I understood from this that I have to add the following two lines in stm32g4x.cfg:

$_TARGETNAME configure -event gdb-attach {}
gdb_memory_map disable

and executing following two command before connecting to the target (target extended-remote):

set remote interrupt-on-connect off
set mem inaccessible-by-default off

But the problem is the target is still halted.

OpenOCD server output:

Info : accepting 'gdb' connection on tcp/3333
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x080025be msp: 0x20003a58

Any advise how to connect without halt (attach)?

Thank you in advance!

Martin
  • 11
  • 1

0 Answers0