[bsp][stm32l496zg] add on-chip feature (#6056)
* [bsp][stm32l496zg] add on-chip feature
This commit is contained in:
parent
8b60b58b51
commit
5e0810e756
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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']:
|
||||
|
|
|
@ -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_ */
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue