From 986ff39dffeea63e2b344a099e8075ae5a5f404e Mon Sep 17 00:00:00 2001 From: zer0 Date: Mon, 5 Apr 2010 14:08:42 +0200 Subject: [PATCH] bootloader --- projects/microb2010/bootloader/.config | 7 +++-- projects/microb2010/bootloader/main.c | 42 +++++++++++++++----------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/projects/microb2010/bootloader/.config b/projects/microb2010/bootloader/.config index b70ba89..e9f4820 100644 --- a/projects/microb2010/bootloader/.config +++ b/projects/microb2010/bootloader/.config @@ -82,8 +82,9 @@ CONFIG_FORMAT_IHEX=y # CONFIG_MODULE_FIXED_POINT is not set # CONFIG_MODULE_VECT2 is not set # CONFIG_MODULE_GEOMETRY is not set -# CONFIG_MODULE_GEOMETRY_CREATE_CONFIG is not set +# CONFIG_MODULE_HOSTSIM is not set # CONFIG_MODULE_SCHEDULER is not set +# CONFIG_MODULE_SCHEDULER_STATS is not set # CONFIG_MODULE_SCHEDULER_CREATE_CONFIG is not set # CONFIG_MODULE_SCHEDULER_USE_TIMERS is not set CONFIG_MODULE_SCHEDULER_TIMER0=y @@ -168,11 +169,13 @@ CONFIG_MODULE_SCHEDULER_TIMER0=y # CONFIG_MODULE_ENCODERS_SPI_CREATE_CONFIG is not set # -# Robot specific modules +# Robot specific modules (fixed point lib may be needed) # # CONFIG_MODULE_ROBOT_SYSTEM is not set +# CONFIG_MODULE_ROBOT_SYSTEM_USE_F64 is not set # CONFIG_MODULE_ROBOT_SYSTEM_MOT_AND_EXT is not set # CONFIG_MODULE_POSITION_MANAGER is not set +# CONFIG_MODULE_COMPENSATE_CENTRIFUGAL_FORCE is not set # CONFIG_MODULE_TRAJECTORY_MANAGER is not set # CONFIG_MODULE_BLOCKING_DETECTION_MANAGER is not set # CONFIG_MODULE_OBSTACLE_AVOIDANCE is not set 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