STM32f0: F07 and F09 have 2kiByte blocksize.

This commit is contained in:
Uwe Bonnes 2015-06-22 10:02:17 +02:00 committed by Martin Knoll
parent 09544bc710
commit a7f6753153
1 changed files with 6 additions and 2 deletions

View File

@ -114,6 +114,7 @@ static void stm32f1_add_flash(target *t,
bool stm32f1_probe(target *t)
{
size_t flash_size;
size_t block_size = 0x400;
t->idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0xfff;
switch(t->idcode) {
case 0x410: /* Medium density */
@ -154,15 +155,18 @@ bool stm32f1_probe(target *t)
break;
case 0x448: /* STM32F07 RM0091 Rev.7 */
t->driver = "STM32F07";
block_size = 0x800;
break;
case 0x442: /* STM32F09 RM0091 Rev.7 */
t->driver = "STM32F09";
block_size = 0x800;
break;
}
if (t->driver) {
flash_size = target_mem_read32(t, FLASHSIZE_F0) *0x400;
flash_size = (target_mem_read32(t, FLASHSIZE_F0) & 0xffff) *0x400;
gdb_outf("flash size %d block_size %d\n", flash_size, block_size);
target_add_ram(t, 0x20000000, 0x5000);
stm32f1_add_flash(t, 0x8000000, flash_size, 0x400);
stm32f1_add_flash(t, 0x8000000, flash_size, block_size);
target_add_commands(t, stm32f1_cmd_list, "STM32F0");
return true;
}