From f28e7a9b01419d79d8bdbc35f5e9b7ca723c1a75 Mon Sep 17 00:00:00 2001
From: Vincent Dupont <vincent@otakeys.com>
Date: Mon, 9 Jul 2018 10:31:28 +0200
Subject: [PATCH] cpu/stm32l0: use STM32_FLASHSIZE to generate FLASHPAGE_NUMOF

---
 cpu/stm32l0/include/cpu_conf.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/cpu/stm32l0/include/cpu_conf.h b/cpu/stm32l0/include/cpu_conf.h
index d8cb2b5ed4..9fd1ef30bf 100644
--- a/cpu/stm32l0/include/cpu_conf.h
+++ b/cpu/stm32l0/include/cpu_conf.h
@@ -58,18 +58,9 @@ extern "C" {
  * @name    Flash page configuration
  * @{
  */
-#if defined(CPU_MODEL_STM32L073RZ) || defined(CPU_MODEL_STM32L072CZ) || \
-    defined(CPU_MODEL_STM32L053R8) || defined(CPU_MODEL_STM32L031K6)
 #define FLASHPAGE_SIZE      (128U)
-#endif
 
-#if defined(CPU_MODEL_STM32L073RZ) || defined(CPU_MODEL_STM32L072CZ)
-#define FLASHPAGE_NUMOF     (1536U)
-#elif defined(CPU_MODEL_STM32L053R8)
-#define FLASHPAGE_NUMOF     (512U)
-#elif defined(CPU_MODEL_STM32L031K6)
-#define FLASHPAGE_NUMOF     (256U)
-#endif
+#define FLASHPAGE_NUMOF     (STM32_FLASHSIZE / FLASHPAGE_SIZE)
 
 /* The minimum block size which can be written is 4B. However, the erase
  * block is always FLASHPAGE_SIZE.
-- 
GitLab