From 176952e7368b63440bad3e4ec58e3e814bdffc6d Mon Sep 17 00:00:00 2001 From: Justin Mitchell Date: Fri, 27 Sep 2013 17:29:21 +0100 Subject: [PATCH] Remove the test program, and the unnecessary time delay --- cli/Makefile | 6 ++--- cli/boot.c | 1 - cli/test.c | 75 ------------------------------------------------------------ 3 files changed, 2 insertions(+), 80 deletions(-) delete mode 100644 cli/test.c diff --git a/cli/Makefile b/cli/Makefile index 08de8b6..3615658 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -5,9 +5,7 @@ SRC=serial.c log.c boot.c protocol.c devices.c memory.c OBJS=$(SRC:%.c=%.o) -all: boot test - -test: test.o +all: boot boot: $(OBJS) @@ -15,5 +13,5 @@ boot: $(OBJS) $(CC) $(CFLAGS) -c -o $@ $< clean: - rm -f $(OBJS) boot test + rm -f $(OBJS) boot diff --git a/cli/boot.c b/cli/boot.c index 564bfbf..7a3e26e 100644 --- a/cli/boot.c +++ b/cli/boot.c @@ -109,7 +109,6 @@ int update_mem(port_t * pt, const devid_t * dev, uint16_t maxmem, mem_t * ram, i if (verify) { uint8_t again[1024]; - sleep(1); logd("UpdateMem: Verify %d words @ %04x", dev->rowsize, addr); if (loader_readmem(pt, addr, again, dev->rowsize)) { loge("UpdateMem: Aborting on failed read"); diff --git a/cli/test.c b/cli/test.c deleted file mode 100644 index d7d72ea..0000000 --- a/cli/test.c +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#include -#include - -/* return 0 for end of file. -1 for error */ -int parse_ihex16(const char *line, uint8_t *bytes, int *addr, int *code) -{ - unsigned int sum, len, cksum; - unsigned int laddr, lcode; - int i; - const char *p; - - if (line[0] != ':') return -1; - if (strlen(line) < 11) return -1; - p = &line[1]; - if (!sscanf(p, "%02x", &len)) return -1; - p+=2; - if (strlen(line) < (11 + (len * 2))) return -1; - if (!sscanf(p, "%04x", &laddr)) return -1; - p += 4; - *addr = laddr; // little endian address record - if (!sscanf(p, "%02x", &lcode)) return -1; - p+=2; - *code = lcode & 0xFF; - - /* end of file record */ - if (*code == 1) return 0; - - sum = (len & 0xFF) + ((*addr >> 8) & 0xFF) + (*addr & 0xFF) + (*code & 0xFF); - - i = 0; - while (i < len) { - unsigned int byte; - if (!sscanf(p, "%02x", &byte)) return -1; - bytes[i++] = byte & 0xFF; - sum += byte & 0xFF; - p += 2; - } - if (!sscanf(p, "%02x", &cksum)) return -1; - if ( ((sum & 0xFF) + (cksum & 0xFF)) & 0xFF ) return -1; - return len; -} - -int main(int argc, char **argv) -{ - FILE *in; - - if (argc < 2) return 1; - - if ((in=fopen(argv[1], "r"))==NULL) { - fprintf(stderr, "Failed opening %s: %s\n", argv[1], strerror(errno)); - return 1; - } - - char buff[1024]; - - while (!feof(in) && fgets(buff, sizeof(buff), in)!=NULL) { - if (buff[0] == '#') continue; - - unsigned char bytes[80]; - int len, addr, code; - - if ((len=parse_ihex16(buff, bytes, &addr, &code)) <= 0) { - if (len < 0) fprintf(stderr, "Bad line: %s\n", buff); - continue; - } - - printf("Addr: %04X +%2d code=%d :", addr, len, code); - for (int i=0; i