Contents|Index|Previous|Next

Debugging on Hitachi SH targets

gdb needs to know these things to talk to your Hitachi SH.

- Specifications for one of the following interfaces:
  target remote, gdb’s generic debugging protocol. Use src/gdb/config/sh/stub.c to connect to the SH chip. See Options for Debugging Your Program or GNU CC in Using GNU CC in GNUPro Compiler Tools.
  target e7000, the E7000 in-circuit emulator for the Hitachi SH.
  target hms, the HMS monitor on SH and H8/300 boards.
  target sim, the simulator, which allows you to run gdb remotely without an external device.
- Specifications for what serial device connects your host to your Hitachi SH board (the first serial device available on your host is the default).
- Specifications for what speed to use over the serial device.

The previous two specifications aren’t necessary for target sim, as the simulator is built in. Use one of the following gdb commands to specify the connection to your target board.

target hms port
To run a program on the board, start up gdb with the name of your program as the argument. To connect to the board, use the command target hms port, where port is the name of the serial port connected to the board. If the program has not already been downloaded to the board, you may use the load command to download it. You can then use all the usual gdb commands. For example, the following sequence connects to the target board through a serial port, then loads and runs a program, prog, through the debugger.

    host$ h8300-hms-gdb prog
    GDB is free software and...
    (gdb) target remote /dev/ttyb
    ...
    (gdb) load
    ...
    (gdb) run

target interface hostname: portnumber
You can specify a TCP/IP connection instead of a serial port, using the syntax, hostname: portnumber (assuming your board is connected so that this makes sense; for instance, to a serial line managed by a terminal concentrator).

gdb also supports set remotedebug n. You can see some debugging information about communications with the board by setting remotedebug.