Skip to content

Commit 122e126

Browse files
karlpBOJIT
authored andcommitted
stm32l1: desig: handle flash size footnotes from refman
Some of the chipid variants have some footnotes on reading the flash size register, make sure we report things nicely.
1 parent f751db1 commit 122e126

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/stm32/l1/desig.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,20 @@
2323

2424
uint16_t desig_get_flash_size(void)
2525
{
26+
uint32_t v;
2627
uint32_t device_id = DBGMCU_IDCODE & DBGMCU_IDCODE_DEV_ID_MASK;
2728
switch (device_id) {
2829
case 0x416:
29-
case 0x429:
3030
return *(uint32_t*)DESIG_FLASH_SIZE_BASE_CAT12;
31+
case 0x429:
32+
v = *(uint32_t*)DESIG_FLASH_SIZE_BASE_CAT12;
33+
return v & 0xff;
3134
case 0x427:
32-
case 0x436:
3335
case 0x437:
3436
return *(uint32_t*)DESIG_FLASH_SIZE_BASE_CAT3456;
37+
case 0x436:
38+
v = *(uint32_t*)DESIG_FLASH_SIZE_BASE_CAT3456;
39+
return v ? 256 : 384;
3540
}
3641

3742
cm3_assert_not_reached();

0 commit comments

Comments
 (0)