This is an automated email from Gerrit.

Olivier Schonken ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/686

-- gerrit

commit 23af27c4bff73250fa3b6edafe6b1ce4502f3388
Author: Olivier Schonken <[email protected]>
Date:   Mon Jun 4 07:33:15 2012 +0200

    Changed SAM4S Erase for effective Sector erase
    
    In the previous iteration, the page counter for erases would not be updated 
with
    the erase size.  This patch keeps the page counter synced with the sector 
counter.
    
    Signed-off-by: Olivier Schonken <[email protected]>
    Change-Id: I95e56a3257b2ad8301c9f28167b842fa6466334f

diff --git a/src/flash/nor/at91sam4.c b/src/flash/nor/at91sam4.c
index c009a13..ed66bd4 100644
--- a/src/flash/nor/at91sam4.c
+++ b/src/flash/nor/at91sam4.c
@@ -1678,6 +1678,8 @@ static int sam4_erase(struct flash_bank *bank, int first, 
int last)
        struct sam4_bank_private *pPrivate;
        int r;
        int i;
+       /*16 pages equals 8KB - Same size as a lock region*/
+       int PageCount = 16;
        uint32_t status;
 
        LOG_DEBUG("Here");
@@ -1705,7 +1707,7 @@ static int sam4_erase(struct flash_bank *bank, int first, 
int last)
        LOG_INFO("sam4 First: 0x%08x Last: 0x%08x", (unsigned int)(first), 
(unsigned int)(last));
        for (i = first; i <= last; i++) {
                /*16 pages equals 8KB - Same size as a lock region*/
-               r = FLASHD_ErasePages(pPrivate, i, 16, &status);
+               r = FLASHD_ErasePages(pPrivate, (i * pageCount), PageCount, 
&status);
                LOG_INFO("Erasing sector: 0x%08x", (unsigned int)(i));
                if (r != ERROR_OK)
                        LOG_ERROR("SAM4: Error performing Erase page @ lock 
region number %d",
@@ -1718,6 +1720,7 @@ static int sam4_erase(struct flash_bank *bank, int first, 
int last)
                        LOG_ERROR("SAM4: Flash Command error @lock region %d", 
(unsigned int)(i));
                        return ERROR_FAIL;
                }
+       
        }
 
        return ERROR_OK;

-- 

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to