Browse Source

flash_internal: fix page size detection

spark_strober
King Kévin 5 years ago
parent
commit
98a1f05ac6
  1. 2
      lib/flash_internal.c

2
lib/flash_internal.c

@ -93,7 +93,7 @@ bool flash_internal_write(uint32_t address, uint8_t *buffer, size_t size) @@ -93,7 +93,7 @@ bool flash_internal_write(uint32_t address, uint8_t *buffer, size_t size)
// get page size
uint16_t page_size = 0;
if ((0x412==(DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK)) || (0x412==(DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK))) { // low-density (16-32 KB flash) and medium-density (64-128 KB flash) devices have 1 KB flash pages
if ((0x410==(DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK)) || (0x412==(DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK))) { // low-density (16-32 KB flash) and medium-density (64-128 KB flash) devices have 1 KB flash pages
page_size = 1024;
} else if ((0x414==(DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK)) || (0x430==(DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK)) || (0x418==(DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK))) { // high-density (256-512 KB flash), XL-density (768-1024 KB flash) devices and connectivity line have 2 KB flash pages
page_size = 2048;

Loading…
Cancel
Save