From 27b3d9c434d359757ba5bcb1517517842bf68f83 Mon Sep 17 00:00:00 2001 From: Szymon Modzelewski Date: Sat, 25 Feb 2012 06:10:04 +0100 Subject: [PATCH] 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 --- src/flash/nor/stm32f1x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.39.5