summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/fal/inc/fal_def.h11
-rw-r--r--components/fal/src/fal_flash.c13
2 files changed, 23 insertions, 1 deletions
diff --git a/components/fal/inc/fal_def.h b/components/fal/inc/fal_def.h
index 32af32a057..1372798ee4 100644
--- a/components/fal/inc/fal_def.h
+++ b/components/fal/inc/fal_def.h
@@ -73,6 +73,16 @@ if (!(EXPR)) \
#define FAL_DEV_NAME_MAX 24
#endif
+#ifndef FAL_DEV_BLK_MAX
+#define FAL_DEV_BLK_MAX 6
+#endif
+
+struct flash_blk
+{
+ size_t size;
+ size_t count;
+};
+
struct fal_flash_dev
{
char name[FAL_DEV_NAME_MAX];
@@ -95,6 +105,7 @@ struct fal_flash_dev
1(nor flash)/ 8(stm32f2/f4)/ 32(stm32f1)/ 64(stm32l4)
0 will not take effect. */
size_t write_gran;
+ struct flash_blk blocks[FAL_DEV_BLK_MAX];
};
typedef struct fal_flash_dev *fal_flash_dev_t;
diff --git a/components/fal/src/fal_flash.c b/components/fal/src/fal_flash.c
index 8cef82c2bb..b0ca60f0c9 100644
--- a/components/fal/src/fal_flash.c
+++ b/components/fal/src/fal_flash.c
@@ -27,7 +27,7 @@ static uint8_t init_ok = 0;
*/
int fal_flash_init(void)
{
- size_t i;
+ size_t i, j, offset;
if (init_ok)
{
@@ -47,6 +47,17 @@ int fal_flash_init(void)
log_d("Flash device | %*.*s | addr: 0x%08lx | len: 0x%08x | blk_size: 0x%08x |initialized finish.",
FAL_DEV_NAME_MAX, FAL_DEV_NAME_MAX, device_table[i]->name, device_table[i]->addr, device_table[i]->len,
device_table[i]->blk_size);
+ offset = 0;
+ for (j = 0; j < FAL_DEV_BLK_MAX; j ++)
+ {
+ const struct flash_blk *blk = &device_table[i]->blocks[j];
+ size_t blk_len = blk->count * blk->size;
+ if (blk->count == 0 || blk->size == 0)
+ break;
+ log_d(" blk%2d | addr: 0x%08lx | len: 0x%08x | blk_size: 0x%08x |initialized finish.",
+ j, device_table[i]->addr + offset, blk_len, blk->size);
+ offset += blk_len;
+ }
}
init_ok = 1;