summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorRolf Meeser <rolfm_9dq@yahoo.de>2010-12-03 14:06:11 +0100
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-12-04 09:35:33 +0100
commitf2a1b7f3afd24da9bb58c0575cf0be3d7ab75988 (patch)
treef7fea42f2f74584c130a72af8bf6963361b25f33 /src/flash
parent0ac6c0d1a8ff35d2022f11fd0ab057c82c12157b (diff)
downloadopenocd_libswd-f2a1b7f3afd24da9bb58c0575cf0be3d7ab75988.tar.gz
openocd_libswd-f2a1b7f3afd24da9bb58c0575cf0be3d7ab75988.tar.bz2
openocd_libswd-f2a1b7f3afd24da9bb58c0575cf0be3d7ab75988.tar.xz
openocd_libswd-f2a1b7f3afd24da9bb58c0575cf0be3d7ab75988.zip
Fix sector layout for 504-KiB LPC2000 devices
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/nor/lpc2000.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/flash/nor/lpc2000.c b/src/flash/nor/lpc2000.c
index 14d0e44d..fea663e9 100644
--- a/src/flash/nor/lpc2000.c
+++ b/src/flash/nor/lpc2000.c
@@ -196,10 +196,13 @@ static int lpc2000_build_sector_list(struct flash_bank *bank)
case 256 * 1024:
bank->num_sectors = 15;
break;
- case 512 * 1024:
case 500 * 1024:
bank->num_sectors = 27;
break;
+ case 512 * 1024:
+ case 504 * 1024:
+ bank->num_sectors = 28;
+ break;
default:
LOG_ERROR("BUG: unknown bank->size encountered");
exit(-1);
@@ -210,7 +213,7 @@ static int lpc2000_build_sector_list(struct flash_bank *bank)
for (i = 0; i < bank->num_sectors; i++)
{
- if ((i >= 0) && (i < 8))
+ if (i < 8)
{
bank->sectors[i].offset = offset;
bank->sectors[i].size = 4 * 1024;
@@ -218,7 +221,7 @@ static int lpc2000_build_sector_list(struct flash_bank *bank)
bank->sectors[i].is_erased = -1;
bank->sectors[i].is_protected = 1;
}
- if ((i >= 8) && (i < 22))
+ else if (i < 22)
{
bank->sectors[i].offset = offset;
bank->sectors[i].size = 32 * 1024;
@@ -226,7 +229,7 @@ static int lpc2000_build_sector_list(struct flash_bank *bank)
bank->sectors[i].is_erased = -1;
bank->sectors[i].is_protected = 1;
}
- if ((i >= 22) && (i < 27))
+ else if (i < 28)
{
bank->sectors[i].offset = offset;
bank->sectors[i].size = 4 * 1024;