diff --git a/bsp/stm32/stm32l496-st-nucleo/applications/main.c b/bsp/stm32/stm32l496-st-nucleo/applications/main.c index 6c19612f99..691dadac22 100644 --- a/bsp/stm32/stm32l496-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32l496-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l496-st-nucleo/board/Kconfig b/bsp/stm32/stm32l496-st-nucleo/board/Kconfig index e4b311025e..084e549c37 100644 --- a/bsp/stm32/stm32l496-st-nucleo/board/Kconfig +++ b/bsp/stm32/stm32l496-st-nucleo/board/Kconfig @@ -96,6 +96,9 @@ menu "On-chip Peripheral Drivers" endif config BSP_USING_ON_CHIP_FLASH + select RT_USING_DFS + select RT_USING_DFS_ELMFAT + select RT_USING_FAL bool "Enable on-chip FLASH" default n diff --git a/bsp/stm32/stm32l496-st-nucleo/board/SConscript b/bsp/stm32/stm32l496-st-nucleo/board/SConscript index 6678edca06..617f20c65c 100644 --- a/bsp/stm32/stm32l496-st-nucleo/board/SConscript +++ b/bsp/stm32/stm32l496-st-nucleo/board/SConscript @@ -12,32 +12,14 @@ board.c CubeMX_Config/Src/stm32l4xx_hal_msp.c ''') -if GetDepend(['BSP_USING_QSPI_FLASH']): - src += Glob('ports/drv_qspi_flash.c') - -if GetDepend('BSP_USING_SPI_LCD'): - src = src + ['ports/drv_lcd.c'] +if GetDepend(['BSP_USING_ON_CHIP_FLASH']): + src += Glob('mnt_onchip.c') -if GetDepend(['BSP_USING_SDCARD']): - src += Glob('ports/sdcard_port.c') - -if GetDepend(['BSP_USING_ICM20608']) or GetDepend(['BSP_USING_AHT10']): - src += Glob('ports/sensor_port.c') - -if GetDepend(['BSP_USING_AUDIO']): - src += Glob('ports/audio/drv_es8388.c') - src += Glob('ports/audio/drv_sound.c') - -if GetDepend(['BSP_USING_AUDIO_RECORD']): - src += Glob('ports/audio/drv_mic.c') path = [cwd] path += [cwd + '/CubeMX_Config/Inc'] path += [cwd + '/ports'] -if GetDepend(['BSP_USING_AUDIO']): - path += [cwd + '/ports/audio'] - startup_path_prefix = SDK_LIB if rtconfig.PLATFORM in ['gcc']: diff --git a/bsp/stm32/stm32l496-st-nucleo/board/fal_cfg.h b/bsp/stm32/stm32l496-st-nucleo/board/fal_cfg.h new file mode 100644 index 0000000000..27d2a60c3e --- /dev/null +++ b/bsp/stm32/stm32l496-st-nucleo/board/fal_cfg.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2006-2022, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2022-06-08 supperthomas first version + */ + +#ifndef _FAL_CFG_H_ +#define _FAL_CFG_H_ + +#include +#include + +extern const struct fal_flash_dev stm32_onchip_flash; +/* flash device table */ +#define FAL_FLASH_DEV_TABLE \ +{ \ + &stm32_onchip_flash \ +} +/* ====================== Partition Configuration ========================== */ +#ifdef FAL_PART_HAS_TABLE_CFG +/* partition table */ +#define FAL_PART_TABLE \ +{ \ + {FAL_PART_MAGIC_WORD, "app", "onchip_flash", 0, 512*1024, 0}, \ + {FAL_PART_MAGIC_WORD, "flash", "onchip_flash", 512*1024, 512*1024, 0}, \ +} +#endif + +#endif /* _FAL_CFG_H_ */ diff --git a/bsp/stm32/stm32l496-st-nucleo/board/mnt_onchip.c b/bsp/stm32/stm32l496-st-nucleo/board/mnt_onchip.c new file mode 100644 index 0000000000..2b47ce748d --- /dev/null +++ b/bsp/stm32/stm32l496-st-nucleo/board/mnt_onchip.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2006-2022, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2022-06-08 supperthomas first version + */ + +#include +#include + +#include "fal.h" +#include + +#ifdef RT_USING_DFS +#include + +int mnt_init(void) +{ + fal_init(); +#define FS_PARTITION_NAME "flash" + struct rt_device *mtd_dev; + mtd_dev = fal_blk_device_create(FS_PARTITION_NAME); + if (dfs_mount(FS_PARTITION_NAME, "/", "elm", 0, 0) == 0) + { + rt_kprintf("Filesystem initialized!"); + } + else + { + dfs_mkfs("elm", FS_PARTITION_NAME); + if (dfs_mount(FS_PARTITION_NAME, "/", "elm", 0, 0) != 0) + { + rt_kprintf("Failed to initialize filesystem!"); + } + } + + return 0; +} +INIT_ENV_EXPORT(mnt_init); +#endif +