Skip to content

Commit ad25b22

Browse files
authored
Merge pull request #2 from mysterywolf/littlefs-check
[stm32f407-explorer]优化Kconfig文件系统命名,SFUD注册w25q128时命名自适应,避免用户多设置一步名称
2 parents 9422f72 + edf7e90 commit ad25b22

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

bsp/stm32/stm32f407-atk-explorer/board/Kconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ menu "Onboard Peripheral Drivers"
7676
bool
7777
default n
7878

79-
config BSP_USING_SDCARD
79+
config BSP_USING_SDCARD_FATFS
8080
bool "Enable SDCARD (FATFS)"
8181
select BSP_USING_SDIO
8282
select RT_USING_DFS
@@ -93,7 +93,7 @@ menu "Onboard Peripheral Drivers"
9393
default 1000000
9494

9595
config BSP_USING_SPI_FLASH_LITTLEFS
96-
bool "Enable LITTLEFS"
96+
bool "Enable SPI-FLASH (LittleFS)"
9797
select RT_USING_DFS
9898
select RT_USING_DFS_ROMFS
9999
select RT_USING_MTD_NOR

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define DBG_LVL DBG_INFO
2929
#include <rtdbg.h>
3030

31-
#ifdef BSP_USING_SDCARD
31+
#ifdef BSP_USING_SDCARD_FATFS
3232
static void sd_mount(void *parameter)
3333
{
3434
while (1)
@@ -84,6 +84,7 @@ static int onboard_spiflash_mount(void)
8484
struct rt_device *mtd_dev = RT_NULL;
8585

8686
fal_init();
87+
8788
mtd_dev = fal_mtd_nor_device_create(FS_PARTITION_NAME);
8889
if (!mtd_dev)
8990
{
@@ -113,7 +114,7 @@ static int onboard_spiflash_mount(void)
113114

114115
static const struct romfs_dirent _romfs_root[] =
115116
{
116-
#ifdef BSP_USING_SDCARD
117+
#ifdef BSP_USING_SDCARD_FATFS
117118
{ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0},
118119
#endif
119120

@@ -133,7 +134,7 @@ static int filesystem_mount(void)
133134
{
134135
LOG_E("rom mount to '/' failed!");
135136
}
136-
#ifdef BSP_USING_SDCARD
137+
#ifdef BSP_USING_SDCARD_FATFS
137138
onboard_sdcard_mount();
138139
#endif
139140

bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@
1414
#include "drv_spi.h"
1515

1616
#if defined(BSP_USING_SPI_FLASH)
17+
18+
#ifdef FAL_USING_NOR_FLASH_DEV_NAME
19+
#define _SPI_FLASH_NAME FAL_USING_NOR_FLASH_DEV_NAME
20+
#else
21+
#define _SPI_FLASH_NAME "W25Q128"
22+
#endif
23+
1724
static int rt_hw_spi_flash_init(void)
1825
{
1926
__HAL_RCC_GPIOB_CLK_ENABLE();
2027
rt_hw_spi_device_attach("spi1", "spi10", GPIOB, GPIO_PIN_14);
2128

22-
if (RT_NULL == rt_sfud_flash_probe("W25Q128", "spi10"))
29+
if (RT_NULL == rt_sfud_flash_probe(_SPI_FLASH_NAME, "spi10"))
2330
{
2431
return -RT_ERROR;
2532
};

0 commit comments

Comments
 (0)