X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstm32f2x.c;h=8127f13343cfaae726933ff93b29f31a526f4c4b;hp=0e4abb533c6ff672f50a20d752e64be57c957120;hb=90a6245eecd82c95112c09700cfebcf2403d0478;hpb=7719e9618e753ac41a46a2488dfba549ac578891 diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c index 0e4abb533c..8127f13343 100644 --- a/src/flash/nor/stm32f2x.c +++ b/src/flash/nor/stm32f2x.c @@ -1047,7 +1047,8 @@ static int stm32x_probe(struct flash_bank *bank) if (device_id == 0x451) { for (i = 0; i < num_prot_blocks; i++) { bank->prot_blocks[i].offset = bank->sectors[i << 1].offset; - bank->prot_blocks[i].size = bank->sectors[i << 1].size << 1; + bank->prot_blocks[i].size = bank->sectors[i << 1].size + + bank->sectors[(i << 1) + 1].size; } } } else { @@ -1321,7 +1322,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command) * this will also force a device unlock if set */ stm32x_info->option_bytes.RDP = 0xAA; if (stm32x_info->has_optcr2_pcrop) { - stm32x_info->option_bytes.optcr2_pcrop = OPTCR2_PCROP_RDP | (~1 << bank->num_sectors); + stm32x_info->option_bytes.optcr2_pcrop = OPTCR2_PCROP_RDP | (~1U << bank->num_sectors); } if (stm32x_write_options(bank) != ERROR_OK) {