X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstm32f2x.c;h=aa749a510a1228819dfbbd47266b6090b4aa273d;hb=ece28927017614a20b80fdc203584ca919f81878;hp=1d59e3c02c979fac920f0d58b08b5480fcb32313;hpb=bd5df8520b5d1755c8c8a86a0f64d3aa452729ca;p=openocd.git diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c index 1d59e3c02c..aa749a510a 100644 --- a/src/flash/nor/stm32f2x.c +++ b/src/flash/nor/stm32f2x.c @@ -158,6 +158,7 @@ struct stm32x_flash_bank { struct stm32x_options option_bytes; int probed; bool has_large_mem; /* stm32f42x/stm32f43x family */ + uint32_t user_bank_size; }; /* flash bank stm32x 0 0 @@ -173,6 +174,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command) bank->driver_priv = stm32x_info; stm32x_info->probed = 0; + stm32x_info->user_bank_size = bank->size; return ERROR_OK; } @@ -793,9 +795,9 @@ static int stm32x_probe(struct flash_bank *bank) /* if the user sets the size manually then ignore the probed value * this allows us to work around devices that have a invalid flash size register value */ - if (bank->size) { + if (stm32x_info->user_bank_size) { LOG_INFO("ignoring flash probed value, using configured bank size"); - flash_size_in_kb = bank->size / 1024; + flash_size_in_kb = stm32x_info->user_bank_size / 1024; } LOG_INFO("flash size = %dkbytes", flash_size_in_kb);