static int stm32x_mass_erase(struct flash_bank *bank);
static int stm32x_get_device_id(struct flash_bank *bank, uint32_t *device_id);
-static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer,
+static int stm32x_write_block(struct flash_bank *bank, const uint8_t *buffer,
uint32_t offset, uint32_t count);
/* flash bank stm32x <base> <size> 0 0 <target#>
return stm32x_write_options(bank);
}
-static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer,
+static int stm32x_write_block(struct flash_bank *bank, const uint8_t *buffer,
uint32_t offset, uint32_t count)
{
struct stm32x_flash_bank *stm32x_info = bank->driver_priv;
return retval;
}
-static int stm32x_write(struct flash_bank *bank, uint8_t *buffer,
+static int stm32x_write(struct flash_bank *bank, const uint8_t *buffer,
uint32_t offset, uint32_t count)
{
struct target *target = bank->target;
}
LOG_INFO("odd number of bytes to write, padding with 0xff");
buffer = memcpy(new_buffer, buffer, count);
- buffer[count++] = 0xff;
+ new_buffer[count++] = 0xff;
}
uint32_t words_remaining = count / 2;
stm32x_info->option_offset = 6;
stm32x_info->default_rdp = 0x55AA;
break;
- case 0x440: /* stm32f0x */
- case 0x444:
+ case 0x440: /* stm32f05x */
+ case 0x444: /* stm32f03x */
page_size = 1024;
stm32x_info->ppage_size = 4;
max_flash_size_in_kb = 64;
stm32x_info->option_offset = 6;
stm32x_info->default_rdp = 0x55AA;
break;
+ case 0x448: /* stm32f07x */
+ page_size = 2048;
+ stm32x_info->ppage_size = 4;
+ max_flash_size_in_kb = 128;
+ stm32x_info->user_data_offset = 16;
+ stm32x_info->option_offset = 6;
+ stm32x_info->default_rdp = 0x55AA;
+ break;
default:
LOG_WARNING("Cannot identify target as a STM32 family.");
return ERROR_FAIL;
}
break;
- case 0x440:
case 0x444:
- device_str = "STM32F0xx";
+ device_str = "STM32F03x";
+
+ switch (rev_id) {
+ case 0x1000:
+ rev_str = "1.0";
+ break;
+
+ case 0x2000:
+ rev_str = "2.0";
+ break;
+ }
+ break;
+
+ case 0x440:
+ device_str = "STM32F05x";
+
+ switch (rev_id) {
+ case 0x1000:
+ rev_str = "1.0";
+ break;
+
+ case 0x2000:
+ rev_str = "2.0";
+ break;
+ }
+ break;
+
+ case 0x448:
+ device_str = "STM32F07x";
switch (rev_id) {
case 0x1000:
else if (strcmp("HWWDG", CMD_ARGV[0]) == 0)
optionbyte &= ~(1 << 0);
else if (strcmp("NORSTSTOP", CMD_ARGV[0]) == 0)
- optionbyte &= ~(1 << 1);
- else if (strcmp("RSTSTNDBY", CMD_ARGV[0]) == 0)
+ optionbyte |= (1 << 1);
+ else if (strcmp("RSTSTOP", CMD_ARGV[0]) == 0)
optionbyte &= ~(1 << 1);
else if (strcmp("NORSTSTNDBY", CMD_ARGV[0]) == 0)
- optionbyte &= ~(1 << 2);
- else if (strcmp("RSTSTOP", CMD_ARGV[0]) == 0)
+ optionbyte |= (1 << 2);
+ else if (strcmp("RSTSTNDBY", CMD_ARGV[0]) == 0)
optionbyte &= ~(1 << 2);
else if (stm32x_info->has_dual_banks) {
if (strcmp("BOOT0", CMD_ARGV[0]) == 0)