From 0ed7a9f2b0fbd23e68022289fd42af35535bcb39 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 26 Mar 2011 16:44:53 -0700 Subject: usrp2: fixed serial bootloader for N series --- firmware/zpu/usrp2p/bootloader/init_bootloader.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'firmware') diff --git a/firmware/zpu/usrp2p/bootloader/init_bootloader.c b/firmware/zpu/usrp2p/bootloader/init_bootloader.c index f8b432c46..66481eb25 100644 --- a/firmware/zpu/usrp2p/bootloader/init_bootloader.c +++ b/firmware/zpu/usrp2p/bootloader/init_bootloader.c @@ -37,15 +37,16 @@ void load_ihex(void) { //simple IHEX parser to load proper records into RAM. loa gets(buf); if(!ihex_parse(buf, &ihex_record)) { //RAM data record is valid - if(ihex_record.addr >= RAM_BASE) { //it's expecting to see FULLY RELOCATED IHX RECORDS. every address referenced to 0x8000, including vectors. - memcpy((void *) (ihex_record.addr), ihex_record.data, ihex_record.length); - puts("OK"); - } else if(ihex_record.type == 1) { //end of record + if(ihex_record.type == 1) { //end of record puts("OK"); //load main firmware start_program(); puts("ERROR: main image returned! Back in IHEX load mode."); - } else puts("NOK"); //RAM loads do not support extended segment address records (04) -- upper 16 bits are always "0". + } else { + const uint8_t *destination = (uint8_t *)ihex_record.addr + RAM_BASE; + memcpy((void *) destination, ihex_record.data, ihex_record.length); + puts("OK"); + } } else puts("NOK"); } } -- cgit v1.2.3