From: Justin Mitchell Date: Fri, 7 Feb 2014 10:37:30 +0000 (+0000) Subject: Fix mistake in the verify code, add version string X-Git-Url: http://stoneship.org.uk/projects/git/?a=commitdiff_plain;p=bootloader Fix mistake in the verify code, add version string --- diff --git a/cli/Makefile b/cli/Makefile index 415fa07..1275d46 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -3,7 +3,7 @@ LDFLAGS= $(CFLAGS) SRC=log.c boot.c protocol.c devices.c memory.c -WINDOWS=1 +WINDOWS=0 ifeq ($(WINDOWS),1) PREFIX=i686-w64-mingw32- diff --git a/cli/boot.c b/cli/boot.c index e243d3b..c7da058 100644 --- a/cli/boot.c +++ b/cli/boot.c @@ -11,6 +11,8 @@ #include "devices.h" #include "memory.h" +#define VERSION "Swansea Hackspace PIC Bootloader v1" + #define BAUD_RATE 19200 #ifdef _WIN32 @@ -21,11 +23,12 @@ void usage(const char * name) { - loge("Usage: %s [-b baud] [-p port] [-i] [-v] {file.hex}\n", name); - loge("-b baud Set baudrate (default: %d)\n", BAUD_RATE); - loge("-p port Set serial port (default: %s)\n", PORT_NAME); - loge("-i ID Only mode.\n"); - loge("-v Verify after write\n"); + loge(VERSION); + loge("Usage: %s [-b baud] [-p port] [-i] [-v] {file.hex}", name); + loge("-b baud Set baudrate (default: %d)", BAUD_RATE); + loge("-p port Set serial port (default: %s)", PORT_NAME); + loge("-i ID Only mode."); + loge("-v Verify after write"); } @@ -119,7 +122,7 @@ int update_mem(port_t * pt, const devid_t * dev, uint16_t maxmem, mem_t * ram, i return 1; } print_memory(addr, again, dev->rowsize); - for (int i=0; irowsize; i++) { if (again[i] != buff[i]) { loge("UpdateMem: Verify failed on block 0x%04X", addr); return 1; @@ -174,6 +177,8 @@ int main(int argc, char **argv) if (!idonly && optind >= argc) { loge("Error: missing hexfile"); + loge(""); + usage(argv[0]); return 1; }