int s51_interrupted = 0;
int s51_monitor = 0;
char *s51_tty = NULL;
+char *s51_device = NULL;
static FILE *s51_input;
static FILE *s51_output;
static const struct option options[] = {
{ .name = "tty", .has_arg = 1, .val = 'T' },
+ { .name = "device", .has_arg = 1, .val = 'D' },
{ 0, 0, 0, 0 },
};
case 'T':
s51_tty = optarg;
break;
+ case 'D':
+ s51_device = optarg;
+ break;
}
}
if (s51_port) {
enum command_result result;
struct command_function *func;
+ if (!s51_tty) {
+ if (!s51_device)
+ s51_device = getenv("AO_DBG_DEVICE");
+ s51_tty = cc_usbdevs_find_by_arg(s51_device, "TIDongle");
+ }
s51_dbg = ccdbg_open (s51_tty);
if (!s51_dbg)
exit(1);
[\-h]
[\-m]
[\-T \fItty-device\fP]
+[\--tty \fItty-device\fP]
+[\-D \fIaltos-device\fP]
+[\--device \fIaltos-device\fP]
.SH DESCRIPTION
.I ao-dbg
connects to a cc1111 processor through either a suitable cc1111 board
.IP "\-m"
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"
+.TP
+\-T tty-device | --tty tty-device
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.
+.TP
+\-D AltOS-device | --device AltOS-device
+Search for a connected device. This requires an argument of one of the
+following forms:
+.IP
+TeleMetrum:2
+.br
+TeleMetrum
+.br
+2
+.IP
+Leaving out the product name will cause the tool to select a suitable
+product, leaving out the serial number will cause the tool to match
+one of the available devices.
.SH COMMANDS
Once started, ao-dbg connects to the cc1111 and then reads and
executes commands, either from stdin, or the nework connection to
*/
#include <ccdbg.h>
+#include <cc.h>
extern char *s51_prompt;
extern struct ccdbg *s51_dbg;
extern int s51_interrupted;
extern int s51_monitor;
extern char *s51_tty;
+extern char *s51_device;
enum command_result {
command_success, command_debug, command_syntax, command_interrupt, command_error,
ao-eeprom \- Fetch eeprom contents from TeleMetrum device
.SH SYNOPSIS
.B "ao-eeprom"
-[\-tty \fItty-device\fP]
+[\-T \fItty-device\fP]
+[\--tty \fItty-device\fP]
+[\-D \fIaltos-device\fP]
+[\--device \fIaltos-device\fP]
+.SH OPTIONS
+.TP
+\-T tty-device | --tty tty-device
+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.
+.TP
+\-D AltOS-device | --device AltOS-device
+Search for a connected device. This requires an argument of one of the
+following forms:
+.IP
+TeleMetrum:2
+.br
+TeleMetrum
+.br
+2
+.IP
+Leaving out the product name will cause the tool to select a suitable
+product, leaving out the serial number will cause the tool to match
+one of the available devices.
.SH DESCRIPTION
.I ao-eeprom
downloads the eeprom contents from a connected TeleMetrum device.
ao-load \- flash a program to a AltOS device
.SH SYNOPSIS
.B "ao-load"
-[\-tty \fItty-device\fP]
+[\-T \fItty-device\fP]
+[\--tty \fItty-device\fP]
+[\-D \fIaltos-device\fP]
+[\--device \fIaltos-device\fP]
\fIfile.ihx\fP
\fIdevice serial number\fP
.SH DESCRIPTION
.I ao-load
loads the specified .ihx file into the target device flash memory,
customizing the AltOS image with the specified serial number.
+.SH OPTIONS
+.TP
+\-T tty-device | --tty tty-device
+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.
+.TP
+\-D AltOS-device | --device AltOS-device
+Search for a connected device. This requires an argument of one of the
+following forms:
+.IP
+TeleMetrum:2
+.br
+TeleMetrum
+.br
+2
+.IP
+Leaving out the product name will cause the tool to select a suitable
+product, leaving out the serial number will cause the tool to match
+one of the available devices.
.SH USAGE
.I ao-load
reads the specified .ihx file into memory, locates the matching .map
#include <unistd.h>
#include <getopt.h>
#include "ccdbg.h"
+#include "cc.h"
#define AO_USB_DESC_STRING 3
static const struct option options[] = {
{ .name = "tty", .has_arg = 1, .val = 'T' },
+ { .name = "device", .has_arg = 1, .val = 'D' },
{ 0, 0, 0, 0},
};
static void usage(char *program)
{
- fprintf(stderr, "usage: %s [--tty <tty-name>] file.ihx serial-number\n", program);
+ fprintf(stderr, "usage: %s [--tty <tty-name>] [--device <device-name>] file.ihx serial-number\n", program);
exit(1);
}
unsigned usb_descriptors;
int string_num;
char *tty = NULL;
+ char *device = NULL;
int c;
- while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "T:D:", options, NULL)) != -1) {
switch (c) {
case 'T':
tty = optarg;
break;
+ case 'D':
+ device = optarg;
+ break;
default:
usage(argv[0]);
break;
if (!rewrite(image, usb_descriptors + 2 + image->address, serial_ucs2, serial_ucs2_len))
usage(argv[0]);
+ if (!tty)
+ tty = cc_usbdevs_find_by_arg(device, "TIDongle");
dbg = ccdbg_open(tty);
if (!dbg)
exit (1);
ao-rawload \- flash a program to a AltOS device
.SH SYNOPSIS
.B "ao-rawload"
-[\-tty \fItty-device\fP]
+[\-T \fItty-device\fP]
+[\--tty \fItty-device\fP]
+[\-D \fIaltos-device\fP]
+[\--device \fIaltos-device\fP]
\fIfile.ihx\fP
.SH DESCRIPTION
.I ao-rawload
loads the specified .ihx file, without modification, into the target
device flash memory.
+.SH OPTIONS
+.TP
+\-T tty-device | --tty tty-device
+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.
+.TP
+\-D AltOS-device | --device AltOS-device
+Search for a connected device. This requires an argument of one of the
+following forms:
+.IP
+TeleMetrum:2
+.br
+TeleMetrum
+.br
+2
+.IP
+Leaving out the product name will cause the tool to select a suitable
+product, leaving out the serial number will cause the tool to match
+one of the available devices.
.SH USAGE
.I ao-rawload
reads the specified .ihx file into memory. It then connects to the
static const struct option options[] = {
{ .name = "tty", .has_arg = 1, .val = 'T' },
+ { .name = "device", .has_arg = 1, .val = 'D' },
{ 0, 0, 0, 0},
};
static void usage(char *program)
{
- fprintf(stderr, "usage: %s [--tty <tty-name>] file.ihx\n", program);
+ fprintf(stderr, "usage: %s [--tty <tty-name>] [--device <device-name>] file.ihx\n", program);
exit(1);
}
char *filename;
FILE *file;
char *tty = NULL;
+ char *device = NULL;
int c;
- while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "T:D:", options, NULL)) != -1) {
switch (c) {
case 'T':
tty = optarg;
break;
+ case 'D':
+ device = optarg;
+ break;
default:
usage(argv[0]);
break;
}
ccdbg_hex_file_free(hex);
+ if (!tty)
+ tty = cc_usbdevs_find_by_arg(device, "TIDongle");
dbg = ccdbg_open(tty);
if (!dbg)
exit (1);