From edf7e900204bae8852d6145044b3a2c34a3e4ea2 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Fri, 6 Aug 2021 15:15:56 +0800 Subject: [PATCH] =?UTF-8?q?[stm32f407-explorer]=E4=BC=98=E5=8C=96Kconfig?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=B3=BB=E7=BB=9F=E5=91=BD=E5=90=8D=EF=BC=8C?= =?UTF-8?q?SFUD=E6=B3=A8=E5=86=8Cw25q128=E6=97=B6=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=EF=BC=8C=E9=81=BF=E5=85=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=A4=9A=E8=AE=BE=E7=BD=AE=E4=B8=80=E6=AD=A5=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/stm32f407-atk-explorer/board/Kconfig | 4 ++-- .../stm32f407-atk-explorer/board/ports/drv_filesystem.c | 7 ++++--- .../stm32f407-atk-explorer/board/ports/spi_flash_init.c | 9 ++++++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bsp/stm32/stm32f407-atk-explorer/board/Kconfig b/bsp/stm32/stm32f407-atk-explorer/board/Kconfig index 8690baf177..70e0c09762 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/Kconfig +++ b/bsp/stm32/stm32f407-atk-explorer/board/Kconfig @@ -76,7 +76,7 @@ menu "Onboard Peripheral Drivers" bool default n - config BSP_USING_SDCARD + config BSP_USING_SDCARD_FATFS bool "Enable SDCARD (FATFS)" select BSP_USING_SDIO select RT_USING_DFS @@ -93,7 +93,7 @@ menu "Onboard Peripheral Drivers" default 1000000 config BSP_USING_SPI_FLASH_LITTLEFS - bool "Enable LITTLEFS" + bool "Enable SPI-FLASH (LittleFS)" select RT_USING_DFS select RT_USING_DFS_ROMFS select RT_USING_MTD_NOR 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 82f9c9c76b..529b1e1157 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/drv_filesystem.c @@ -28,7 +28,7 @@ #define DBG_LVL DBG_INFO #include -#ifdef BSP_USING_SDCARD +#ifdef BSP_USING_SDCARD_FATFS static void sd_mount(void *parameter) { while (1) @@ -84,6 +84,7 @@ 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) { @@ -113,7 +114,7 @@ static int onboard_spiflash_mount(void) static const struct romfs_dirent _romfs_root[] = { -#ifdef BSP_USING_SDCARD +#ifdef BSP_USING_SDCARD_FATFS {ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0}, #endif @@ -133,7 +134,7 @@ static int filesystem_mount(void) { LOG_E("rom mount to '/' failed!"); } -#ifdef BSP_USING_SDCARD +#ifdef BSP_USING_SDCARD_FATFS onboard_sdcard_mount(); #endif diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c b/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c index b92344fa43..b5e8571cd5 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c @@ -14,12 +14,19 @@ #include "drv_spi.h" #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) { __HAL_RCC_GPIOB_CLK_ENABLE(); 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; };