Переглянути джерело

[bsp][stm32] fix flash partition bug

SummerGift 6 роки тому
батько
коміт
532a14ddd8

+ 3 - 3
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f4.c

@@ -327,9 +327,9 @@ static int fal_flash_erase_16k(long offset, size_t size);
 static int fal_flash_erase_64k(long offset, size_t size);
 static int fal_flash_erase_128k(long offset, size_t size);
 
-const struct fal_flash_dev stm32_onchip_flash_16k = { "onchip_flash_16k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_16K, (16 * 1024), {NULL, fal_flash_read_16k, fal_flash_write_16k, fal_flash_erase_16k} };
-const struct fal_flash_dev stm32_onchip_flash_64k = { "onchip_flash_64k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_64K, (64 * 1024), {NULL, fal_flash_read_64k, fal_flash_write_64k, fal_flash_erase_64k} };
-const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} };
+const struct fal_flash_dev stm32_onchip_flash_16k = { "onchip_flash_16k", STM32_FLASH_START_ADRESS_16K, FLASH_SIZE_GRANULARITY_16K, (16 * 1024), {NULL, fal_flash_read_16k, fal_flash_write_16k, fal_flash_erase_16k} };
+const struct fal_flash_dev stm32_onchip_flash_64k = { "onchip_flash_64k", STM32_FLASH_START_ADRESS_64K, FLASH_SIZE_GRANULARITY_64K, (64 * 1024), {NULL, fal_flash_read_64k, fal_flash_write_64k, fal_flash_erase_64k} };
+const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS_128K, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} };
 
 static int fal_flash_read_16k(long offset, rt_uint8_t *buf, size_t size)
 {

+ 3 - 3
bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c

@@ -253,9 +253,9 @@ static int fal_flash_erase_32k(long offset, size_t size);
 static int fal_flash_erase_128k(long offset, size_t size);
 static int fal_flash_erase_256k(long offset, size_t size);
 
-const struct fal_flash_dev stm32_onchip_flash_32k = { "onchip_flash_32k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_32K, (32 * 1024), {NULL, fal_flash_read_32k, fal_flash_write_32k, fal_flash_erase_32k} };
-const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} };
-const struct fal_flash_dev stm32_onchip_flash_256k = { "onchip_flash_256k", STM32_FLASH_START_ADRESS, FLASH_SIZE_GRANULARITY_256K, (256 * 1024), {NULL, fal_flash_read_256k, fal_flash_write_256k, fal_flash_erase_256k} };
+const struct fal_flash_dev stm32_onchip_flash_32k = { "onchip_flash_32k", STM32_FLASH_START_ADRESS_32K, FLASH_SIZE_GRANULARITY_32K, (32 * 1024), {NULL, fal_flash_read_32k, fal_flash_write_32k, fal_flash_erase_32k} };
+const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS_128K, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} };
+const struct fal_flash_dev stm32_onchip_flash_256k = { "onchip_flash_256k", STM32_FLASH_START_ADRESS_256K, FLASH_SIZE_GRANULARITY_256K, (256 * 1024), {NULL, fal_flash_read_256k, fal_flash_write_256k, fal_flash_erase_256k} };
 
 static int fal_flash_read_32k(long offset, rt_uint8_t *buf, size_t size)
 {

+ 9 - 5
bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h

@@ -15,8 +15,12 @@
 #include <board.h>
 
 #define FLASH_SIZE_GRANULARITY_16K   (4 * 16 * 1024)
-#define FLASH_SIZE_GRANULARITY_64K   (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
-#define FLASH_SIZE_GRANULARITY_128K  (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
+#define FLASH_SIZE_GRANULARITY_64K   (64 * 1024)
+#define FLASH_SIZE_GRANULARITY_128K  (7 * 128 * 1024)
+
+#define STM32_FLASH_START_ADRESS_16K  STM32_FLASH_START_ADRESS
+#define STM32_FLASH_START_ADRESS_64K  (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
+#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
 
 extern const struct fal_flash_dev stm32_onchip_flash_16k;
 extern const struct fal_flash_dev stm32_onchip_flash_64k;
@@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
 /* partition table */
 #define FAL_PART_TABLE                                                                                                     \
 {                                                                                                                          \
-    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k",  0 ,                          FLASH_SIZE_GRANULARITY_16K , 0}, \
-    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_64k",  FLASH_SIZE_GRANULARITY_16K , FLASH_SIZE_GRANULARITY_64K , 0}, \
-    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_128k", FLASH_SIZE_GRANULARITY_64K,  FLASH_SIZE_GRANULARITY_128K, 0}, \
+    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k",  0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
+    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_64k",  0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
+    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
 }
 
 #endif /* FAL_PART_HAS_TABLE_CFG */

+ 9 - 5
bsp/stm32/stm32f429-armfly-v6/board/ports/fal_cfg.h

@@ -15,8 +15,12 @@
 #include <board.h>
 
 #define FLASH_SIZE_GRANULARITY_16K   (4 * 16 * 1024)
-#define FLASH_SIZE_GRANULARITY_64K   (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
-#define FLASH_SIZE_GRANULARITY_128K  (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
+#define FLASH_SIZE_GRANULARITY_64K   (64 * 1024)
+#define FLASH_SIZE_GRANULARITY_128K  (7 * 128 * 1024)
+
+#define STM32_FLASH_START_ADRESS_16K  STM32_FLASH_START_ADRESS
+#define STM32_FLASH_START_ADRESS_64K  (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
+#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
 
 extern const struct fal_flash_dev stm32_onchip_flash_16k;
 extern const struct fal_flash_dev stm32_onchip_flash_64k;
@@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
 /* partition table */
 #define FAL_PART_TABLE                                                                                                     \
 {                                                                                                                          \
-    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k",  0 ,                          FLASH_SIZE_GRANULARITY_16K , 0}, \
-    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_64k",  FLASH_SIZE_GRANULARITY_16K , FLASH_SIZE_GRANULARITY_64K , 0}, \
-    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_128k",  FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
+    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k",  0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
+    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_64k",  0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
+    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
 }
 
 #endif /* FAL_PART_HAS_TABLE_CFG */

+ 9 - 5
bsp/stm32/stm32f429-atk-apollo/board/ports/fal_cfg.h

@@ -15,8 +15,12 @@
 #include <board.h>
 
 #define FLASH_SIZE_GRANULARITY_16K   (4 * 16 * 1024)
-#define FLASH_SIZE_GRANULARITY_64K   (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
-#define FLASH_SIZE_GRANULARITY_128K  (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
+#define FLASH_SIZE_GRANULARITY_64K   (64 * 1024)
+#define FLASH_SIZE_GRANULARITY_128K  (7 * 128 * 1024)
+
+#define STM32_FLASH_START_ADRESS_16K  STM32_FLASH_START_ADRESS
+#define STM32_FLASH_START_ADRESS_64K  (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
+#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
 
 extern const struct fal_flash_dev stm32_onchip_flash_16k;
 extern const struct fal_flash_dev stm32_onchip_flash_64k;
@@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
 /* partition table */
 #define FAL_PART_TABLE                                                                                                     \
 {                                                                                                                          \
-    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k",  0 ,                          FLASH_SIZE_GRANULARITY_16K , 0}, \
-    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_64k",  FLASH_SIZE_GRANULARITY_16K , FLASH_SIZE_GRANULARITY_64K , 0}, \
-    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_128k",  FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
+    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k",  0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
+    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_64k",  0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
+    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
 }
 
 #endif /* FAL_PART_HAS_TABLE_CFG */

+ 9 - 5
bsp/stm32/stm32f429-fire-challenger/board/ports/fal_cfg.h

@@ -15,8 +15,12 @@
 #include <board.h>
 
 #define FLASH_SIZE_GRANULARITY_16K   (4 * 16 * 1024)
-#define FLASH_SIZE_GRANULARITY_64K   (FLASH_SIZE_GRANULARITY_16K + 64 * 1024)
-#define FLASH_SIZE_GRANULARITY_128K  (FLASH_SIZE_GRANULARITY_64K + 7 * 128 * 1024)
+#define FLASH_SIZE_GRANULARITY_64K   (64 * 1024)
+#define FLASH_SIZE_GRANULARITY_128K  (7 * 128 * 1024)
+
+#define STM32_FLASH_START_ADRESS_16K  STM32_FLASH_START_ADRESS
+#define STM32_FLASH_START_ADRESS_64K  (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
+#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
 
 extern const struct fal_flash_dev stm32_onchip_flash_16k;
 extern const struct fal_flash_dev stm32_onchip_flash_64k;
@@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
 /* partition table */
 #define FAL_PART_TABLE                                                                                                     \
 {                                                                                                                          \
-    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k",  0 ,                          FLASH_SIZE_GRANULARITY_16K , 0}, \
-    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_64k",  FLASH_SIZE_GRANULARITY_16K , FLASH_SIZE_GRANULARITY_64K , 0}, \
-    {FAL_PART_MAGIC_WROD, "download",   "onchip_flash_128k",  FLASH_SIZE_GRANULARITY_64K, FLASH_SIZE_GRANULARITY_128K, 0}, \
+    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k",  0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
+    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_64k",  0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
+    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
 }
 
 #endif /* FAL_PART_HAS_TABLE_CFG */

+ 9 - 5
bsp/stm32/stm32f767-atk-apollo/board/ports/fal_cfg.h

@@ -15,8 +15,12 @@
 #include <board.h>
 
 #define FLASH_SIZE_GRANULARITY_32K   (4 * 32 * 1024)
-#define FLASH_SIZE_GRANULARITY_128K  (FLASH_SIZE_GRANULARITY_32K + 128 * 1024)
-#define FLASH_SIZE_GRANULARITY_256K  (FLASH_SIZE_GRANULARITY_128K + 3 * 256 * 1024)
+#define FLASH_SIZE_GRANULARITY_128K  (128 * 1024)
+#define FLASH_SIZE_GRANULARITY_256K  (3 * 256 * 1024)
+
+#define STM32_FLASH_START_ADRESS_32K  STM32_FLASH_START_ADRESS
+#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_32K + FLASH_SIZE_GRANULARITY_32K)
+#define STM32_FLASH_START_ADRESS_256K (STM32_FLASH_START_ADRESS_128K + FLASH_SIZE_GRANULARITY_128K)
 
 extern const struct fal_flash_dev stm32_onchip_flash_32k;
 extern const struct fal_flash_dev stm32_onchip_flash_128k;
@@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_256k;
 /* partition table */
 #define FAL_PART_TABLE                                                                                                     \
 {                                                                                                                          \
-    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_32k",  0 ,                          FLASH_SIZE_GRANULARITY_32K , 0}, \
-    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_128k", FLASH_SIZE_GRANULARITY_32K , FLASH_SIZE_GRANULARITY_128K, 0}, \
-    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_256k", FLASH_SIZE_GRANULARITY_128K, FLASH_SIZE_GRANULARITY_256K, 0}, \
+    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_32k",  0 , FLASH_SIZE_GRANULARITY_32K , 0}, \
+    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
+    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_256k", 0 , FLASH_SIZE_GRANULARITY_256K, 0}, \
 }
 
 #endif /* FAL_PART_HAS_TABLE_CFG */

+ 9 - 5
bsp/stm32/stm32f767-fire-challenger/board/ports/fal_cfg.h

@@ -15,8 +15,12 @@
 #include <board.h>
 
 #define FLASH_SIZE_GRANULARITY_32K   (4 * 32 * 1024)
-#define FLASH_SIZE_GRANULARITY_128K  (FLASH_SIZE_GRANULARITY_32K + 128 * 1024)
-#define FLASH_SIZE_GRANULARITY_256K  (FLASH_SIZE_GRANULARITY_128K + 3 * 256 * 1024)
+#define FLASH_SIZE_GRANULARITY_128K  (128 * 1024)
+#define FLASH_SIZE_GRANULARITY_256K  (3 * 256 * 1024)
+
+#define STM32_FLASH_START_ADRESS_32K  STM32_FLASH_START_ADRESS
+#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_32K + FLASH_SIZE_GRANULARITY_32K)
+#define STM32_FLASH_START_ADRESS_256K (STM32_FLASH_START_ADRESS_128K + FLASH_SIZE_GRANULARITY_128K)
 
 extern const struct fal_flash_dev stm32_onchip_flash_32k;
 extern const struct fal_flash_dev stm32_onchip_flash_128k;
@@ -35,9 +39,9 @@ extern const struct fal_flash_dev stm32_onchip_flash_256k;
 /* partition table */
 #define FAL_PART_TABLE                                                                                                     \
 {                                                                                                                          \
-    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_32k",  0 ,                          FLASH_SIZE_GRANULARITY_32K , 0}, \
-    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_128k", FLASH_SIZE_GRANULARITY_32K , FLASH_SIZE_GRANULARITY_128K, 0}, \
-    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_256k", FLASH_SIZE_GRANULARITY_128K, FLASH_SIZE_GRANULARITY_256K, 0}, \
+    {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_32k",  0 , FLASH_SIZE_GRANULARITY_32K , 0}, \
+    {FAL_PART_MAGIC_WROD, "param",      "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
+    {FAL_PART_MAGIC_WROD, "app",        "onchip_flash_256k", 0 , FLASH_SIZE_GRANULARITY_256K, 0}, \
 }
 
 #endif /* FAL_PART_HAS_TABLE_CFG */