X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstm32f2x.c;h=422eac1b4f28f3cf4b4fb67044497c16e72c264c;hp=8f35845b4516caf2230d64fd9cec2866be08b6f6;hb=9d745a0690f6f5c24d914ebfa3c1d6b824a19a5e;hpb=de16280e0256f53fdddddc59f6797512afe6f009 diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c index 8f35845b45..422eac1b4f 100644 --- a/src/flash/nor/stm32f2x.c +++ b/src/flash/nor/stm32f2x.c @@ -344,8 +344,8 @@ static int stm32x_write_options(struct flash_bank *bank) /* rebuild option data */ optiondata = stm32x_info->option_bytes.user_options; - buf_set_u32(&optiondata, 8, 8, stm32x_info->option_bytes.RDP); - buf_set_u32(&optiondata, 16, 12, stm32x_info->option_bytes.protection); + optiondata |= stm32x_info->option_bytes.RDP << 8; + optiondata |= (stm32x_info->option_bytes.protection & 0x0fff) << 16; /* program options */ retval = target_write_u32(target, STM32_FLASH_OPTCR, optiondata); @@ -355,7 +355,7 @@ static int stm32x_write_options(struct flash_bank *bank) if (stm32x_info->has_large_mem) { uint32_t optiondata2 = 0; - buf_set_u32(&optiondata2, 16, 12, stm32x_info->option_bytes.protection >> 12); + optiondata2 |= (stm32x_info->option_bytes.protection & 0x00fff000) << 4; retval = target_write_u32(target, STM32_FLASH_OPTCR1, optiondata2); if (retval != ERROR_OK) return retval;