X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fbootloader%2Fmain.c;h=5db7a6dd1379ce8f1dfabf927e5ea12516b59245;hp=8595d720f9150546478728fe49774d2a4c740622;hb=986ff39dffeea63e2b344a099e8075ae5a5f404e;hpb=277ae0b9f47b10a877a0a0a405bfdd5dd4421782 diff --git a/projects/microb2010/bootloader/main.c b/projects/microb2010/bootloader/main.c index 8595d72..5db7a6d 100755 --- a/projects/microb2010/bootloader/main.c +++ b/projects/microb2010/bootloader/main.c @@ -1,7 +1,7 @@ -/* +/* * Copyright Droids Corporation * Olivier Matz - * + * * 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 @@ -115,16 +115,16 @@ #endif -static char uart_recv(void) -{ - while ( !(UCSRxA & (1<= '0' && c <= '9') { tmp <<= 4; tmp += (c - '0'); - } + } else if (c >= 'a' && c <= 'f') { tmp <<= 4; tmp += (c - 'a' + 10); - } + } else if (c >= 'A' && c <= 'F') { tmp <<= 4; tmp += (c - 'A' + 10); - } + } else return -1; } @@ -194,6 +194,12 @@ static void disp_hex16(uint16_t x) disp_hex8(x); } +static void disp_hex32(uint32_t x) +{ + disp_hex16(x>>16); + disp_hex16(x); +} + static void crc_app(void) { uint32_t start_addr, addr, size; @@ -243,7 +249,7 @@ static void read32(void) val <<= 8; val |= c; } - disp_hex16(val); + disp_hex32(val); return; fail: uart_puts("KO"); @@ -291,22 +297,22 @@ static void prog_page(void) eeprom_busy_wait(); boot_page_erase(addr); boot_spm_busy_wait(); - + /* Set up little-endian word and fill tmp buf. */ for (i=0; i