This is an automated email from Gerrit.

Chuen Chou (zhouqua...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/806

-- gerrit

commit ff2999e8c94efa4be836ddd8c1761f7eceac7013
Author: Chuen Chou <zhouqua...@gmail.com>
Date:   Sun Sep 2 00:45:15 2012 -0700

    flash: fix sam3 page read/write address computation error
    
    In at91sam3.c for Atmel SAM3 flash support, there are arithmetic errors in 
the functions sam3_page_read() and sam3_page_write().
    Address locations are computed incorrectly due to an extra addition 
operation. This leads to memory locations being skipped during
    flash writes and reads.
    
    Smaller programs are written successfully into flash, with memory gaps, 
while larger programs of legitimate size fail because the
    skipped memory is not utilized and therefore unavailable.
    
    The changes address this condition, and have been tested with an Atmel 
SAM3X-EK evaluation board.
    
    Change-Id: I9ea3b9ed0130b71cbc32b2294e31a6a2bc71b47a
    Signed-off-by: Chuen Chou <zhouqua...@gmail.com>

diff --git a/src/flash/nor/at91sam3.c b/src/flash/nor/at91sam3.c
index 7dbfa24..de792ec 100644
--- a/src/flash/nor/at91sam3.c
+++ b/src/flash/nor/at91sam3.c
@@ -3018,7 +3018,7 @@ static int sam3_page_read(struct sam3_bank_private 
*pPrivate, unsigned pagenum,
        int r;
 
        adr = pagenum * pPrivate->page_size;
-       adr += adr + pPrivate->base_address;
+       adr += pPrivate->base_address;
 
        r = target_read_memory(pPrivate->pChip->target,
                        adr,
@@ -3126,7 +3126,7 @@ static int sam3_page_write(struct sam3_bank_private 
*pPrivate, unsigned pagenum,
        int r;
 
        adr = pagenum * pPrivate->page_size;
-       adr += (adr + pPrivate->base_address);
+       adr += pPrivate->base_address;
 
        /* Get flash mode register value */
        r = target_read_u32(pPrivate->pChip->target, 
pPrivate->controller_address, &fmr);

-- 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to