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 | 4 | ||||
| -rw-r--r-- | ao-tools/ao-dbg/ao-dbg.h | 1 |
4 files changed, 18 insertions, 5 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..1f544e5b 100644 --- a/ao-tools/ao-dbg/ao-dbg.1 +++ b/ao-tools/ao-dbg/ao-dbg.1 @@ -34,6 +34,7 @@ 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 @@ -78,6 +79,9 @@ 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 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. .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 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, |
