Modified Sector Erase for AT91SAM4S
authorOlivier Schonken <olivier.schonken@gmail.com>
Wed, 12 Sep 2012 19:56:50 +0000 (21:56 +0200)
committerSpencer Oliver <spen@spen-soft.co.uk>
Thu, 4 Oct 2012 15:53:19 +0000 (15:53 +0000)
In FLASHD_ErasePages AT91C_EFC_FCMD_EPA is used to erase sectors.
According to the datasheet FARG[15:2] defines the page from which
the erase will start.This page must be modulo 4, 8, 16 or 32
according to the number of pages to erase. FARG[1:0] defines the
number of pages to be erased. Previously (firstpage << 2) was used
to conform to this, seems it should not be shifted... Changed it
to (firstPage) | erasePages.

Change-Id: I791cc7fc4faf056623ad5a6c7e860315306098a1
Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-on: http://openocd.zylin.com/830
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/flash/nor/at91sam4.c

index fd98b7f0da850370e77d91add82cb5ce4d0e78f4..ce3c1d137d2380fea494e9c9a60438841da87799 100644 (file)
@@ -722,10 +722,17 @@ static int FLASHD_ErasePages(struct sam4_bank_private *pPrivate,
                        break;
        }
 
+       /* AT91C_EFC_FCMD_EPA
+        * According to the datasheet FARG[15:2] defines the page from which
+        * the erase will start.This page must be modulo 4, 8, 16 or 32
+        * according to the number of pages to erase. FARG[1:0] defines the
+        * number of pages to be erased. Previously (firstpage << 2) was used
+        * to conform to this, seems it should not be shifted...
+        */
        return EFC_PerformCommand(pPrivate,
                /* send Erase Page */
                AT91C_EFC_FCMD_EPA,
-               (firstPage << 2) | erasePages,
+               (firstPage) | erasePages,
                status);
 }
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)