[riot-notifications] [RIOT-OS/RIOT] stm32f{2, 4, 7}: Initial flashpage support (#15420)

Francisco notifications at github.com
Fri Jan 29 08:57:05 CET 2021


@fjmolinas commented on this pull request.



>      /* make sure no flash operation is ongoing */
     _wait_for_pending_operations();
 
     DEBUG("[flashpage_raw] write: now writing the data\n");
 #if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F1) || \
     defined(CPU_FAM_STM32F3) || defined(CPU_FAM_STM32L4) || \
     defined(CPU_FAM_STM32WB) || defined(CPU_FAM_STM32G4) || \
-    defined(CPU_FAM_STM32G0) || defined(CPU_FAM_STM32L5)
+    defined(CPU_FAM_STM32G0) || defined(CPU_FAM_STM32L5) || \
+    defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F4) || \
+    defined(CPU_FAM_STM32F7)
     /* set PG bit and program page to flash */
     CNTRL_REG |= FLASH_CR_PG;
 #endif

I can't edit on the line but I had to add this when I implemented flashpage a while ago, not sure why. If I remember correctly it was a cache issue, at that time I had used `DSB` but the following works and is less restrictive.

```diff
diff --git a/cpu/stm32/periph/flashpage.c b/cpu/stm32/periph/flashpage.c
index 18c8d46c56..35c1e6f73b 100644
--- a/cpu/stm32/periph/flashpage.c
+++ b/cpu/stm32/periph/flashpage.c
@@ -259,6 +259,9 @@ void flashpage_write(void *target_addr, const void *data, size_t len)
     for (size_t i = 0; i < (len / sizeof(stm32_flashpage_block_t)); i++) {
         DEBUG("[flashpage_raw] writing %c to %p\n", (char)data_addr[i], dst);
         *dst++ = data_addr[i];
+#if defined(CPU_FAM_STM32F7)
+        __DMB();
+#endif
         /* wait as long as device is busy */
         _wait_for_pending_operations();
     }
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15420#pullrequestreview-579013258
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210128/af58c34e/attachment.htm>


More information about the notifications mailing list