diff options
Diffstat (limited to 'ao-tools/ao-dbg')
-rw-r--r-- | ao-tools/ao-dbg/ao-dbg-main.c | 12 | ||||
-rw-r--r-- | ao-tools/ao-dbg/ao-dbg-parse.c | 6 | ||||
-rw-r--r-- | ao-tools/ao-dbg/ao-dbg.1 | 54 | ||||
-rw-r--r-- | ao-tools/ao-dbg/ao-dbg.h | 1 |
4 files changed, 44 insertions, 29 deletions
diff --git a/ao-tools/ao-dbg/ao-dbg-main.c b/ao-tools/ao-dbg/ao-dbg-main.c index 72249a6b..f1e2c111 100644 --- a/ao-tools/ao-dbg/ao-dbg-main.c +++ b/ao-tools/ao-dbg/ao-dbg-main.c @@ -24,6 +24,7 @@ #include <signal.h> #include <stdarg.h> #include <poll.h> +#include <getopt.h> static int s51_port = 0; static char *cpu = "8051"; @@ -32,6 +33,7 @@ char *s51_prompt = "> "; struct ccdbg *s51_dbg; int s51_interrupted = 0; int s51_monitor = 0; +char *s51_tty = NULL; static FILE *s51_input; static FILE *s51_output; @@ -48,6 +50,11 @@ void s51_sigint() s51_interrupted = 1; } +static const struct option options[] = { + { .name = "tty", .has_arg = 1, .val = 'T' }, + { 0, 0, 0, 0 }, +}; + int main(int argc, char **argv) { @@ -55,7 +62,7 @@ main(int argc, char **argv) char *endptr; struct sigvec vec, ovec; - while ((opt = getopt(argc, argv, "PVvHhmt:X:c:r:Z:s:S:p:")) != -1) { + while ((opt = getopt_long(argc, argv, "PVvHhmt:X:c:r:Z:s:S:p:T:", options, NULL)) != -1) { switch (opt) { case 't': cpu = optarg; @@ -104,6 +111,9 @@ main(int argc, char **argv) case 'm': s51_monitor = 1; break; + case 'T': + s51_tty = optarg; + break; } } if (s51_port) { diff --git a/ao-tools/ao-dbg/ao-dbg-parse.c b/ao-tools/ao-dbg/ao-dbg-parse.c index 5db6c01c..825d0e9c 100644 --- a/ao-tools/ao-dbg/ao-dbg-parse.c +++ b/ao-tools/ao-dbg/ao-dbg-parse.c @@ -195,11 +195,9 @@ command_read (void) enum command_result result; struct command_function *func; - s51_dbg = ccdbg_open (); - if (!s51_dbg) { - perror("ccdbg_open"); + s51_dbg = ccdbg_open (s51_tty); + if (!s51_dbg) exit(1); - } ccdbg_debug_mode(s51_dbg); ccdbg_halt(s51_dbg); s51_printf("Welcome to the non-simulated processor\n"); diff --git a/ao-tools/ao-dbg/ao-dbg.1 b/ao-tools/ao-dbg/ao-dbg.1 index f2f59a52..a850c454 100644 --- a/ao-tools/ao-dbg/ao-dbg.1 +++ b/ao-tools/ao-dbg/ao-dbg.1 @@ -16,11 +16,11 @@ .\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. .\" .\" -.TH S51 1 "s51" "" +.TH AO-DBG 1 "ao-dbg" "" .SH NAME -s51 \- hex debugger for cc1111 processors +ao-dbg \- hex debugger for cc1111 processors .SH SYNOPSIS -.B "s51" +.B "ao-dbg" [\-t \fIcpu-type\fP] [\-X \fIfrequency\fP] [\-c] @@ -34,14 +34,16 @@ s51 \- hex debugger for cc1111 processors [\-H] [\-h] [\-m] +[\-T \fItty-device\fP] .SH DESCRIPTION -.I s51 -connects to a cc1111 processor through a cp1203-based USB-to-serial -converter board, using the GPIO pins available on that chip. It provides an -interface compatible with the 8051 emulator of the same name (s51), but -communicating with the real chip instead of an emulation. Using a modified -version of the SDCC debugger (sdcdb), you can control program execution -on the target machine at source-level. +.I ao-dbg +connects to a cc1111 processor through either a suitable cc1111 board +or a cp2103 usb to serial converter board, using the GPIO pins +available on that chip. It provides an interface compatible with the +8051 emulator from sdcc called s51, but communicating with the real +chip instead of an emulation. Using a modified version of the SDCC +debugger (sdcdb), you can control program execution on the target +machine at source-level. .SH OPTIONS The command line options are designed to be compatible with the 8051 @@ -64,9 +66,9 @@ The emulator and sdcdb communicate through a network socket. This option switches the debugger from communicating through stdin/stdout to listening on a specific network port instead. Once a connection is made, the debugger continues on, using that network port for command input and output. The -debugger uses port 9756, and attempts to connect before launching s51, so if -s51 is listening on this port before sdcdb is started, sdcdb will end up -talking to the existing s51 instance. That's often useful for debugging s51 +debugger uses port 9756, and attempts to connect before launching ao-dbg, so if +ao-dbg is listening on this port before sdcdb is started, sdcdb will end up +talking to the existing ao-dbg instance. That's often useful for debugging ao-dbg itself. .IP "\-p \fIprompt\fP" This sets the command prompt to the specified string. @@ -76,14 +78,19 @@ sdcdb. .IP "\-h" This should print a usage message, but does nothing useful currently. .IP "\-m" -This option is not present in the original 8051 emulator, and causes s51 to +This option is not present in the original 8051 emulator, and causes ao-dbg to dump all commands and replies that are received from and sent to sdcdb. +.IP "\-T" +This selects which tty device the debugger uses to communicate with +the target device. The special name 'BITBANG' directs ao-dbg to use +the cp2103 connection, otherwise this should be a usb serial port +connected to a suitable cc1111 debug node. .SH COMMANDS -Once started, s51 connects to the cc1111 via the CP2103 using libusb2 and -then reads and executes commands, either from stdin, or the nework -connection to sdcdb. +Once started, ao-dbg connects to the cc1111 and then reads and +executes commands, either from stdin, or the nework connection to +sdcdb. .PP -Unlike the command line, s51 contains built-in help for each of these +Unlike the command line, ao-dbg contains built-in help for each of these commands, via the 'help' command. Most of the commands are available in a long form and a single character short form. Below, the short form follows the long form after a comma. @@ -155,13 +162,12 @@ the original 8051 emulator. While the original purpose for this program was to connect the source debugger with the hardware, it can also be used as a low-level hex debugger all on its own. In particular, all of the cc1111 peripherals can be -manipulated directly from the s51 command line. -.IP "Starting s51" -If the CP2103 is plugged in, and the CC1111 is connected correctly, the -\'s51\' command itself should connect to the device without trouble. -Note that the CP2103 must have the GPIO pins configured correctly as well. +manipulated directly from the ao-dbg command line. +.IP "Starting ao-dbg" +First ensure that the target cc1111 device and intermediate cp2103 or +cc111 board are all hooked up correctly. .IP -$ s51 +$ ao-dbg .br Welcome to the non-simulated processor .br diff --git a/ao-tools/ao-dbg/ao-dbg.h b/ao-tools/ao-dbg/ao-dbg.h index f4dcce66..c1789d10 100644 --- a/ao-tools/ao-dbg/ao-dbg.h +++ b/ao-tools/ao-dbg/ao-dbg.h @@ -22,6 +22,7 @@ extern char *s51_prompt; extern struct ccdbg *s51_dbg; extern int s51_interrupted; extern int s51_monitor; +extern char *s51_tty; enum command_result { command_success, command_debug, command_syntax, command_interrupt, command_error, |