Also, use the ALTOS_TTY environment variable in all tools. Note that
the magic value of "BITBANG" switches the library to connecting
through a CP2103 instead.
Signed-off-by: Keith Packard <keithp@keithp.com>
15 files changed:
aclocal.m4
src/ao_flight_test
src/ao_gps_test
aclocal.m4
src/ao_flight_test
src/ao_gps_test
+ dbg = ccdbg_open("BITBANG");
#include <signal.h>
#include <stdarg.h>
#include <poll.h>
#include <signal.h>
#include <stdarg.h>
#include <poll.h>
static int s51_port = 0;
static char *cpu = "8051";
static int s51_port = 0;
static char *cpu = "8051";
struct ccdbg *s51_dbg;
int s51_interrupted = 0;
int s51_monitor = 0;
struct ccdbg *s51_dbg;
int s51_interrupted = 0;
int s51_monitor = 0;
static FILE *s51_input;
static FILE *s51_output;
static FILE *s51_input;
static FILE *s51_output;
+static const struct option options[] = {
+ { .name = "tty", .has_arg = 1, .val = 'T' },
+ { 0, 0, 0, 0 },
+};
+
int
main(int argc, char **argv)
{
int
main(int argc, char **argv)
{
char *endptr;
struct sigvec vec, ovec;
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;
switch (opt) {
case 't':
cpu = optarg;
case 'm':
s51_monitor = 1;
break;
case 'm':
s51_monitor = 1;
break;
+ case 'T':
+ s51_tty = optarg;
+ break;
enum command_result result;
struct command_function *func;
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)
ccdbg_debug_mode(s51_dbg);
ccdbg_halt(s51_dbg);
s51_printf("Welcome to the non-simulated processor\n");
ccdbg_debug_mode(s51_dbg);
ccdbg_halt(s51_dbg);
s51_printf("Welcome to the non-simulated processor\n");
.SH DESCRIPTION
.I s51
connects to a cc1111 processor through a cp1203-based USB-to-serial
.SH DESCRIPTION
.I s51
connects to a cc1111 processor through a cp1203-based USB-to-serial
.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 "\-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
.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
extern struct ccdbg *s51_dbg;
extern int s51_interrupted;
extern int s51_monitor;
extern struct ccdbg *s51_dbg;
extern int s51_interrupted;
extern int s51_monitor;
enum command_result {
command_success, command_debug, command_syntax, command_interrupt, command_error,
enum command_result {
command_success, command_debug, command_syntax, command_interrupt, command_error,
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <getopt.h>
#include "cc-usb.h"
#define NUM_BLOCK 512
#include "cc-usb.h"
#define NUM_BLOCK 512
+static const struct option options[] = {
+ { .name = "tty", .has_arg = 1, .val = 'T' },
+ { 0, 0, 0, 0},
+};
+
+static void usage(char *program)
+{
+ fprintf(stderr, "usage: %s [--tty <tty-name>]\n", program);
+ exit(1);
+}
+
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
uint8_t *b;
int i, j;
uint32_t addr;
uint8_t *b;
int i, j;
uint32_t addr;
+ char *tty = NULL;
+ int c;
- tty = getenv("CCDBG_TTY");
+ while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+ switch (c) {
+ case 'T':
+ tty = optarg;
+ break;
+ default:
+ usage(argv[0]);
+ break;
+ }
+ }
+ if (!tty)
+ tty = getenv("ALTOS_TTY");
+ if (!tty)
+ tty="/dev/ttyACM0";
for (block = 0; block < NUM_BLOCK; block++) {
cc_queue_read(cc, bytes, sizeof (bytes));
cc_usb_printf(cc, "e %x\n", block);
for (block = 0; block < NUM_BLOCK; block++) {
cc_queue_read(cc, bytes, sizeof (bytes));
cc_usb_printf(cc, "e %x\n", block);
#include <stdlib.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <stdint.h>
+#include <unistd.h>
+#include <getopt.h>
#include "ccdbg.h"
#define AO_USB_DESC_STRING 3
#include "ccdbg.h"
#define AO_USB_DESC_STRING 3
-void
-usage(char *program)
-{
- fprintf(stderr, "usage: %s <filename.ihx> <serial>\n", program);
- exit(1);
-}
-
struct sym {
unsigned addr;
char *name;
struct sym {
unsigned addr;
char *name;
memcpy(image->data + addr - image->address, data, len);
}
memcpy(image->data + addr - image->address, data, len);
}
+static const struct option options[] = {
+ { .name = "tty", .has_arg = 1, .val = 'T' },
+ { 0, 0, 0, 0},
+};
+
+static void usage(char *program)
+{
+ fprintf(stderr, "usage: %s [--tty <tty-name>] file.ihx serial-number\n", program);
+ exit(1);
+}
+
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
uint16_t pc;
struct hex_file *hex;
struct hex_image *image;
uint16_t pc;
struct hex_file *hex;
struct hex_image *image;
- char *filename;
- FILE *file;
- FILE *map;
- char *serial_string;
- unsigned int serial;
- char *mapname, *dot;
+ char *filename;
+ FILE *file;
+ FILE *map;
+ char *serial_string;
+ unsigned int serial;
+ char *mapname, *dot;
char *serial_ucs2;
int serial_ucs2_len;
char serial_int[2];
char *serial_ucs2;
int serial_ucs2_len;
char serial_int[2];
int i;
unsigned usb_descriptors;
int string_num;
int i;
unsigned usb_descriptors;
int string_num;
+ char *tty = NULL;
+ int c;
+
+ while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+ switch (c) {
+ case 'T':
+ tty = optarg;
+ break;
+ default:
+ usage(argv[0]);
+ break;
+ }
+ }
+ filename = argv[optind];
if (filename == NULL)
usage(argv[0]);
mapname = strdup(filename);
if (filename == NULL)
usage(argv[0]);
mapname = strdup(filename);
usage(argv[0]);
strcpy(dot, ".map");
usage(argv[0]);
strcpy(dot, ".map");
- serial_string = argv[2];
+ serial_string = argv[optind + 1];
if (serial_string == NULL)
usage(argv[0]);
if (serial_string == NULL)
usage(argv[0]);
serial = strtoul(serial_string, NULL, 0);
if (!serial)
serial = strtoul(serial_string, NULL, 0);
if (!serial)
serial_int[0] = serial & 0xff;
serial_int[1] = (serial >> 8) & 0xff;
serial_int[0] = serial & 0xff;
serial_int[1] = (serial >> 8) & 0xff;
if (!rewrite(image, usb_descriptors + 2 + image->address, serial_ucs2, serial_ucs2_len))
usage(argv[0]);
if (!rewrite(image, usb_descriptors + 2 + image->address, serial_ucs2, serial_ucs2_len))
usage(argv[0]);
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#include <unistd.h>
+#include <getopt.h>
+static const struct option options[] = {
+ { .name = "tty", .has_arg = 1, .val = 'T' },
+ { 0, 0, 0, 0},
+};
+
+static void usage(char *program)
+{
+ fprintf(stderr, "usage: %s [--tty <tty-name>] file.ihx\n", program);
+ exit(1);
+}
+
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
uint16_t pc;
struct hex_file *hex;
struct hex_image *image;
uint16_t pc;
struct hex_file *hex;
struct hex_image *image;
- char *filename;
- FILE *file;
+ char *filename;
+ FILE *file;
+ char *tty = NULL;
+ int c;
+ while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+ switch (c) {
+ case 'T':
+ tty = optarg;
+ break;
+ default:
+ usage(argv[0]);
+ break;
+ }
+ }
+ filename = argv[optind];
if (filename == NULL) {
fprintf(stderr, "usage: %s <filename.ihx>\n", argv[0]);
exit(1);
if (filename == NULL) {
fprintf(stderr, "usage: %s <filename.ihx>\n", argv[0]);
exit(1);
}
ccdbg_hex_file_free(hex);
}
ccdbg_hex_file_free(hex);
#include "cc-bitbang.h"
struct ccdbg *
#include "cc-bitbang.h"
struct ccdbg *
dbg = calloc(sizeof (struct ccdbg), 1);
if (!dbg) {
perror("calloc");
return NULL;
}
dbg = calloc(sizeof (struct ccdbg), 1);
if (!dbg) {
perror("calloc");
return NULL;
}
- tty = getenv("CCDBG_TTY");
- if (!tty || tty[0] == '/')
- dbg->usb = cc_usb_open(tty);
- if (!dbg->usb) {
+ if (!tty)
+ tty = getenv("ALTOS_TTY");
+ if (!tty)
+ tty="/dev/ttyACM0";
+
+ if (!strcmp(tty, "BITBANG")) {
dbg->bb = cc_bitbang_open();
if (!dbg->bb) {
free(dbg);
return NULL;
}
dbg->bb = cc_bitbang_open();
if (!dbg->bb) {
free(dbg);
return NULL;
}
+ } else {
+ dbg->usb = cc_usb_open(tty);
+ if (!dbg->usb) {
+ free(dbg);
+ return NULL;
+ }
/* ccdbg-io.c */
struct ccdbg *
/* ccdbg-io.c */
struct ccdbg *
void
ccdbg_close(struct ccdbg *dbg);
void
ccdbg_close(struct ccdbg *dbg);
0x10c4, 0xea60);
cp->ack = -1;
if (!cp->handle) {
0x10c4, 0xea60);
cp->ack = -1;
if (!cp->handle) {
+ fprintf(stderr, "Cannot find USB device 10c4:ea60\n");
libusb_exit(cp->ctx);
free(cp);
return NULL;
libusb_exit(cp->ctx);
free(cp);
return NULL;
<property name="type_hint">normal</property>
<property name="skip_taskbar_hint">True</property>
<property name="transient_for">aoview</property>
<property name="type_hint">normal</property>
<property name="skip_taskbar_hint">True</property>
<property name="transient_for">aoview</property>
- <property name="has_separator">False</property>
<property name="buttons">close</property>
<property name="text">Saving EEPROM data as</property>
<property name="secondary_text"><filename></property>
<property name="buttons">close</property>
<property name="text">Saving EEPROM data as</property>
<property name="secondary_text"><filename></property>
void
aoview_flite_stop(void);
void
aoview_flite_stop(void);
+/* aoview_main.c */
+
+extern char *aoview_tty;
+
+char *aoview_tty = NULL;
int main(int argc, char **argv)
{
GladeXML *xml = NULL;
GtkWidget *mainwindow;
int main(int argc, char **argv)
{
GladeXML *xml = NULL;
GtkWidget *mainwindow;
GtkAboutDialog *about_dialog;
static struct option long_options[] = {
GtkAboutDialog *about_dialog;
static struct option long_options[] = {
- { "device", 1, 0, 'd'},
{ "sync", 0, 0, 's'},
{ 0, 0, 0, 0 }
};
for (;;) {
int c, temp;
{ "sync", 0, 0, 's'},
{ 0, 0, 0, 0 }
};
for (;;) {
int c, temp;
- c = getopt_long_only(argc, argv, "sd:", long_options, &temp);
+ c = getopt_long_only(argc, argv, "sT:", long_options, &temp);
if (c == -1)
break;
switch (c) {
if (c == -1)
break;
switch (c) {
- case 'd':
- device = optarg;
+ case 'T':
+ aoview_tty = optarg;
break;
case 's':
_Xdebug = 1;
break;
case 's':
_Xdebug = 1;
+ if (aoview_tty) {
+ if (!aoview_monitor_connect(aoview_tty)) {
+ perror(aoview_tty);
+ exit(1);
+ }
+ }
aoview_voice_speak("rocket flight monitor ready\n");
gtk_main();
aoview_voice_speak("rocket flight monitor ready\n");
gtk_main();