You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2019/06/18 10:42:46 UTC

[mynewt-core] branch master updated: stm32/flash: Change STM32_FLASH_NUM_AREAS to match spec

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new c37ac6d  stm32/flash: Change STM32_FLASH_NUM_AREAS to match spec
c37ac6d is described below

commit c37ac6d66a5428f0bb43ef076e926f5b68f80a4f
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Tue Jun 18 11:41:55 2019 +0200

    stm32/flash: Change STM32_FLASH_NUM_AREAS to match spec
    
    syscfg values STM32_FLASH_NUM_AREAS had number of sectors increased by 1,
    probably due to way it was used in asserts.
    
    Value was misleading and did not match description field.
    
    Now STM32_FLASH_NUM_AREAS has accurate value as described in datasheet,
    and asserts are corrected.
---
 hw/bsp/black_vet6/src/hal_bsp.c                 | 2 +-
 hw/bsp/black_vet6/syscfg.yml                    | 4 ++--
 hw/bsp/nucleo-f401re/src/hal_bsp.c              | 2 +-
 hw/bsp/nucleo-f401re/syscfg.yml                 | 4 ++--
 hw/bsp/nucleo-f413zh/src/hal_bsp.c              | 2 +-
 hw/bsp/nucleo-f413zh/syscfg.yml                 | 4 ++--
 hw/bsp/nucleo-f439zi/src/hal_bsp.c              | 2 +-
 hw/bsp/nucleo-f439zi/syscfg.yml                 | 4 ++--
 hw/bsp/nucleo-f746zg/src/hal_bsp.c              | 2 +-
 hw/bsp/nucleo-f746zg/syscfg.yml                 | 4 ++--
 hw/bsp/nucleo-f767zi/src/hal_bsp.c              | 2 +-
 hw/bsp/nucleo-f767zi/syscfg.yml                 | 4 ++--
 hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c | 2 +-
 hw/bsp/olimex_stm32-e407_devboard/syscfg.yml    | 4 ++--
 hw/bsp/stm32f429discovery/src/hal_bsp.c         | 2 +-
 hw/bsp/stm32f429discovery/syscfg.yml            | 4 ++--
 hw/bsp/stm32f4discovery/src/hal_bsp.c           | 2 +-
 hw/bsp/stm32f4discovery/syscfg.yml              | 4 ++--
 hw/bsp/stm32f7discovery/syscfg.yml              | 4 ++--
 hw/mcu/stm/stm32_common/src/hal_flash.c         | 2 +-
 20 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/hw/bsp/black_vet6/src/hal_bsp.c b/hw/bsp/black_vet6/src/hal_bsp.c
index 3809e6a..d5427eb 100644
--- a/hw/bsp/black_vet6/src/hal_bsp.c
+++ b/hw/bsp/black_vet6/src/hal_bsp.c
@@ -69,7 +69,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ ARRAY_SIZE(stm32_flash_sectors)
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(TRNG)
diff --git a/hw/bsp/black_vet6/syscfg.yml b/hw/bsp/black_vet6/syscfg.yml
index a2134af..f871baf 100644
--- a/hw/bsp/black_vet6/syscfg.yml
+++ b/hw/bsp/black_vet6/syscfg.yml
@@ -22,8 +22,8 @@ syscfg.defs:
         value: 512
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 9
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 8
 
     ADC_1:
         description: "ADC_1"
diff --git a/hw/bsp/nucleo-f401re/src/hal_bsp.c b/hw/bsp/nucleo-f401re/src/hal_bsp.c
index d2fc678..f11b008 100644
--- a/hw/bsp/nucleo-f401re/src/hal_bsp.c
+++ b/hw/bsp/nucleo-f401re/src/hal_bsp.c
@@ -51,7 +51,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ (sizeof(stm32_flash_sectors) / sizeof(stm32_flash_sectors[0]))
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(UART_0)
diff --git a/hw/bsp/nucleo-f401re/syscfg.yml b/hw/bsp/nucleo-f401re/syscfg.yml
index 5c97486..e166377 100644
--- a/hw/bsp/nucleo-f401re/syscfg.yml
+++ b/hw/bsp/nucleo-f401re/syscfg.yml
@@ -23,8 +23,8 @@ syscfg.defs:
         value: 512
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 9
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 8
 
     UART_0:
         description: 'Whether to enable UART0'
diff --git a/hw/bsp/nucleo-f413zh/src/hal_bsp.c b/hw/bsp/nucleo-f413zh/src/hal_bsp.c
index 50c6f41..f1d65e9 100644
--- a/hw/bsp/nucleo-f413zh/src/hal_bsp.c
+++ b/hw/bsp/nucleo-f413zh/src/hal_bsp.c
@@ -60,7 +60,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ (sizeof(stm32_flash_sectors) / sizeof(stm32_flash_sectors[0]))
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(UART_0)
diff --git a/hw/bsp/nucleo-f413zh/syscfg.yml b/hw/bsp/nucleo-f413zh/syscfg.yml
index 33d0d0c..9c73931 100644
--- a/hw/bsp/nucleo-f413zh/syscfg.yml
+++ b/hw/bsp/nucleo-f413zh/syscfg.yml
@@ -23,8 +23,8 @@ syscfg.defs:
         value: 1536
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 17
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 16
 
     UART_0:
         description: 'UART 0'
diff --git a/hw/bsp/nucleo-f439zi/src/hal_bsp.c b/hw/bsp/nucleo-f439zi/src/hal_bsp.c
index fa6cdf2..804065b 100644
--- a/hw/bsp/nucleo-f439zi/src/hal_bsp.c
+++ b/hw/bsp/nucleo-f439zi/src/hal_bsp.c
@@ -81,7 +81,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ (sizeof(stm32_flash_sectors) / sizeof(stm32_flash_sectors[0]))
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(TRNG)
diff --git a/hw/bsp/nucleo-f439zi/syscfg.yml b/hw/bsp/nucleo-f439zi/syscfg.yml
index 689d9b1..7b5b8f8 100644
--- a/hw/bsp/nucleo-f439zi/syscfg.yml
+++ b/hw/bsp/nucleo-f439zi/syscfg.yml
@@ -23,8 +23,8 @@ syscfg.defs:
         value: 2048
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 25
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 24
 
     UART_0:
         description: 'UART 0'
diff --git a/hw/bsp/nucleo-f746zg/src/hal_bsp.c b/hw/bsp/nucleo-f746zg/src/hal_bsp.c
index 9150e6a..7172d23 100644
--- a/hw/bsp/nucleo-f746zg/src/hal_bsp.c
+++ b/hw/bsp/nucleo-f746zg/src/hal_bsp.c
@@ -95,7 +95,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ (sizeof(stm32_flash_sectors) / sizeof(stm32_flash_sectors[0]))
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(TRNG)
diff --git a/hw/bsp/nucleo-f746zg/syscfg.yml b/hw/bsp/nucleo-f746zg/syscfg.yml
index 292bdb9..5202067 100644
--- a/hw/bsp/nucleo-f746zg/syscfg.yml
+++ b/hw/bsp/nucleo-f746zg/syscfg.yml
@@ -23,8 +23,8 @@ syscfg.defs:
         value: 1024
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 9
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 8
 
     UART_0:
         description: 'Uart 0'
diff --git a/hw/bsp/nucleo-f767zi/src/hal_bsp.c b/hw/bsp/nucleo-f767zi/src/hal_bsp.c
index d890183..01e2e2a 100644
--- a/hw/bsp/nucleo-f767zi/src/hal_bsp.c
+++ b/hw/bsp/nucleo-f767zi/src/hal_bsp.c
@@ -100,7 +100,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ (sizeof(stm32_flash_sectors) / sizeof(stm32_flash_sectors[0]))
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(TRNG)
diff --git a/hw/bsp/nucleo-f767zi/syscfg.yml b/hw/bsp/nucleo-f767zi/syscfg.yml
index f57ceb2..482b8ba 100644
--- a/hw/bsp/nucleo-f767zi/syscfg.yml
+++ b/hw/bsp/nucleo-f767zi/syscfg.yml
@@ -23,8 +23,8 @@ syscfg.defs:
         value: 2048
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 13
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 12
 
     UART_0:
         description: 'Uart 0'
diff --git a/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c b/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
index 9b4cac7..01aaaaf 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
+++ b/hw/bsp/olimex_stm32-e407_devboard/src/hal_bsp.c
@@ -68,7 +68,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ (sizeof(stm32_flash_sectors) / sizeof(stm32_flash_sectors[0]))
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(TRNG)
diff --git a/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml b/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml
index 4664503..539d824 100644
--- a/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml
+++ b/hw/bsp/olimex_stm32-e407_devboard/syscfg.yml
@@ -22,8 +22,8 @@ syscfg.defs:
         value: 1024
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 13
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 12
 
     ADC_1:
         description: "ADC_1"
diff --git a/hw/bsp/stm32f429discovery/src/hal_bsp.c b/hw/bsp/stm32f429discovery/src/hal_bsp.c
index c6a0eb8..85866a7 100644
--- a/hw/bsp/stm32f429discovery/src/hal_bsp.c
+++ b/hw/bsp/stm32f429discovery/src/hal_bsp.c
@@ -68,7 +68,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ (sizeof(stm32_flash_sectors) / sizeof(stm32_flash_sectors[0]))
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(UART_0)
diff --git a/hw/bsp/stm32f429discovery/syscfg.yml b/hw/bsp/stm32f429discovery/syscfg.yml
index 3d9f141..292d922 100644
--- a/hw/bsp/stm32f429discovery/syscfg.yml
+++ b/hw/bsp/stm32f429discovery/syscfg.yml
@@ -23,8 +23,8 @@ syscfg.defs:
         value: 2048
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 25
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 24
 
     UART_0:
         description: 'UART 0'
diff --git a/hw/bsp/stm32f4discovery/src/hal_bsp.c b/hw/bsp/stm32f4discovery/src/hal_bsp.c
index c5eca86..feddd8d 100644
--- a/hw/bsp/stm32f4discovery/src/hal_bsp.c
+++ b/hw/bsp/stm32f4discovery/src/hal_bsp.c
@@ -57,7 +57,7 @@ const uint32_t stm32_flash_sectors[] = {
 };
 
 #define SZ (sizeof(stm32_flash_sectors) / sizeof(stm32_flash_sectors[0]))
-static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) == SZ,
+static_assert(MYNEWT_VAL(STM32_FLASH_NUM_AREAS) + 1 == SZ,
         "STM32_FLASH_NUM_AREAS does not match flash sectors");
 
 #if MYNEWT_VAL(UART_0)
diff --git a/hw/bsp/stm32f4discovery/syscfg.yml b/hw/bsp/stm32f4discovery/syscfg.yml
index b744b96..3ff5761 100644
--- a/hw/bsp/stm32f4discovery/syscfg.yml
+++ b/hw/bsp/stm32f4discovery/syscfg.yml
@@ -23,8 +23,8 @@ syscfg.defs:
         value: 1024
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 13
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 12
 
     UART_0:
         description: 'UART 0'
diff --git a/hw/bsp/stm32f7discovery/syscfg.yml b/hw/bsp/stm32f7discovery/syscfg.yml
index 2a757ee..7859223 100644
--- a/hw/bsp/stm32f7discovery/syscfg.yml
+++ b/hw/bsp/stm32f7discovery/syscfg.yml
@@ -23,8 +23,8 @@ syscfg.defs:
         value: 1024
 
     STM32_FLASH_NUM_AREAS:
-        description: 'Amount of flash sectors for a non-linear STM32 MCU.'
-        value: 13
+        description: 'Number of flash sectors for a non-linear STM32 MCU.'
+        value: 12
 
     UART_0:
         description: 'Uart 0'
diff --git a/hw/mcu/stm/stm32_common/src/hal_flash.c b/hw/mcu/stm/stm32_common/src/hal_flash.c
index 350d7e1..b07305d 100644
--- a/hw/mcu/stm/stm32_common/src/hal_flash.c
+++ b/hw/mcu/stm/stm32_common/src/hal_flash.c
@@ -53,7 +53,7 @@ const struct hal_flash_funcs stm32_flash_funcs = {
 
 #if !FLASH_IS_LINEAR
 extern const uint32_t stm32_flash_sectors[];
-#define FLASH_NUM_AREAS (MYNEWT_VAL(STM32_FLASH_NUM_AREAS) - 1)
+#define FLASH_NUM_AREAS MYNEWT_VAL(STM32_FLASH_NUM_AREAS)
 #else
 #define FLASH_NUM_AREAS (_FLASH_SIZE / _FLASH_SECTOR_SIZE)
 #endif