Refactor stm32f1_probe

This commit is contained in:
Richard Meadows 2015-07-30 07:58:55 +01:00
parent 101821ae31
commit beacf9c85c
1 changed files with 8 additions and 14 deletions

View File

@ -161,22 +161,16 @@ bool stm32f1_probe(target *t)
t->driver = "STM32F09";
block_size = 0x800;
break;
}
switch(t->idcode) {
case 0x444: /* STM32F03 RM0091 Rev.7 */
case 0x445: /* STM32F04 RM0091 Rev.7 */
case 0x440: /* STM32F05 RM0091 Rev.7 */
case 0x448: /* STM32F07 RM0091 Rev.7 */
case 0x442: /* STM32F09 RM0091 Rev.7 */
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, block_size);
target_add_commands(t, stm32f1_cmd_list, "STM32F0");
return true;
default: /* NONE */
return false;
}
return false;
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, block_size);
target_add_commands(t, stm32f1_cmd_list, "STM32F0");
return true;
}
static void stm32f1_flash_unlock(target *t)