From: Szymon Modzelewski Date: Sat, 25 Feb 2012 05:10:04 +0000 (+0100) Subject: flash: stm32f1x: add a couple missing stm32x_get_flash_reg X-Git-Tag: v0.6.0-rc1~199 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=27b3d9c434d359757ba5bcb1517517842bf68f83;p=openocd flash: stm32f1x: add a couple missing stm32x_get_flash_reg Change-Id: I163de2c1bd962e7ea9ca6c741c1c62224c210677 Signed-off-by: Szymon Modzelewski Reviewed-on: http://openocd.zylin.com/486 Tested-by: jenkins Reviewed-by: Andreas Fritiofson Reviewed-by: Spencer Oliver --- diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c index f735a7d2..e9c2fb97 100644 --- a/src/flash/nor/stm32f1x.c +++ b/src/flash/nor/stm32f1x.c @@ -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)