X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstm32lx.c;h=75cecce61e5c923fd8d0fed88a86fff3ea9b19f1;hb=refs%2Fchanges%2F40%2F2040%2F2;hp=b1c8eca5e91727f8c17a599e7da287aa34f3b1c0;hpb=ba2fbe22470915359e1905aaad4c613eacbdf6dc;p=openocd.git diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c index b1c8eca5e9..75cecce61e 100644 --- a/src/flash/nor/stm32lx.c +++ b/src/flash/nor/stm32lx.c @@ -149,6 +149,9 @@ FLASH_BANK_COMMAND_HANDLER(stm32lx_flash_bank_command) stm32lx_info->has_dual_banks = false; stm32lx_info->user_bank_size = bank->size; + /* the stm32l erased value is 0x00 */ + bank->default_padded_value = 0x00; + return ERROR_OK; } @@ -209,7 +212,7 @@ static int stm32lx_protect(struct flash_bank *bank, int set, int first, return ERROR_OK; } -static int stm32lx_write_half_pages(struct flash_bank *bank, uint8_t *buffer, +static int stm32lx_write_half_pages(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; @@ -400,7 +403,7 @@ static int stm32lx_write_half_pages(struct flash_bank *bank, uint8_t *buffer, return retval; } -static int stm32lx_write(struct flash_bank *bank, uint8_t *buffer, +static int stm32lx_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; @@ -550,6 +553,12 @@ static int stm32lx_probe(struct flash_bank *bank) first_bank_size_in_kb = 192; stm32lx_info->has_dual_banks = true; break; + case 0x437: + /* Dual bank, high density */ + max_flash_size_in_kb = 512; + first_bank_size_in_kb = 192; + stm32lx_info->has_dual_banks = true; + break; default: LOG_WARNING("Cannot identify target as a STM32L family."); return ERROR_FAIL; @@ -558,7 +567,8 @@ static int stm32lx_probe(struct flash_bank *bank) /* Get the flash size from target. 0x427 and 0x436 devices use a * different location for the Flash Size register, please see RM0038 r8 or * newer. */ - if ((device_id & 0xfff) == 0x427 || (device_id & 0xfff) == 0x436) + if ((device_id & 0xfff) == 0x427 || (device_id & 0xfff) == 0x436 || + (device_id & 0xfff) == 0x437) retval = target_read_u16(target, F_SIZE_MP, &flash_size_in_kb); else retval = target_read_u16(target, F_SIZE, &flash_size_in_kb); @@ -779,6 +789,10 @@ static int stm32lx_get_info(struct flash_bank *bank, char *buf, int buf_size) } break; + case 0x437: + device_str = "STM32L1xx (Medium+/High Density)"; + break; + default: snprintf(buf, buf_size, "Cannot identify target as a STM32L1"); return ERROR_FAIL;