Hi @Tommy Murphy, 

Thanks a lot. I've read the sections you suggested, and got it working! 
All that needed to be done is modifying the first line in the .gdbinit file: 

target extended-remote | openocd -f ../config/flash_config/openocd_probe.cfg -f 
../config/flash_config/openocd_chip.cfg -s "C:/path/to/scripts" -c "gdb_port 
pipe; log_output openocd.log" 
monitor reset halt 
monitor flash erase_address 0x8000000 0x00200000 
monitor reset halt 
file foobar.elf 
load 
monitor reset run 
monitor shutdown 
quit 

Then I launch GDB in the usual way: 

$ arm-none-eabi-gdb -x ../config/flash_config/.gdbinit 

Huray, it works! Thanks ^_^ 

Kind regards, 
Kristof Mulier 


Van: "Tommy Murphy" <tommy_mur...@hotmail.com> 
Aan: "openocd-devel" <openocd-devel@lists.sourceforge.net>, "kristof mulier" 
<kristof.mul...@telenet.be> 
Verzonden: Maandag 27 juli 2020 11:53:24 
Onderwerp: Re: Launch OpenOCD from GDB in one console 

Have you reviewed section 7.3 of the openocd users guide about using the pipe 
option and section 21.1 about using gdb in this context? 

From: kristof.mul...@telenet.be <kristof.mul...@telenet.be> 
Sent: Monday, July 27, 2020 10:29:10 AM 
To: openocd-devel <openocd-devel@lists.sourceforge.net> 
Subject: [OpenOCD-devel] Launch OpenOCD from GDB in one console 
Dear developers, 

As you might know, I'm working in a startup building a new (free!) 
IDE for microcontrollers: Embeetle IDE. To flash code we generally 
use a combination of OpenOCD and GDB. Both are launched as targets 
from the makefile in two separate consoles. I was wondering if it's 
possible to flash from just one makefile target (in one console). 

Let me first explain the way we do it now. The makefile target 
openocd looks like this: 
.PHONY : openocd 
openocd : $(OUTPUT_FILENAME) .elf 
$(OCD) $(OCDFLAGS) 

with the following flags: 
OCDFLAGS_DASHBOARD = -f ../config/flash_config/openocd_probe.cfg \ 
-f ../config/flash_config/openocd_chip.cfg \ 
-s " $(dir OCD ) ../scripts " \ 
-c " init; reset halt " \ 


Target gdb looks like this: 
.PHONY : gdb 
gdb : $(OUTPUT_FILENAME) .elf 
$(GDB) $(GDBFLAGS) 

With the following flags: 
GDBFLAGS_DASHBOARD = -x ../config/flash_config/.gdbinit \ 

So if the user clicks the flash button, we first launch target openocd 
and then target gdb shortly after. GDB then runs its commands from 
.gdbinit , which actually instructs GDB to connect to OpenOCD and 
initiate the flash: 

# .gdbinit file 
target remote localhost: 3333 
monitor reset halt 
monitor flash erase_address 0x8000000 0x00200000 
monitor reset halt 
file foobar.elf 
load 
monitor reset run 
monitor shutdown 
quit 


Now is there a way to do all this from just one makefile target, and 
therefore also from one console? I heard about the possibility to 
launch OpenOCD from a GDB session, like: 

(gdb) target remote | openocd ... 

I tried it, but the console gets locked and no longer accepts gdb 
commands to be executed. 









_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to