]> git.sur5r.net Git - openocd/commitdiff
flash: stm32f1x: add a couple missing stm32x_get_flash_reg
authorSzymon Modzelewski <szmodzelewski@gmail.com>
Sat, 25 Feb 2012 05:10:04 +0000 (06:10 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Tue, 6 Mar 2012 13:33:54 +0000 (13:33 +0000)
Change-Id: I163de2c1bd962e7ea9ca6c741c1c62224c210677
Signed-off-by: Szymon Modzelewski <szmodzelewski@gmail.com>
Reviewed-on: http://openocd.zylin.com/486
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/flash/nor/stm32f1x.c

index f735a7d2e859dbaf292c865eba9ddba5c09b1f65..e9c2fb978cfa1f6fed460447de55c004b6ecb2c7 100644 (file)
@@ -701,13 +701,13 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer,
                if (buf_get_u32(reg_params[0].value, 0, 32) & FLASH_PGERR) {
                        LOG_ERROR("flash memory not erased before writing");
                        /* Clear but report errors */
-                       target_write_u32(target, STM32_FLASH_SR_B0, FLASH_PGERR);
+                       target_write_u32(target, stm32x_get_flash_reg(bank, STM32_FLASH_SR), FLASH_PGERR);
                }
 
                if (buf_get_u32(reg_params[0].value, 0, 32) & FLASH_WRPRTERR) {
                        LOG_ERROR("flash memory write protected");
                        /* Clear but report errors */
-                       target_write_u32(target, STM32_FLASH_SR_B0, FLASH_WRPRTERR);
+                       target_write_u32(target, stm32x_get_flash_reg(bank, STM32_FLASH_SR), FLASH_WRPRTERR);
                }
        }
 
@@ -807,7 +807,7 @@ static int stm32x_write(struct flash_bank *bank, uint8_t *buffer,
                        return retval;
        }
 
-       return target_write_u32(target, STM32_FLASH_CR_B0, FLASH_LOCK);
+       return target_write_u32(target, stm32x_get_flash_reg(bank, STM32_FLASH_CR), FLASH_LOCK);
 }
 
 static int stm32x_get_device_id(struct flash_bank *bank, uint32_t *device_id)