[Lazarus] How to tell debugger what executable to use ?

Koenraad Lelong lazarus2 at de-brouwerij.be
Wed May 21 18:41:59 CEST 2014


op 21-05-14 15:59, Justin Smyth schreef:
> I can now compile in lazarus , I have openocd working it detects my board.
>
>
> I need to flash the elf file to my board , I have read open ocd can do , and
> I read somewhere GBD can do it too
>
>
> Whats the best way to do this ?
>
>
> Also do I need to have openocd running first then compile my program ? (
> then flash ??)
>
>
> Kind Regards
>
> Justin

Justin,

Compiling and debugging are separate processes. So you can e.g. compile 
somewhere, transfer the elf-file to your debugging station, flash your 
processor and debug. So no, openocd does not need to run to *compile*.

What I do (but hope to do with lazarus) :
Start openocd, it should detect your board. In another terminal-session, 
telnet to localhost port 4444. For my processor (but I think it should 
be for all processors) I do : "reset halt" to stop the processor. Then I 
erase the processor : "stm32f1x mass_erase 0" (that's specific for the 
stm32f1x-processors).
Then I can program : "flash write_image <your project.elf>"
After that you can start the processor : "reset"
Debugging should be done like this : start your arm-none-eabi-gdb. I 
used tui as parameter : TextUserInterface. I have a .gdbinit file in my 
home-directory containing :
"target extended-remote localhost:3333"
This connects gdb to openocd.
Unfortunately, I don't know text-based gdb enough to give more details.

Depending on your processor/debug-interface you could use Insight, 
that's a stand-alone GUI gdb. Unfortunately, I personally can't use it 
anymore because openocd 0.8 changed so gdb 6.8 (Insight's version of 
gdb) can't be used. And I need openocd 0.8 for my processor.
Openocd 0.7 has no problems with Insight though.

HTH.

Koenraad





More information about the Lazarus mailing list