From 2f7c294d97fe2fa3f86fc7206574c8dedd50b324 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Thu, 18 Aug 2022 20:17:42 -0400 Subject: [PATCH] =?UTF-8?q?[stm32f407-explorer][fs]=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=B3=BB=E7=BB=9F=E9=80=89=E9=A1=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stm32f407-atk-explorer/board/Kconfig | 59 +++++++++---------- .../stm32f407-atk-explorer/board/SConscript | 3 +- .../board/ports/drv_filesystem.c | 14 +---- .../board/ports/{ => fal}/fal_cfg.h | 0 .../ports/{ => fal}/fal_spi_flash_sfud_port.c | 0 5 files changed, 32 insertions(+), 44 deletions(-) rename bsp/stm32/stm32f407-atk-explorer/board/ports/{ => fal}/fal_cfg.h (100%) rename bsp/stm32/stm32f407-atk-explorer/board/ports/{ => fal}/fal_spi_flash_sfud_port.c (100%) diff --git a/bsp/stm32/stm32f407-atk-explorer/board/Kconfig b/bsp/stm32/stm32f407-atk-explorer/board/Kconfig index e9a3d5fce0..b62ef50547 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/Kconfig +++ b/bsp/stm32/stm32f407-atk-explorer/board/Kconfig @@ -134,40 +134,29 @@ menu "Onboard Peripheral Drivers" select BSP_USING_I2C1 select PKG_USING_MPU6XXX - menu "Enable File System" - config BSP_USING_FS - bool - default n - - config BSP_USING_SDCARD_FATFS - bool "Enable SDCARD (FATFS)" - select BSP_USING_SDIO - select RT_USING_DFS - select RT_USING_DFS_ELMFAT - select RT_USING_DFS_ROMFS - select BSP_USING_FS - default n + menuconfig BSP_USING_FS + bool "Enable File System" + select RT_USING_DFS + select RT_USING_DFS_ROMFS + default n - config SDIO_MAX_FREQ - int "sdio max freq" - range 0 24000000 - depends on BSP_USING_SDCARD - default 1000000 - - config BSP_USING_SPI_FLASH_LITTLEFS - bool "Enable SPI-FLASH (LittleFS)" - select RT_USING_DFS - select RT_USING_DFS_ROMFS - select RT_USING_MTD_NOR - select BSP_USING_SPI_FLASH - select BSP_USING_FS - select RT_USING_FAL - select FAL_USING_AUTO_INIT - select FAL_PART_HAS_TABLE_CFG - select PKG_USING_LITTLEFS - default n + if BSP_USING_FS + config BSP_USING_SDCARD_FATFS + bool "Enable SDCARD (FATFS)" + select BSP_USING_SDIO + select RT_USING_DFS_ELMFAT + default n - endmenu + config BSP_USING_SPI_FLASH_LITTLEFS + bool "Enable SPI-FLASH (LittleFS)" + select RT_USING_MTD_NOR + select BSP_USING_SPI_FLASH + select RT_USING_FAL + select FAL_USING_AUTO_INIT + select FAL_PART_HAS_TABLE_CFG + select PKG_USING_LITTLEFS + default n + endif endmenu @@ -467,6 +456,12 @@ menu "On-chip Peripheral Drivers" select RT_USING_DFS default n + config SDIO_MAX_FREQ + int "sdio max freq" + range 0 24000000 + depends on BSP_USING_SDIO + default 1000000 + config BSP_USING_USBD bool "Enable USB Device" select RT_USING_USB_DEVICE diff --git a/bsp/stm32/stm32f407-atk-explorer/board/SConscript b/bsp/stm32/stm32f407-atk-explorer/board/SConscript index f45fee08a8..c01bb6a129 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/SConscript +++ b/bsp/stm32/stm32f407-atk-explorer/board/SConscript @@ -27,7 +27,8 @@ if GetDepend(['BSP_USING_SPI_FLASH']): if GetDepend(['BSP_USING_FS']): src += Glob('ports/drv_filesystem.c') if GetDepend(['BSP_USING_SPI_FLASH_LITTLEFS']): - src += Glob('ports/fal_spi_flash_sfud_port.c') + src += Glob('ports/fal/fal_spi_flash_sfud_port.c') + path += [cwd + '/ports/fal'] if GetDepend(['BSP_USING_SRAM']): src += Glob('ports/drv_sram.c') 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 cafb45b107..c54157eb0d 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c @@ -11,15 +11,9 @@ */ #include - -#ifdef BSP_USING_FS #include #include #include -#include -#include -#include -#include #if DFS_FILESYSTEMS_MAX < 4 #error "Please define DFS_FILESYSTEMS_MAX more than 4" @@ -46,7 +40,7 @@ static int onboard_sdcard_mount(void) return RT_EOK; } -#endif +#endif /* BSP_USING_SDCARD_FATFS */ #ifdef BSP_USING_SPI_FLASH_LITTLEFS #include @@ -83,7 +77,7 @@ static int onboard_spiflash_mount(void) return RT_EOK; } -#endif +#endif /* BSP_USING_SPI_FLASH_LITTLEFS */ static const struct romfs_dirent _romfs_root[] = { @@ -96,7 +90,7 @@ static const struct romfs_dirent _romfs_root[] = #endif }; -const struct romfs_dirent romfs_root = +static const struct romfs_dirent romfs_root = { ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root) / sizeof(_romfs_root[0]) }; @@ -118,5 +112,3 @@ static int filesystem_mount(void) return RT_EOK; } INIT_APP_EXPORT(filesystem_mount); - -#endif /* BSP_USING_FS */ diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h b/bsp/stm32/stm32f407-atk-explorer/board/ports/fal/fal_cfg.h similarity index 100% rename from bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h rename to bsp/stm32/stm32f407-atk-explorer/board/ports/fal/fal_cfg.h diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_spi_flash_sfud_port.c b/bsp/stm32/stm32f407-atk-explorer/board/ports/fal/fal_spi_flash_sfud_port.c similarity index 100% rename from bsp/stm32/stm32f407-atk-explorer/board/ports/fal_spi_flash_sfud_port.c rename to bsp/stm32/stm32f407-atk-explorer/board/ports/fal/fal_spi_flash_sfud_port.c -- GitLab