[stm32f407-explorer]优化Kconfig文件系统命名,SFUD注册w25q128时命名自适应,避免用户多设置一步名称
This commit is contained in:
parent
963cce1e1b
commit
edf7e90020
|
@ -76,7 +76,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_SDCARD
|
config BSP_USING_SDCARD_FATFS
|
||||||
bool "Enable SDCARD (FATFS)"
|
bool "Enable SDCARD (FATFS)"
|
||||||
select BSP_USING_SDIO
|
select BSP_USING_SDIO
|
||||||
select RT_USING_DFS
|
select RT_USING_DFS
|
||||||
|
@ -93,7 +93,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default 1000000
|
default 1000000
|
||||||
|
|
||||||
config BSP_USING_SPI_FLASH_LITTLEFS
|
config BSP_USING_SPI_FLASH_LITTLEFS
|
||||||
bool "Enable LITTLEFS"
|
bool "Enable SPI-FLASH (LittleFS)"
|
||||||
select RT_USING_DFS
|
select RT_USING_DFS
|
||||||
select RT_USING_DFS_ROMFS
|
select RT_USING_DFS_ROMFS
|
||||||
select RT_USING_MTD_NOR
|
select RT_USING_MTD_NOR
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
|
|
||||||
#ifdef BSP_USING_SDCARD
|
#ifdef BSP_USING_SDCARD_FATFS
|
||||||
static void sd_mount(void *parameter)
|
static void sd_mount(void *parameter)
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -84,6 +84,7 @@ static int onboard_spiflash_mount(void)
|
||||||
struct rt_device *mtd_dev = RT_NULL;
|
struct rt_device *mtd_dev = RT_NULL;
|
||||||
|
|
||||||
fal_init();
|
fal_init();
|
||||||
|
|
||||||
mtd_dev = fal_mtd_nor_device_create(FS_PARTITION_NAME);
|
mtd_dev = fal_mtd_nor_device_create(FS_PARTITION_NAME);
|
||||||
if (!mtd_dev)
|
if (!mtd_dev)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +114,7 @@ static int onboard_spiflash_mount(void)
|
||||||
|
|
||||||
static const struct romfs_dirent _romfs_root[] =
|
static const struct romfs_dirent _romfs_root[] =
|
||||||
{
|
{
|
||||||
#ifdef BSP_USING_SDCARD
|
#ifdef BSP_USING_SDCARD_FATFS
|
||||||
{ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0},
|
{ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -133,7 +134,7 @@ static int filesystem_mount(void)
|
||||||
{
|
{
|
||||||
LOG_E("rom mount to '/' failed!");
|
LOG_E("rom mount to '/' failed!");
|
||||||
}
|
}
|
||||||
#ifdef BSP_USING_SDCARD
|
#ifdef BSP_USING_SDCARD_FATFS
|
||||||
onboard_sdcard_mount();
|
onboard_sdcard_mount();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,19 @@
|
||||||
#include "drv_spi.h"
|
#include "drv_spi.h"
|
||||||
|
|
||||||
#if defined(BSP_USING_SPI_FLASH)
|
#if defined(BSP_USING_SPI_FLASH)
|
||||||
|
|
||||||
|
#ifdef FAL_USING_NOR_FLASH_DEV_NAME
|
||||||
|
#define _SPI_FLASH_NAME FAL_USING_NOR_FLASH_DEV_NAME
|
||||||
|
#else
|
||||||
|
#define _SPI_FLASH_NAME "W25Q128"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int rt_hw_spi_flash_init(void)
|
static int rt_hw_spi_flash_init(void)
|
||||||
{
|
{
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
rt_hw_spi_device_attach("spi1", "spi10", GPIOB, GPIO_PIN_14);
|
rt_hw_spi_device_attach("spi1", "spi10", GPIOB, GPIO_PIN_14);
|
||||||
|
|
||||||
if (RT_NULL == rt_sfud_flash_probe("W25Q128", "spi10"))
|
if (RT_NULL == rt_sfud_flash_probe(_SPI_FLASH_NAME, "spi10"))
|
||||||
{
|
{
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue