From 0eec8d532bb0d0bcc022c58f863b20d71344c96a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E9=BE=99=20=28Armink=29?= Date: Sun, 30 Jul 2023 16:18:44 +0800 Subject: [PATCH 1/2] [components][fal] remove some assert. --- components/fal/src/fal_partition.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/fal/src/fal_partition.c b/components/fal/src/fal_partition.c index 92ae0743034..a26a018a28e 100644 --- a/components/fal/src/fal_partition.c +++ b/components/fal/src/fal_partition.c @@ -321,7 +321,8 @@ int fal_partition_init(void) */ const struct fal_partition *fal_partition_find(const char *name) { - assert(init_ok); + if (!init_ok) + return NULL; size_t i; @@ -353,9 +354,11 @@ static const struct fal_flash_dev *flash_device_find_by_part(const struct fal_pa */ const struct fal_partition *fal_get_partition_table(size_t *len) { - assert(init_ok); assert(len); + if (!init_ok) + return NULL; + *len = partition_table_len; return partition_table; @@ -370,9 +373,14 @@ const struct fal_partition *fal_get_partition_table(size_t *len) */ void fal_set_partition_table_temp(struct fal_partition *table, size_t len) { - assert(init_ok); assert(table); + if (!init_ok) + { + log_e("FAL NOT initialized"); + return; + } + check_and_update_part_cache(table, len); partition_table_len = len; @@ -400,7 +408,7 @@ int fal_partition_read(const struct fal_partition *part, uint32_t addr, uint8_t if (addr + size > part->len) { - log_e("Partition read error! Partition address out of bound."); + log_e("Partition read error! Partition(%s) address(0x%08x) out of bound(0x%08x).", part->name, addr + size, part->len); return -1; } From 4d114d4469fbd3b35e73e6c63b5725a9dfc49d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E9=BE=99=20=28Armink=29?= Date: Sun, 30 Jul 2023 16:23:41 +0800 Subject: [PATCH 2/2] [components][utilities][var_export] update the var export auto init to board_init. --- components/utilities/var_export/var_export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/utilities/var_export/var_export.c b/components/utilities/var_export/var_export.c index abc412a6821..7de4653e7f2 100644 --- a/components/utilities/var_export/var_export.c +++ b/components/utilities/var_export/var_export.c @@ -126,7 +126,7 @@ int var_export_init(void) return ve_exporter_num; } -INIT_PREV_EXPORT(var_export_init); +INIT_BOARD_EXPORT(var_export_init); /* initialize module */ int ve_module_init(ve_module_t *mod, const char *module)