summaryrefslogtreecommitdiff
path: root/ucoo/hal/self_programming/self_programming.stm32f4.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ucoo/hal/self_programming/self_programming.stm32f4.cc')
-rw-r--r--ucoo/hal/self_programming/self_programming.stm32f4.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/ucoo/hal/self_programming/self_programming.stm32f4.cc b/ucoo/hal/self_programming/self_programming.stm32f4.cc
index 912eb15..3956b1e 100644
--- a/ucoo/hal/self_programming/self_programming.stm32f4.cc
+++ b/ucoo/hal/self_programming/self_programming.stm32f4.cc
@@ -52,6 +52,17 @@ self_programming_flash_size ()
return DESIG_FLASH_SIZE * 1024;
}
+int
+self_programming_erase_size (uint32_t addr)
+{
+ for (int sector = 0; sector < lengthof (sector_addr) - 1; sector++)
+ {
+ if (addr == sector_addr[sector])
+ return sector_addr[sector + 1] - addr;
+ }
+ assert_unreachable ();
+}
+
void
self_programming_erase (uint32_t addr, int count)
{