By unit - serial --speed=115200 --unit=0 # TODO: untested
0 / com0 corresponds here to /dev/ttyS0
By IO port - serial --speed=115200 --port=0x3f8
gdb over nullmodem
Once serial is set run following command in grub console (so DUT side):
if serial was set by port: gdbstub port3f8
if serial was set by unit: gdbstub com0
On host side run gdb -b 115200 and then assuming host side connects to DUT via ttyUSB0
(gdb) target remote /dev/ttyUSB0
Remote debugging using /dev/ttyUSB0
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0xbf96d3d5 in ?? ()
(gdb)
From that point (gdb) c 1 will resume execution on DUT, and ~breakpoint can be also set from script via gdbstub_break.
To completely exit/stop gdbstub run gdbstub_stop on DUT
...to be continued...
Debug printf
While grub_dprintf() is controlled via debug variable (would be nice to use RTC NVRAM here instead), only a terminal_output exists and not error/log one. It would be great to introduce something like debug_output or log_output, being configured similarly to the existing one.
To not conflict with gdbstub perhaps different port can be used eg. terminal_output serial_port2f8
#### setting up serial
* By unit - `serial --speed=115200 --unit=0` # TODO: untested
* `0` / `com0` corresponds here to `/dev/ttyS0`
* By IO port - `serial --speed=115200 --port=0x3f8`
---------
#### gdb over nullmodem
Once serial is set run following command in grub console (so DUT side):
* if serial was set by port: `gdbstub port3f8`
* if serial was set by unit: `gdbstub com0`
On host side run `gdb -b 115200` and then assuming host side connects to DUT via `ttyUSB0`
```
(gdb) target remote /dev/ttyUSB0
Remote debugging using /dev/ttyUSB0
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0xbf96d3d5 in ?? ()
(gdb)
```
From that point `(gdb) c 1` will resume execution on DUT, and *~breakpoint* can be also set from script via `gdbstub_break`.
To completely exit/stop gdbstub run `gdbstub_stop` on DUT
*...to be continued...*
---------
#### Debug printf
While `grub_dprintf()` is controlled via [debug variable](https://www.gnu.org/software/grub/manual/grub/html_node/debug.html) (would be nice to use RTC NVRAM here instead), only a `terminal_output` exists and not error/log one. It would be great to introduce something like `debug_output` or `log_output`, being configured similarly to the existing one.
To not conflict with gdbstub perhaps different port can be used eg. `terminal_output serial_port2f8`
setting up serial
serial --speed=115200 --unit=0
# TODO: untested0
/com0
corresponds here to/dev/ttyS0
serial --speed=115200 --port=0x3f8
gdb over nullmodem
Once serial is set run following command in grub console (so DUT side):
gdbstub port3f8
gdbstub com0
On host side run
gdb -b 115200
and then assuming host side connects to DUT viattyUSB0
From that point
(gdb) c 1
will resume execution on DUT, and ~breakpoint can be also set from script viagdbstub_break
.To completely exit/stop gdbstub run
gdbstub_stop
on DUT...to be continued...
Debug printf
While
grub_dprintf()
is controlled via debug variable (would be nice to use RTC NVRAM here instead), only aterminal_output
exists and not error/log one. It would be great to introduce something likedebug_output
orlog_output
, being configured similarly to the existing one.To not conflict with gdbstub perhaps different port can be used eg.
terminal_output serial_port2f8