Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsp/stm32/stm32l496-st-nucleo/applications/main.c
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down
3 changes: 3 additions & 0 deletions bsp/stm32/stm32l496-st-nucleo/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 2 additions & 20 deletions bsp/stm32/stm32l496-st-nucleo/board/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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 == 'gcc':
Expand Down
33 changes: 33 additions & 0 deletions bsp/stm32/stm32l496-st-nucleo/board/fal_cfg.h
Original file line number Diff line number Diff line change
@@ -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 <rtconfig.h>
#include <board.h>

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_ */
43 changes: 43 additions & 0 deletions bsp/stm32/stm32l496-st-nucleo/board/mnt_onchip.c
Original file line number Diff line number Diff line change
@@ -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 <rtthread.h>
#include <rtdevice.h>

#include "fal.h"
#include <dfs_fs.h>

#ifdef RT_USING_DFS
#include <dfs_fs.h>

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