Has anyone encountered a standalone gdb server? That is gdb server that runs on a bare metal.
I've been looking for sources to build one. Doesn't need to be ARM, but that might help.
Maybe someone has come across a document explaining how gdb server really works?
(It might help in reading the 'standard' gdb server code.)
I understand that 'stub' means "gdb server" linked into the executable, but I'd like to have a server with which I could upload programs onto the board for debugging through the network or serial IF.
My main concern is attaching to the program to be debugged, when there is no OS (and no processes).
Would OpenOCD by any chance be what you're looking for ?
-If it is, I recommend cloning the sources from the official git repository.
I can provide you with some quick build instructions, just let me know.
I think not - OpenOCD also runs on host (and wants an OS around), and is used for "HW debugging" (=jtag, j-link, ...).
What I'm after is like gdb stub, but separate standalone program not linked into the program to be debugged.
I have a Linux machine as host and a bare metal ARM-board (Raspberry Pi) as a target. I don't have a jtag pod
(or anything for that function).
Sadly I'm no expert in this area, but here's my thoughts ... Perhaps you've already been thinking about these things.
If I understand it correctly now, it's more like a "remote debugger" you're looking for; eg. a "thin debugger" so to speak ?
-But if you're going to "run a program" on the target board, I believe you would need one of these 3...
1: An operating system
2: To link your program with a 'debugger library' (the 'stub' you mentioned)
3: A bootloader, which is also the 'thin debugger'
I expect that you're interested in something like #3 ?
(I do not know if the RasPi has a built-in bootloader, which allows simple debugging; some Cortex-M devices are 'born' with a bootloader that has a few extra features. If the RasPi has such a bootloader, already, you'd only need to write a small program on your host, which interfaces with GDB).
Although you're not looking for OpenOCD, I would still advice to ask this question on the OpenOCD developer mailing list, because many of the people there are experts; they work with ARM architectures and also know the inner workings of OpenOCD; which is a GDB server. There's a slim chance that someone could have tried something similar already.
Yes, I'm after the option #3.
RasPi has a bootloader, but it's for the GPU. The GPU reads in the boot code for the ARM, and it doesn't include any debugging facilities. That code basically initializes the ARM-side and reads in the kernel from the memory card. To boot your own SW, you just generate a binary image and put it onto the memory card as 'kernel.img'.
Asking from OpenOCD-guys is a good idea.
Liviu Ionescu replied to my query on the OpenOCD mailing list ... I asked for a lightweight GDB remote server.
"RedBoot also includes a GDB server, accessible via Ethernet and serial, but I don't know if it qualifies as 'Lightweight'."
I think that RedBoot might sound interesting ?