Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-05

How to tell debugger what executable to use ?

10 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

Hi,

I'm trying to use lazarus as a debugging-frontend for arm-embedded. I managed to configure lazarus to compile my source into arm-embedded-code for the STM32F103-processor.
My next step is to configure lazarus to debug the code. When I do nothing, the debugger complains that project1 does not exist (used path is OK), which is true because that file really does not exist and should not exist. It's an *elf-file* (extension : .elf) that should be used.
If I use gdb-cli I also have to use the elf-file. So how do I tell lazarus to use that elf-file ?
I configured lazarus to use arm-none-eabi-gdb as debugger, connect to localhost, port 3333. Which is the port openocd uses to let the debugger have control.

I'm using lazarus 1.2.2, and fpc svn 27738 as arm-embedded-compiler. On a linux-machine.

P.S. is there a way to send "monitor" commands to the debugger ? That way I could program my chip.

Thanks,

Koenraad..

Reply by email

Justin Smyth
to Koenraad Lelong

I'd like to know more , I am doing the same thing but from windows for a NXP LPC 1343 board.

I have recently got FPC 2.6.4 svn -27804 running on Lazarus 1.3 win32 i386 Trunk ( SVN 45035 )

I don't see this version having much debugging for embedded arm plus for my chipset I am missing the -w switch I need to pass to ppcrossarm.exe ( I have to tell lazarus on win32)

The chipset I am using is - LPC1343FBD48

I have to pass this to fpc / ppcrossarm

-Parm -Tembedded -WpLPC1343FBD48 -Cparmv7m <myprogram.pp>

Do you have any clues on how to set up lazarus to pass in the -w command to the compiler ?

Kind Regards

Justin

Earlier message 32 lines
-----Original Message----- From: Koenraad Lelong [mailto:] Sent: Wednesday, 21 May 2014 8:22 PM To: Lazarus mailing Subject: [Lazarus] How to tell debugger what executable to use ? Hi, I'm trying to use lazarus as a debugging-frontend for arm-embedded. I managed to configure lazarus to compile my source into arm-embedded-code for the STM32F103-processor. My next step is to configure lazarus to debug the code. When I do nothing, the debugger complains that project1 does not exist (used path is OK), which is true because that file really does not exist and should not exist. It's an *elf-file* (extension : .elf) that should be used. If I use gdb-cli I also have to use the elf-file. So how do I tell lazarus to use that elf-file ? I configured lazarus to use arm-none-eabi-gdb as debugger, connect to localhost, port 3333. Which is the port openocd uses to let the debugger have control. I'm using lazarus 1.2.2, and fpc svn 27738 as arm-embedded-compiler. On a linux-machine. P.S. is there a way to send "monitor" commands to the debugger ? That way I could program my chip. Thanks, Koenraad.. --

Reply by email

Michael Ring
to Justin Smyth

Project->Compiler Options->other

You can add those settings in Custom options control

Target Os (embedded) and Target CPU family can be set in Project->Compiler Options->Config and Target

The compiler can be set in

Project->Compiler Options->Compiler Commands, in Compiler Command edit field

Use the Test button to see if all is complete.

Unfortunaltely the debugger cannot be set on project level, you need to set it in

Tools->Options->Debugger

and set it back when you want to debug a windows project.

Justin Smyth wrote 72 lines
I'd like to know more , I am doing the same thing but from windows for a NXP LPC 1343 board. I have recently got FPC 2.6.4 svn -27804 running on Lazarus 1.3 win32 i386 Trunk ( SVN 45035 ) I don't see this version having much debugging for embedded arm plus for my chipset I am missing the -w switch I need to pass to ppcrossarm.exe ( I have to tell lazarus on win32) The chipset I am using is - LPC1343FBD48 I have to pass this to fpc / ppcrossarm -Parm -Tembedded -WpLPC1343FBD48 -Cparmv7m <myprogram.pp> Do you have any clues on how to set up lazarus to pass in the -w command to the compiler ? Kind Regards Justin -----Original Message----- From: Koenraad Lelong [mailto:] Sent: Wednesday, 21 May 2014 8:22 PM To: Lazarus mailing Subject: [Lazarus] How to tell debugger what executable to use ? Hi, I'm trying to use lazarus as a debugging-frontend for arm-embedded. I managed to configure lazarus to compile my source into arm-embedded-code for the STM32F103-processor. My next step is to configure lazarus to debug the code. When I do nothing, the debugger complains that project1 does not exist (used path is OK), which is true because that file really does not exist and should not exist. It's an *elf-file* (extension : .elf) that should be used. If I use gdb-cli I also have to use the elf-file. So how do I tell lazarus to use that elf-file ? I configured lazarus to use arm-none-eabi-gdb as debugger, connect to localhost, port 3333. Which is the port openocd uses to let the debugger have control. I'm using lazarus 1.2.2, and fpc svn 27738 as arm-embedded-compiler. On a linux-machine. P.S. is there a way to send "monitor" commands to the debugger ? That way I could program my chip. Thanks, Koenraad.. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Justin Smyth
to Michael Ring

Do I need lazarus 1.2.2 or will latest trunk work ?

I am using this on a vm on my server which is connected to the microprocessor board. , so it will only be used for this ,, my own dev machine is on my laptop

Earlier message 105 lines
-----Original Message----- From: Michael Ring [mailto:] Sent: Wednesday, 21 May 2014 9:35 PM To: Lazarus mailing list Subject: Re: [Lazarus] How to tell debugger what executable to use ? Project->Compiler Options->other You can add those settings in Custom options control Target Os (embedded) and Target CPU family can be set in Project->Compiler Options->Config and Target The compiler can be set in Project->Compiler Options->Compiler Commands, in Compiler Command edit Project->field Use the Test button to see if all is complete. Unfortunaltely the debugger cannot be set on project level, you need to set it in Tools->Options->Debugger and set it back when you want to debug a windows project. Am 21.05.14 13:12, schrieb Justin Smyth: > I'd like to know more , I am doing the same thing but from windows > for a NXP LPC 1343 board. > > > I have recently got FPC 2.6.4 svn -27804 running on Lazarus 1.3 win32 > i386 Trunk ( SVN 45035 ) > > > I don't see this version having much debugging for embedded arm plus > for my chipset I am missing the -w switch I need to pass to > ppcrossarm.exe ( I have to tell lazarus on win32) > > The chipset I am using is - LPC1343FBD48 > > I have to pass this to fpc / ppcrossarm > > -Parm -Tembedded -WpLPC1343FBD48 -Cparmv7m <myprogram.pp> > > Do you have any clues on how to set up lazarus to pass in the -w > command to the compiler ? > > > Kind Regards > > > Justin > > -----Original Message----- > From: Koenraad Lelong [mailto:] > Sent: Wednesday, 21 May 2014 8:22 PM > To: Lazarus mailing > Subject: [Lazarus] How to tell debugger what executable to use ? > > Hi, > > I'm trying to use lazarus as a debugging-frontend for arm-embedded. > I managed to configure lazarus to compile my source into > arm-embedded-code for the STM32F103-processor. > My next step is to configure lazarus to debug the code. > When I do nothing, the debugger complains that project1 does not exist > (used path is OK), which is true because that file really does not > exist and should not exist. It's an *elf-file* (extension : .elf) that should be used. > If I use gdb-cli I also have to use the elf-file. So how do I tell > lazarus to use that elf-file ? > I configured lazarus to use arm-none-eabi-gdb as debugger, connect to > localhost, port 3333. Which is the port openocd uses to let the > debugger have control. > > I'm using lazarus 1.2.2, and fpc svn 27738 as arm-embedded-compiler. > On a linux-machine. > > P.S. is there a way to send "monitor" commands to the debugger ? That > way I could program my chip. > > Thanks, > > Koenraad.. > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > --

Reply by email

Michael Ring
to Justin Smyth

I only use trunk lazarus, I cannot tell you if this is also available in the release versions.

MiR

Justin Smyth wrote 123 lines
Do I need lazarus 1.2.2 or will latest trunk work ? I am using this on a vm on my server which is connected to the microprocessor board. , so it will only be used for this ,, my own dev machine is on my laptop -----Original Message----- From: Michael Ring [mailto:] Sent: Wednesday, 21 May 2014 9:35 PM To: Lazarus mailing list Subject: Re: [Lazarus] How to tell debugger what executable to use ? Project->Compiler Options->other You can add those settings in Custom options control Target Os (embedded) and Target CPU family can be set in Project->Compiler Options->Config and Target The compiler can be set in Project->Compiler Options->Compiler Commands, in Compiler Command edit Project->field Use the Test button to see if all is complete. Unfortunaltely the debugger cannot be set on project level, you need to set it in Tools->Options->Debugger and set it back when you want to debug a windows project. Am 21.05.14 13:12, schrieb Justin Smyth: > I'd like to know more , I am doing the same thing but from windows > for a NXP LPC 1343 board. > > > I have recently got FPC 2.6.4 svn -27804 running on Lazarus 1.3 win32 > i386 Trunk ( SVN 45035 ) > > > I don't see this version having much debugging for embedded arm plus > for my chipset I am missing the -w switch I need to pass to > ppcrossarm.exe ( I have to tell lazarus on win32) > > The chipset I am using is - LPC1343FBD48 > > I have to pass this to fpc / ppcrossarm > > -Parm -Tembedded -WpLPC1343FBD48 -Cparmv7m <myprogram.pp> > > Do you have any clues on how to set up lazarus to pass in the -w > command to the compiler ? > > > Kind Regards > > > Justin > > -----Original Message----- > From: Koenraad Lelong [mailto:] > Sent: Wednesday, 21 May 2014 8:22 PM > To: Lazarus mailing > Subject: [Lazarus] How to tell debugger what executable to use ? > > Hi, > > I'm trying to use lazarus as a debugging-frontend for arm-embedded. > I managed to configure lazarus to compile my source into > arm-embedded-code for the STM32F103-processor. > My next step is to configure lazarus to debug the code. > When I do nothing, the debugger complains that project1 does not exist > (used path is OK), which is true because that file really does not > exist and should not exist. It's an *elf-file* (extension : .elf) that should be used. > If I use gdb-cli I also have to use the elf-file. So how do I tell > lazarus to use that elf-file ? > I configured lazarus to use arm-none-eabi-gdb as debugger, connect to > localhost, port 3333. Which is the port openocd uses to let the > debugger have control. > > I'm using lazarus 1.2.2, and fpc svn 27738 as arm-embedded-compiler. > On a linux-machine. > > P.S. is there a way to send "monitor" commands to the debugger ? That > way I could program my chip. > > Thanks, > > Koenraad.. > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Martin Frb
to Koenraad Lelong: I'm trying to use lazarus as a debugging-frontend for arm-embedded. I managed to…

I dont know the answer, sa I do not have that scenario myself.

It would help, if you can specify which commands, to send to gdb, if you run gdb outside lazarus.

In Lazarus, There is also Menu: "Run" > "Run Parameter" which allaws to set the "Host application". That is the exe gdb should debug, e.g. if your project is a library, and you nneed to specify an exe that loads the library.

-----------------
No idea about "monitor".
But the IDE has 2 "developer" modes.(They are for developing the gdb integration. They allow directly sending commands to GDB, without checking them. However sending the wrong command, and your IDE/GDB communication breaks, and you loose the debug session. Sending commands only works, when the app is paused.

You need to define
DBG_WITH_DEBUGGER_DEBUG
DBG_WITH_GDB_WATCHES
and then recompile the IDE

DBG_WITH_DEBUGGER_DEBUG
There will be an TEdit at the bottom of the "Debug Output" Window. It can be used to send command

DBG_WITH_GDB_WATCHES
You can enter special watches, that will execute. They must start with a ">" (You can use the eval/modify window)

ptype ToOo

Warning: In both cases, sending any command that performs running/stepping, and the IDE willloose the session.

Koenraad Lelong wrote 31 lines
Hi, I'm trying to use lazarus as a debugging-frontend for arm-embedded. I managed to configure lazarus to compile my source into arm-embedded-code for the STM32F103-processor. My next step is to configure lazarus to debug the code. When I do nothing, the debugger complains that project1 does not exist (used path is OK), which is true because that file really does not exist and should not exist. It's an *elf-file* (extension : .elf) that should be used. If I use gdb-cli I also have to use the elf-file. So how do I tell lazarus to use that elf-file ? I configured lazarus to use arm-none-eabi-gdb as debugger, connect to localhost, port 3333. Which is the port openocd uses to let the debugger have control. I'm using lazarus 1.2.2, and fpc svn 27738 as arm-embedded-compiler. On a linux-machine. P.S. is there a way to send "monitor" commands to the debugger ? That way I could program my chip. Thanks, Koenraad.. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Martin Schreiber
to Koenraad Lelong: I'm trying to use lazarus as a debugging-frontend for arm-embedded. I managed to…
Koenraad Lelong wrote
Hi, I'm trying to use lazarus as a debugging-frontend for arm-embedded.

[...]

P.S. is there a way to send "monitor" commands to the debugger ? That way I could program my chip.

MSEide has support for such scenarios:
http://mseide-msegui.sourceforge.net/pics/gdbtarget.png

I use it with "AVR ONE!" and Segger J-Link interface.

Martin

Reply by email

Justin Smyth
to Michael Ring: I only use trunk lazarus, I cannot tell you if this is also available in the release…

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

Earlier message 136 lines
-----Original Message----- From: Michael Ring [mailto:] Sent: Wednesday, 21 May 2014 9:56 PM To: ; Lazarus mailing list Subject: Re: [Lazarus] How to tell debugger what executable to use ? I only use trunk lazarus, I cannot tell you if this is also available in the release versions. MiR Am 21.05.14 13:48, schrieb Justin Smyth: > Do I need lazarus 1.2.2 or will latest trunk work ? > > I am using this on a vm on my server which is connected to the > microprocessor board. , so it will only be used for this ,, my own > dev machine is on my laptop > > -----Original Message----- > From: Michael Ring [mailto:] > Sent: Wednesday, 21 May 2014 9:35 PM > To: Lazarus mailing list > Subject: Re: [Lazarus] How to tell debugger what executable to use ? > > Project->Compiler Options->other > > You can add those settings in Custom options control > > Target Os (embedded) and Target CPU family can be set in > Project->Compiler Options->Config and Target > > The compiler can be set in > > Project->Compiler Options->Compiler Commands, in Compiler Command edit > Project->field > > Use the Test button to see if all is complete. > > Unfortunaltely the debugger cannot be set on project level, you need > to set it in > > Tools->Options->Debugger > > and set it back when you want to debug a windows project. > > > Am 21.05.14 13:12, schrieb Justin Smyth: >> I'd like to know more , I am doing the same thing but from windows >> for a NXP LPC 1343 board. >> >> >> I have recently got FPC 2.6.4 svn -27804 running on Lazarus 1.3 win32 >> i386 Trunk ( SVN 45035 ) >> >> >> I don't see this version having much debugging for embedded arm plus >> for my chipset I am missing the -w switch I need to pass to >> ppcrossarm.exe ( I have to tell lazarus on win32) >> >> The chipset I am using is - LPC1343FBD48 >> >> I have to pass this to fpc / ppcrossarm >> >> -Parm -Tembedded -WpLPC1343FBD48 -Cparmv7m <myprogram.pp> >> >> Do you have any clues on how to set up lazarus to pass in the -w >> command to the compiler ? >> >> >> Kind Regards >> >> >> Justin >> >> -----Original Message----- >> From: Koenraad Lelong [mailto:] >> Sent: Wednesday, 21 May 2014 8:22 PM >> To: Lazarus mailing >> Subject: [Lazarus] How to tell debugger what executable to use ? >> >> Hi, >> >> I'm trying to use lazarus as a debugging-frontend for arm-embedded. >> I managed to configure lazarus to compile my source into >> arm-embedded-code for the STM32F103-processor. >> My next step is to configure lazarus to debug the code. >> When I do nothing, the debugger complains that project1 does not >> exist (used path is OK), which is true because that file really does >> not exist and should not exist. It's an *elf-file* (extension : .elf) >> that > should be used. >> If I use gdb-cli I also have to use the elf-file. So how do I tell >> lazarus to use that elf-file ? >> I configured lazarus to use arm-none-eabi-gdb as debugger, connect to >> localhost, port 3333. Which is the port openocd uses to let the >> debugger have control. >> >> I'm using lazarus 1.2.2, and fpc svn 27738 as arm-embedded-compiler. >> On a linux-machine. >> >> P.S. is there a way to send "monitor" commands to the debugger ? That >> way I could program my chip. >> >> Thanks, >> >> Koenraad.. >> >> -- >> _______________________________________________ >> Lazarus mailing list >> >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >> >> >> >> -- >> _______________________________________________ >> Lazarus mailing list >> >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >> > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >

Reply by email

Koenraad Lelong
to Justin Smyth
Justin Smyth wrote 17 lines
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

Reply by email