|
From: <ge...@op...> - 2019-04-25 00:40:46
|
This is an automated email from Gerrit. Christopher Head (ch...@za...) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/5134 -- gerrit commit 3aa1c8a8268678fcaa3f1ddb085f497ad19bf776 Author: Christopher Head <ch...@za...> Date: Wed Apr 24 17:40:34 2019 -0700 stm32h7x: read/write boot addresses Change-Id: Ib844b3fe951f385c216f3443b8ec28f3707fc5d1 Signed-off-by: Christopher Head <ch...@za...> diff --git a/src/flash/nor/stm32h7x.c b/src/flash/nor/stm32h7x.c index 18ea29d..127d506 100644 --- a/src/flash/nor/stm32h7x.c +++ b/src/flash/nor/stm32h7x.c @@ -43,6 +43,8 @@ #define FLASH_OPTCCR 0x24 #define FLASH_WPSNCUR 0x38 #define FLASH_WPSNPRG 0x3C +#define FLASH_BOOTCUR 0x40 +#define FLASH_BOOTPRG 0x44 /* FLASH_CR register bits */ @@ -106,6 +108,7 @@ struct stm32x_options { uint8_t user_options; uint8_t user2_options; uint8_t user3_options; + uint32_t boot_addr; }; struct stm32h7x_part_info { @@ -338,6 +341,11 @@ static int stm32x_read_options(struct flash_bank *bank) return retval; stm32x_info->option_bytes.protection2 = optiondata & 0xff; + /* read boot addresses */ + retval = target_read_u32(target, FLASH_REG_BASE_B0 + FLASH_BOOTCUR, &stm32x_info->option_bytes.boot_addr); + if (retval != ERROR_OK) + return retval; + return ERROR_OK; } @@ -384,6 +392,11 @@ static int stm32x_write_options(struct flash_bank *bank) if (retval != ERROR_OK) return retval; + /* Program boot addresses */ + retval = target_write_u32(target, FLASH_REG_BASE_B0 + FLASH_BOOTPRG, stm32x_info->option_bytes.boot_addr); + if (retval != ERROR_OK) + return retval; + optiondata = 0x40000000; /* Remove OPT error flag before programming */ retval = target_write_u32(target, FLASH_REG_BASE_B0 + FLASH_OPTCCR, optiondata); -- |