X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstm32lx.c;h=61ae57407c08605fae5ec60f2d1855260f6f8944;hp=a475841a3d3685eef01a4417fc3f4c24f81a8a8d;hb=468a4b65ea3c68cffd36918f6b3ea6f44659d336;hpb=f14cf545ebd9de51465332dbfcbce38a45286f98 diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c index a475841a3d..61ae57407c 100644 --- a/src/flash/nor/stm32lx.c +++ b/src/flash/nor/stm32lx.c @@ -122,6 +122,7 @@ static int stm32lx_wait_until_bsy_clear(struct flash_bank *bank); struct stm32lx_flash_bank { int probed; bool has_dual_banks; + uint32_t user_bank_size; }; /* flash bank stm32lx 0 0 @@ -145,6 +146,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32lx_flash_bank_command) stm32lx_info->probed = 0; stm32lx_info->has_dual_banks = false; + stm32lx_info->user_bank_size = bank->size; return ERROR_OK; } @@ -597,8 +599,8 @@ static int stm32lx_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) { - flash_size_in_kb = bank->size / 1024; + if (stm32lx_info->user_bank_size) { + flash_size_in_kb = stm32lx_info->user_bank_size / 1024; LOG_INFO("ignoring flash probed value, using configured bank size: %dkbytes", flash_size_in_kb); }