diff options
author | Bdale Garbee <bdale@gag.com> | 2009-08-18 18:09:38 -0600 |
---|---|---|
committer | Bdale Garbee <bdale@gag.com> | 2009-08-18 18:09:38 -0600 |
commit | 4685fc541466afbeefc151bcb64cd054739c048b (patch) | |
tree | d7e0f521bd51897a59dd9c355d74218132da4b75 /ao-tools/ao-rawload | |
parent | 1c2a0b6653623b689d68d7349a6b2dce3e20a4a6 (diff) | |
parent | c29275b72438637d46d7a50742882d2736eb176a (diff) |
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
Conflicts:
ao-tools/ao-bitbang/Makefile.am
ao-tools/ao-eeprom/Makefile.am
ao-tools/ao-load/Makefile.am
ao-tools/ao-load/ao-load.c
ao-tools/ao-rawload/Makefile.am
Diffstat (limited to 'ao-tools/ao-rawload')
-rw-r--r-- | ao-tools/ao-rawload/Makefile.am | 2 | ||||
-rw-r--r-- | ao-tools/ao-rawload/ao-rawload.1 | 36 | ||||
-rw-r--r-- | ao-tools/ao-rawload/ao-rawload.c | 33 |
3 files changed, 67 insertions, 4 deletions
diff --git a/ao-tools/ao-rawload/Makefile.am b/ao-tools/ao-rawload/Makefile.am index 24013a85..d2c55658 100644 --- a/ao-tools/ao-rawload/Makefile.am +++ b/ao-tools/ao-rawload/Makefile.am @@ -8,3 +8,5 @@ ao_rawload_DEPENDENCIES = $(AO_RAWLOAD_LIBS) ao_rawload_LDADD=$(AO_RAWLOAD_LIBS) $(LIBUSB_LIBS) ao_rawload_SOURCES = ao-rawload.c + +man_MANS=ao-rawload.1 diff --git a/ao-tools/ao-rawload/ao-rawload.1 b/ao-tools/ao-rawload/ao-rawload.1 new file mode 100644 index 00000000..e79645f1 --- /dev/null +++ b/ao-tools/ao-rawload/ao-rawload.1 @@ -0,0 +1,36 @@ +.\" +.\" Copyright © 2009 Keith Packard <keithp@keithp.com> +.\" +.\" This program is free software; you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation; either version 2 of the License, or +.\" (at your option) any later version. +.\" +.\" This program is distributed in the hope that it will be useful, but +.\" WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License along +.\" with this program; if not, write to the Free Software Foundation, Inc., +.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +.\" +.\" +.TH AO-RAWLOAD 1 "ao-rawload" "" +.SH NAME +ao-rawload \- flash a program to a AltOS device +.SH SYNOPSIS +.B "ao-rawload" +[\-tty \fItty-device\fP] +\fIfile.ihx\fP +.SH DESCRIPTION +.I ao-rawload +loads the specified .ihx file, without modification, into the target +device flash memory. +.SH USAGE +.I ao-rawload +reads the specified .ihx file into memory. It then connects to the +specified target device and writes the program to the target device +flash memory. +.SH AUTHOR +Keith Packard diff --git a/ao-tools/ao-rawload/ao-rawload.c b/ao-tools/ao-rawload/ao-rawload.c index 5f7708fd..1f1537b9 100644 --- a/ao-tools/ao-rawload/ao-rawload.c +++ b/ao-tools/ao-rawload/ao-rawload.c @@ -16,8 +16,21 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <unistd.h> +#include <getopt.h> #include "ccdbg.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) { @@ -26,10 +39,22 @@ main (int argc, char **argv) uint16_t pc; struct hex_file *hex; struct hex_image *image; - char *filename; - FILE *file; + char *filename; + FILE *file; + char *tty = NULL; + int c; - filename = argv[1]; + 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); @@ -50,7 +75,7 @@ main (int argc, char **argv) } ccdbg_hex_file_free(hex); - dbg = ccdbg_open(); + dbg = ccdbg_open(tty); if (!dbg) exit (1); |