From 45eee497d078a2f55abed6587b486d01b63f49fd Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Wed, 14 Dec 2011 22:57:50 +1300 Subject: stm32f4: Improve behaviour when a section doesn't end on a word boundary. This may not be an acceptable fix. It may be possible for the linker to place another section on the remainder of the offending work. --- src/stm32f4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/stm32f4.c') diff --git a/src/stm32f4.c b/src/stm32f4.c index edb45b0..e83daa9 100644 --- a/src/stm32f4.c +++ b/src/stm32f4.c @@ -158,7 +158,7 @@ static int stm32f4_flash_erase(struct target_s *target, uint32_t addr, int len) uint32_t cr; uint32_t pagesize; - addr &= 0x07E00000; + addr &= 0x07FFC000; /* Enable FPEC controller access */ adiv5_ap_mem_write(t->ap, FLASH_KEYR, KEY1); @@ -207,13 +207,13 @@ static int stm32f4_flash_write_words(struct target_s *target, uint32_t dest, uint16_t sr; /* Construct data buffer used by stub */ - data[0] = dest & 0xFFFFFFFE; - data[1] = len & 0xFFFFFFFE; + data[0] = dest & 0xFFFFFFFC; + data[1] = (len + 3) & 0xFFFFFFFC; memcpy(&data[2], src, len); /* Write stub and data to target ram and set PC */ target_mem_write_words(target, 0x20000000, (void*)stm32f4_flash_write_stub, 0x30); - target_mem_write_words(target, 0x20000030, data, len + 8); + target_mem_write_words(target, 0x20000030, data, len + 11); target_pc_write(target, 0x20000000); if(target_check_error(target)) return -1; -- cgit v1.2.3