diff loadtools/romload.c @ 10:e2e80a09338e

fc-sertool actually works; output from loadagent is visible!
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Wed, 01 May 2013 03:41:42 +0000
parents fea204bc7674
children 24b88c119465
line wrap: on
line diff
--- a/loadtools/romload.c	Wed May 01 02:43:17 2013 +0000
+++ b/loadtools/romload.c	Wed May 01 03:41:42 2013 +0000
@@ -120,7 +120,7 @@
 	sum = iramimage.datalen + 5;
 	llen = iramimage.datalen + 4;
 	for (i = 0; i < llen; i++)
-		sum = iramimage.record[i+1];
+		sum += iramimage.record[i+1];
 	return sum;
 }
 
@@ -160,7 +160,7 @@
 	tcflush(target_fd, TCIFLUSH);
 
 	image_cksum = 0;
-	for (rec_count = 0; ; rec_count++) {
+	for (rec_count = 0; ; ) {
 		if (read_s_record(&iramimage) < 0)
 			exit(1);
 		switch (iramimage.record_type) {
@@ -200,7 +200,7 @@
 		write(target_fd, write_cmd, sizeof write_cmd);
 		write(target_fd, iramimage.record + 5, iramimage.datalen);
 		/* update our checksum accumulator */
-		image_cksum += ~(compute_block_cksum() & 0xFF);
+		image_cksum += ~compute_block_cksum() & 0xFF;
 		/* collect response */
 		resp = expect_response(INTERMEDIATE_TIMEOUT);
 		if (resp != 'w') {
@@ -217,7 +217,9 @@
 					resp);
 			exit(1);
 		}
-		/* on to the next record! */
+		putchar('.');
+		fflush(stdout);
+		rec_count++;
 	}
 	/* got S7 */
 	fclose(iramimage.openfile);
@@ -230,7 +232,7 @@
 
 	/* send <c */
 	printf("Sending checksum\n");
-	cksum_cmd[2] = ~(image_cksum & 0xFF);
+	cksum_cmd[2] = ~image_cksum & 0xFF;
 	write(target_fd, cksum_cmd, sizeof cksum_cmd);
 	resp = expect_response(INTERMEDIATE_TIMEOUT);
 	if (resp != 'c') {