aboutsummaryrefslogtreecommitdiff
path: root/src/stm32f4.c
diff options
context:
space:
mode:
authorGareth McMullin2012-02-08 20:43:12 +1300
committerGareth McMullin2012-02-08 20:43:12 +1300
commit4282244fb4ddee37d1e8dd7c29947cf3e4e23dcf (patch)
tree43af759d0d831d7ae6830233319d51e2a98fddc4 /src/stm32f4.c
parentb52c62266a5eecf6b98024054f3b1ae39da28755 (diff)
stm32f4: Fixed chunk padding for flash programming.
Diffstat (limited to 'src/stm32f4.c')
-rw-r--r--src/stm32f4.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stm32f4.c b/src/stm32f4.c
index 8a34ac8..b2d3747 100644
--- a/src/stm32f4.c
+++ b/src/stm32f4.c
@@ -100,7 +100,7 @@ uint16_t stm32f4_flash_write_stub[] = {
0x467a, // mov r2, pc
0x3230, // adds r2, #48
0x4b0a, // ldr r3, [pc, #36] // _size
- 0x4d07, // movs r5, #1
+ 0x4d07, // ldr r5, [pc, #28] // _cr
// _next:
0xb153, // cbz r3, _done
0x6105, // str r5, [r0, #16]
@@ -212,7 +212,7 @@ static int stm32f4_flash_write_words(struct target_s *target, uint32_t dest,
data[0] = dest - offset;
data[1] = words * 4; /* length must always be a multiple of 4 */
data[2] = 0xFFFFFFFF; /* pad partial words with all 1s to avoid */
- data[words - 1] = 0xFFFFFFFF; /* damaging overlapping areas */
+ data[words + 1] = 0xFFFFFFFF; /* damaging overlapping areas */
memcpy((uint8_t *)&data[2] + offset, src, len);
/* Write stub and data to target ram and set PC */