More STM32L0 devices

Hello,

appended patch adds more STM32L0xx devices and was tested with L031 Nucleo.

Cheers
--
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------
>From fb014dd8a90691056f10fbeffd7f21aaad196662 Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Date: Fri, 27 Jan 2017 23:09:10 +0100
Subject: src/target/stm32l0.c: Add new categories.
This commit is contained in:
Uwe Bonnes 2017-01-30 13:36:50 +01:00 committed by Gareth McMullin
parent 7ba2987a83
commit 41fb2a3104
1 changed files with 29 additions and 8 deletions

View File

@ -87,7 +87,10 @@
#define STM32L0_NVM_PHYS (0x40022000ul)
#define STM32L0_NVM_OPT_SIZE (12)
#define STM32L0_NVM_EEPROM_SIZE (2*1024)
#define STM32L0_NVM_EEPROM_CAT1_SIZE (1*512)
#define STM32L0_NVM_EEPROM_CAT2_SIZE (1*1024)
#define STM32L0_NVM_EEPROM_CAT3_SIZE (2*1024)
#define STM32L0_NVM_EEPROM_CAT5_SIZE (6*1024)
#define STM32L1_NVM_PHYS (0x40023c00ul)
#define STM32L1_NVM_OPT_SIZE (32)
@ -174,8 +177,11 @@ enum {
static bool stm32lx_is_stm32l1(target* t)
{
switch (t->idcode) {
case 0x417: /* STM32L0xx */
return false;
case 0x457: /* STM32L0xx Cat1 */
case 0x425: /* STM32L0xx Cat2 */
case 0x417: /* STM32L0xx Cat3 */
case 0x447: /* STM32L0xx Cat5 */
return false;
default: /* STM32L1xx */
return true;
}
@ -184,8 +190,14 @@ static bool stm32lx_is_stm32l1(target* t)
static uint32_t stm32lx_nvm_eeprom_size(target *t)
{
switch (t->idcode) {
case 0x417: /* STM32L0xx */
return STM32L0_NVM_EEPROM_SIZE;
case 0x457: /* STM32L0xx Cat1 */
return STM32L0_NVM_EEPROM_CAT1_SIZE;
case 0x425: /* STM32L0xx Cat2 */
return STM32L0_NVM_EEPROM_CAT2_SIZE;
case 0x417: /* STM32L0xx Cat3 */
return STM32L0_NVM_EEPROM_CAT3_SIZE;
case 0x447: /* STM32L0xx Cat5 */
return STM32L0_NVM_EEPROM_CAT5_SIZE;
default: /* STM32L1xx */
return STM32L1_NVM_EEPROM_SIZE;
}
@ -194,7 +206,10 @@ static uint32_t stm32lx_nvm_eeprom_size(target *t)
static uint32_t stm32lx_nvm_phys(target *t)
{
switch (t->idcode) {
case 0x417: /* STM32L0xx */
case 0x457: /* STM32L0xx Cat1 */
case 0x425: /* STM32L0xx Cat2 */
case 0x417: /* STM32L0xx Cat3 */
case 0x447: /* STM32L0xx Cat5 */
return STM32L0_NVM_PHYS;
default: /* STM32L1xx */
return STM32L1_NVM_PHYS;
@ -204,7 +219,10 @@ static uint32_t stm32lx_nvm_phys(target *t)
static uint32_t stm32lx_nvm_option_size(target *t)
{
switch (t->idcode) {
case 0x417: /* STM32L0xx */
case 0x457: /* STM32L0xx Cat1 */
case 0x425: /* STM32L0xx Cat2 */
case 0x417: /* STM32L0xx Cat3 */
case 0x447: /* STM32L0xx Cat5 */
return STM32L0_NVM_OPT_SIZE;
default: /* STM32L1xx */
return STM32L1_NVM_OPT_SIZE;
@ -263,7 +281,10 @@ bool stm32l0_probe(target* t)
idcode = target_mem_read32(t, STM32L0_DBGMCU_IDCODE_PHYS) & 0xfff;
switch (idcode) {
case 0x417: /* STM32L0x[123] & probably others */
case 0x457: /* STM32L0xx Cat1 */
case 0x425: /* STM32L0xx Cat2 */
case 0x417: /* STM32L0xx Cat3 */
case 0x447: /* STM32L0xx Cat5 */
t->idcode = idcode;
t->driver = "STM32L0x";
target_add_ram(t, 0x20000000, 0x2000);