changeset 945:86ff6d0b0a97

loadtools: fc-compalram trivial utility added
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Mon, 02 Nov 2015 17:36:02 +0000
parents 51f580665110
children 845c2e420069
files .hgignore loadtools/Makefile loadtools/compalram.c
diffstat 3 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Nov 01 05:03:35 2015 +0000
+++ b/.hgignore	Mon Nov 02 17:36:02 2015 +0000
@@ -19,6 +19,7 @@
 
 ^lcdemu/fc-lcdemu$
 
+^loadtools/fc-compalram$
 ^loadtools/fc-iram$
 ^loadtools/fc-loadtool$
 ^loadtools/fc-xram$
--- a/loadtools/Makefile	Sun Nov 01 05:03:35 2015 +0000
+++ b/loadtools/Makefile	Mon Nov 02 17:36:02 2015 +0000
@@ -1,10 +1,12 @@
 CC=	gcc
 CFLAGS=	-O2
-PROGS=	fc-iram fc-loadtool fc-xram
+PROGS=	fc-iram fc-loadtool fc-xram fc-compalram
 INSTBIN=/usr/local/bin
 
 EXTRA_OBJ=	compalload.o
 
+COMPALRAM_OBJS=	compalload.o compalram.o defpath.o sercomm.o ttypassthru.o
+
 IRAM_OBJS=	defpath.o hexdecode.o hwparam.o hwparamstubs.o romload.o \
 		sercomm.o sertool.o srecreader.o ttypassthru.o ${EXTRA_OBJ}
 
@@ -20,6 +22,9 @@
 
 all:	${PROGS}
 
+fc-compalram:	${COMPALRAM_OBJS}
+	${CC} ${CFLAGS} -o $@ ${COMPALRAM_OBJS}
+
 fc-iram:	${IRAM_OBJS}
 	${CC} ${CFLAGS} -o $@ ${IRAM_OBJS}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loadtools/compalram.c	Mon Nov 02 17:36:02 2015 +0000
@@ -0,0 +1,26 @@
+/*
+ * This module contains the main() function for fc-compalram, a trivial
+ * utility that feeds a binary download image to Compal's bootloader
+ * and then switches into serial tty pass-through.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern char *target_ttydev;
+
+main(argc, argv)
+	char **argv;
+{
+	if (argc != 3) {
+		fprintf(stderr, "usage: fc-compalram ttyport image.bin\n");
+		exit(1);
+	}
+	target_ttydev = argv[1];
+	set_compalstage_fullpath(argv[2]);
+
+	open_target_serial();
+	perform_compal_stage(0);
+	tty_passthru();
+	exit(0);
+}