summaryrefslogtreecommitdiff
path: root/src/flash/cfi.c
diff options
context:
space:
mode:
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2006-09-07 17:36:34 +0000
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2006-09-07 17:36:34 +0000
commit3f74f764c7c7b9e22906d2885666d844768c4351 (patch)
tree3cac502e962a6ce1755ab12d57ebaa725d673467 /src/flash/cfi.c
parent028f59ede54917d59f8183e6feac43cb0a6f3546 (diff)
downloadopenocd+libswd-3f74f764c7c7b9e22906d2885666d844768c4351.tar.gz
openocd+libswd-3f74f764c7c7b9e22906d2885666d844768c4351.tar.bz2
openocd+libswd-3f74f764c7c7b9e22906d2885666d844768c4351.tar.xz
openocd+libswd-3f74f764c7c7b9e22906d2885666d844768c4351.zip
- integrated patch from Magnus Lundin that fixes at91sam7 flash timing bugs and possible endianness problems (big endian hosts)
- correctly write trailing bytes on str7x flashes - speed up str7x flash writing by offloading the algorithm to the target git-svn-id: svn://svn.berlios.de/openocd/trunk@95 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/cfi.c')
-rw-r--r--src/flash/cfi.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/flash/cfi.c b/src/flash/cfi.c
index fb3d4cc8..a90093f4 100644
--- a/src/flash/cfi.c
+++ b/src/flash/cfi.c
@@ -1003,11 +1003,11 @@ int cfi_erase_check(struct flash_bank_s *bank)
{
u32 erase_check_code[] =
{
- 0xe4d03001,
- 0xe0022003,
- 0xe2511001,
- 0x1afffffb,
- 0xeafffffe
+ 0xe4d03001, /* ldrb r3, [r0], #1 */
+ 0xe0022003, /* and r2, r2, r3 */
+ 0xe2511001, /* subs r1, r1, #1 */
+ 0x1afffffb, /* b -4 */
+ 0xeafffffe /* b 0 */
};
/* make sure we have a working area */
@@ -1017,8 +1017,13 @@ int cfi_erase_check(struct flash_bank_s *bank)
}
else
{
+ u8 erase_check_code_buf[5 * 4];
+
+ for (i = 0; i < 5; i++)
+ target_buffer_set_u32(target, erase_check_code_buf + (i*4), erase_check_code[i]);
+
/* write algorithm code to working area */
- target->type->write_memory(target, cfi_info->erase_check_algorithm->address, 4, 5, (u8*)erase_check_code);
+ target->type->write_memory(target, cfi_info->erase_check_algorithm->address, 4, 5, erase_check_code_buf);
}
}