Skip to content

Commit 2f7c294

Browse files
mysterywolfGuozhanxin
authored andcommitted
[stm32f407-explorer][fs] 优化文件系统选项配置
1 parent 10695d6 commit 2f7c294

File tree

5 files changed

+32
-44
lines changed

5 files changed

+32
-44
lines changed

Diff for: bsp/stm32/stm32f407-atk-explorer/board/Kconfig

+27-32
Original file line numberDiff line numberDiff line change
@@ -134,40 +134,29 @@ menu "Onboard Peripheral Drivers"
134134
select BSP_USING_I2C1
135135
select PKG_USING_MPU6XXX
136136

137-
menu "Enable File System"
138-
config BSP_USING_FS
139-
bool
140-
default n
141-
142-
config BSP_USING_SDCARD_FATFS
143-
bool "Enable SDCARD (FATFS)"
144-
select BSP_USING_SDIO
145-
select RT_USING_DFS
146-
select RT_USING_DFS_ELMFAT
147-
select RT_USING_DFS_ROMFS
148-
select BSP_USING_FS
149-
default n
137+
menuconfig BSP_USING_FS
138+
bool "Enable File System"
139+
select RT_USING_DFS
140+
select RT_USING_DFS_ROMFS
141+
default n
150142

151-
config SDIO_MAX_FREQ
152-
int "sdio max freq"
153-
range 0 24000000
154-
depends on BSP_USING_SDCARD
155-
default 1000000
156-
157-
config BSP_USING_SPI_FLASH_LITTLEFS
158-
bool "Enable SPI-FLASH (LittleFS)"
159-
select RT_USING_DFS
160-
select RT_USING_DFS_ROMFS
161-
select RT_USING_MTD_NOR
162-
select BSP_USING_SPI_FLASH
163-
select BSP_USING_FS
164-
select RT_USING_FAL
165-
select FAL_USING_AUTO_INIT
166-
select FAL_PART_HAS_TABLE_CFG
167-
select PKG_USING_LITTLEFS
168-
default n
143+
if BSP_USING_FS
144+
config BSP_USING_SDCARD_FATFS
145+
bool "Enable SDCARD (FATFS)"
146+
select BSP_USING_SDIO
147+
select RT_USING_DFS_ELMFAT
148+
default n
169149

170-
endmenu
150+
config BSP_USING_SPI_FLASH_LITTLEFS
151+
bool "Enable SPI-FLASH (LittleFS)"
152+
select RT_USING_MTD_NOR
153+
select BSP_USING_SPI_FLASH
154+
select RT_USING_FAL
155+
select FAL_USING_AUTO_INIT
156+
select FAL_PART_HAS_TABLE_CFG
157+
select PKG_USING_LITTLEFS
158+
default n
159+
endif
171160

172161
endmenu
173162

@@ -467,6 +456,12 @@ menu "On-chip Peripheral Drivers"
467456
select RT_USING_DFS
468457
default n
469458

459+
config SDIO_MAX_FREQ
460+
int "sdio max freq"
461+
range 0 24000000
462+
depends on BSP_USING_SDIO
463+
default 1000000
464+
470465
config BSP_USING_USBD
471466
bool "Enable USB Device"
472467
select RT_USING_USB_DEVICE

Diff for: bsp/stm32/stm32f407-atk-explorer/board/SConscript

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ if GetDepend(['BSP_USING_SPI_FLASH']):
2727
if GetDepend(['BSP_USING_FS']):
2828
src += Glob('ports/drv_filesystem.c')
2929
if GetDepend(['BSP_USING_SPI_FLASH_LITTLEFS']):
30-
src += Glob('ports/fal_spi_flash_sfud_port.c')
30+
src += Glob('ports/fal/fal_spi_flash_sfud_port.c')
31+
path += [cwd + '/ports/fal']
3132

3233
if GetDepend(['BSP_USING_SRAM']):
3334
src += Glob('ports/drv_sram.c')

Diff for: bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c

+3-11
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@
1111
*/
1212

1313
#include <rtthread.h>
14-
15-
#ifdef BSP_USING_FS
1614
#include <dfs_romfs.h>
1715
#include <dfs_fs.h>
1816
#include <dfs_file.h>
19-
#include <unistd.h>
20-
#include <stdio.h>
21-
#include <sys/stat.h>
22-
#include <sys/statfs.h>
2317

2418
#if DFS_FILESYSTEMS_MAX < 4
2519
#error "Please define DFS_FILESYSTEMS_MAX more than 4"
@@ -46,7 +40,7 @@ static int onboard_sdcard_mount(void)
4640

4741
return RT_EOK;
4842
}
49-
#endif
43+
#endif /* BSP_USING_SDCARD_FATFS */
5044

5145
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
5246
#include <fal.h>
@@ -83,7 +77,7 @@ static int onboard_spiflash_mount(void)
8377

8478
return RT_EOK;
8579
}
86-
#endif
80+
#endif /* BSP_USING_SPI_FLASH_LITTLEFS */
8781

8882
static const struct romfs_dirent _romfs_root[] =
8983
{
@@ -96,7 +90,7 @@ static const struct romfs_dirent _romfs_root[] =
9690
#endif
9791
};
9892

99-
const struct romfs_dirent romfs_root =
93+
static const struct romfs_dirent romfs_root =
10094
{
10195
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_romfs_root, sizeof(_romfs_root) / sizeof(_romfs_root[0])
10296
};
@@ -118,5 +112,3 @@ static int filesystem_mount(void)
118112
return RT_EOK;
119113
}
120114
INIT_APP_EXPORT(filesystem_mount);
121-
122-
#endif /* BSP_USING_FS */

0 commit comments

Comments
 (0)