fix protection behavior
authorRodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Fri, 10 Jun 2011 19:23:52 +0000 (12:23 -0700)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Sun, 12 Jun 2011 09:18:27 +0000 (11:18 +0200)
src/flash/nor/dsp5680xx_flash.c

index 9fa7b06fe35c6789bbc5aed3de2867dec0a9f7fb..b919f5647e7971a585510c0f23cd6b1bc7962122 100644 (file)
@@ -96,18 +96,10 @@ static int dsp5680xx_flash_protect_check(struct flash_bank *bank){
 static int dsp5680xx_flash_protect(struct flash_bank *bank, int set, int first, int last){
   // This applies security to flash module after next reset, it does not actually apply protection (protection refers to undesired access from the core)
   int retval;
-  if(set){
+  if(set)
     retval = dsp5680xx_f_lock(bank->target);
-    if(retval == ERROR_OK){
-      for(int i = first;i<last;i++)
-       bank->sectors[i].is_protected = 1;
-    }
-  }else{
+  else
     retval = dsp5680xx_f_unlock(bank->target);
-    if(retval == ERROR_OK)
-      for(int i = first;i<last;i++)
-       bank->sectors[i].is_protected = 0;
-  }
   return retval;
 }
 
@@ -140,10 +132,13 @@ static int dsp5680xx_flash_write(struct flash_bank *bank, uint8_t *buffer, uint3
     return ERROR_FAIL;
   }
   retval = dsp5680xx_f_wr(bank->target,  buffer, bank->base + offset/2,  count);
-  if(retval == ERROR_OK)
-    bank->sectors[0].is_erased = 0;
-  else
-    bank->sectors[0].is_erased = -1;
+  uint32_t addr_word;
+  for(addr_word = bank->base + offset/2;addr_word<count/2;addr_word+=(HFM_SECTOR_SIZE/2)){
+    if(retval == ERROR_OK)
+      bank->sectors[addr_word/(HFM_SECTOR_SIZE/2)].is_erased = 0;
+    else
+      bank->sectors[addr_word/(HFM_SECTOR_SIZE/2)].is_erased = -1;
+  }
   return retval;
 }
 

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)