summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-08-05 21:11:03 +0800
committerMeco Man <[email protected]>2021-08-05 21:11:37 +0800
commit963cce1e1bd6fbb7c4a2cf7c81812d9fca8d9a70 (patch)
tree95c1c355103bb3311ed9be5cd8e4cb99ceca2b62
parent1f13b6d58ecd03005bb595a6658970da086a113b (diff)
解决没有选定FAL和littlefs软件包的问题,解决挂载顺序不合理的问题,重命名spiflash设备为spiflash0
-rw-r--r--bsp/stm32/stm32f407-atk-explorer/board/Kconfig3
-rw-r--r--bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c45
-rw-r--r--bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h2
3 files changed, 15 insertions, 35 deletions
diff --git a/bsp/stm32/stm32f407-atk-explorer/board/Kconfig b/bsp/stm32/stm32f407-atk-explorer/board/Kconfig
index 7d6d8cf883..8690baf177 100644
--- a/bsp/stm32/stm32f407-atk-explorer/board/Kconfig
+++ b/bsp/stm32/stm32f407-atk-explorer/board/Kconfig
@@ -99,6 +99,9 @@ menu "Onboard Peripheral Drivers"
select RT_USING_MTD_NOR
select BSP_USING_SPI_FLASH
select BSP_USING_FS
+ select PKG_USING_FAL
+ select FAL_USING_SFUD_PORT
+ select PKG_USING_LITTLEFS
select RT_USING_SYSTEM_WORKQUEUE
default n
diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c b/bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c
index 07e6140722..82f9c9c76b 100644
--- a/bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c
+++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c
@@ -16,7 +16,6 @@
#include <dfs_romfs.h>
#include <dfs_fs.h>
#include <dfs_posix.h>
-#include <fal.h>
#if DFS_FILESYSTEMS_MAX < 4
#error "Please define DFS_FILESYSTEMS_MAX more than 4"
@@ -77,55 +76,34 @@ static int onboard_sdcard_mount(void)
#endif
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
+#include <fal.h>
+#define FS_PARTITION_NAME "spiflash0"
-#define FS_PARTITION_NAME "filesystem"
-
-static void spiflash_mount(void *parameter)
+static int onboard_spiflash_mount(void)
{
struct rt_device *mtd_dev = RT_NULL;
+
fal_init();
mtd_dev = fal_mtd_nor_device_create(FS_PARTITION_NAME);
if (!mtd_dev)
{
LOG_E("Can't create a mtd device on '%s' partition.", FS_PARTITION_NAME);
}
- while (1)
- {
- rt_thread_mdelay(500);
- if(rt_device_find(FS_PARTITION_NAME) != RT_NULL)
- {
- if (dfs_mount(FS_PARTITION_NAME, "/flash", "lfs", 0, 0) == RT_EOK)
- {
- LOG_I("spi flash mount to '/flash'");
- break;
- }
- else
- {
- LOG_W("spi flash mount to '/flash' failed!");
- }
- }
- }
-}
-
-static int onboard_spiflash_mount(void)
-{
- rt_thread_t tid;
- if (dfs_mount(FS_PARTITION_NAME, "/flash", "lfs", 0, 0) == RT_EOK)
+ if (dfs_mount(FS_PARTITION_NAME, "/spiflash", "lfs", 0, 0) == RT_EOK)
{
- LOG_I("spi flash mount to '/flash'");
+ LOG_I("spi flash mount to '/spiflash'");
}
else
{
- tid = rt_thread_create("spiflash_mount", spiflash_mount, RT_NULL,
- 1024, RT_THREAD_PRIORITY_MAX - 3, 20);
- if (tid != RT_NULL)
+ dfs_mkfs("lfs", FS_PARTITION_NAME);
+ if (dfs_mount(FS_PARTITION_NAME, "/spiflash", "lfs", 0, 0) == RT_EOK)
{
- rt_thread_startup(tid);
+ LOG_I("spi flash mount to '/spiflash'");
}
else
{
- LOG_E("create spiflash_mount thread err!");
+ LOG_E("spi flash failed to mount to '/spiflash'");
}
}
@@ -133,7 +111,6 @@ static int onboard_spiflash_mount(void)
}
#endif
-
static const struct romfs_dirent _romfs_root[] =
{
#ifdef BSP_USING_SDCARD
@@ -141,7 +118,7 @@ static const struct romfs_dirent _romfs_root[] =
#endif
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
- {ROMFS_DIRENT_DIR, "flash", RT_NULL, 0},
+ {ROMFS_DIRENT_DIR, "spiflash", RT_NULL, 0},
#endif
};
diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h b/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
index 0cea945fe5..304efe869d 100644
--- a/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
+++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h
@@ -52,7 +52,7 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
#define FAL_PART_TABLE \
{ \
- {FAL_PART_MAGIC_WROD, "filesystem",FAL_USING_NOR_FLASH_DEV_NAME, 0 , 16 * 1024 * 1024, 0}, \
+ {FAL_PART_MAGIC_WROD, "spiflash0", FAL_USING_NOR_FLASH_DEV_NAME, 0 , 16 * 1024 * 1024, 0}, \
}
#else
#define FAL_PART_TABLE \