mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-20 20:17:29 +08:00
【修改】函数和宏命名,移除添加的文件
This commit is contained in:
parent
74b3bb0af3
commit
2ac8bc8864
@ -92,12 +92,12 @@ menu "Onboard Peripheral Drivers"
|
||||
depends on BSP_USING_SDCARD
|
||||
default 1000000
|
||||
|
||||
config BSP_USING_NOR_MTD_FS
|
||||
config BSP_USING_SPI_FLASH_LITTLEFS
|
||||
bool "Enable LITTLEFS"
|
||||
select RT_USING_DFS
|
||||
select RT_USING_DFS_ROMFS
|
||||
select RT_USING_MTD_NOR
|
||||
select BSP_USING_ON_CHIP_FLASH
|
||||
select BSP_USING_SPI_FLASH
|
||||
select BSP_USING_SPI_FLASH
|
||||
select BSP_USING_FS
|
||||
select RT_USING_SYSTEM_WORKQUEUE
|
||||
default n
|
||||
|
@ -20,7 +20,6 @@ if GetDepend(['BSP_USING_SPI_FLASH']):
|
||||
|
||||
if GetDepend(['BSP_USING_FS']):
|
||||
src += Glob('ports/drv_filesystem.c')
|
||||
src += Glob('ports/dfs_romfs.h')
|
||||
|
||||
if GetDepend(['BSP_USING_SRAM']):
|
||||
src += Glob('ports/drv_sram.c')
|
||||
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2019/01/13 Bernard code cleanup
|
||||
*/
|
||||
|
||||
#ifndef __DFS_ROMFS_H__
|
||||
#define __DFS_ROMFS_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#define ROMFS_DIRENT_FILE 0x00
|
||||
#define ROMFS_DIRENT_DIR 0x01
|
||||
|
||||
struct romfs_dirent
|
||||
{
|
||||
rt_uint32_t type; /* dirent type */
|
||||
|
||||
const char *name; /* dirent name */
|
||||
const rt_uint8_t *data; /* file date ptr */
|
||||
rt_size_t size; /* file size */
|
||||
};
|
||||
|
||||
int dfs_romfs_init(void);
|
||||
extern const struct romfs_dirent romfs_root;
|
||||
|
||||
#endif
|
@ -18,8 +18,6 @@
|
||||
#include <dfs_posix.h>
|
||||
#include <fal.h>
|
||||
|
||||
#define BSP_USING_NOR_MTD_FS
|
||||
|
||||
#if DFS_FILESYSTEMS_MAX < 4
|
||||
#error "Please define DFS_FILESYSTEMS_MAX more than 4"
|
||||
#endif
|
||||
@ -78,11 +76,11 @@ static int onboard_sdcard_mount(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_NOR_MTD_FS
|
||||
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
|
||||
|
||||
#define FS_PARTITION_NAME "filesystem"
|
||||
|
||||
static void mtd_mount(void *parameter)
|
||||
static void spiflash_mount(void *parameter)
|
||||
{
|
||||
struct rt_device *mtd_dev = RT_NULL;
|
||||
fal_init();
|
||||
@ -98,28 +96,28 @@ static void mtd_mount(void *parameter)
|
||||
{
|
||||
if (dfs_mount(FS_PARTITION_NAME, "/flash", "lfs", 0, 0) == RT_EOK)
|
||||
{
|
||||
LOG_I("mtd nor flash mount to '/flash'");
|
||||
LOG_I("spi flash mount to '/flash'");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_W("mtd nor flash mount to '/flash' failed!");
|
||||
LOG_W("spi flash mount to '/flash' failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int onboard_mtd_mount(void)
|
||||
static int onboard_spiflash_mount(void)
|
||||
{
|
||||
rt_thread_t tid;
|
||||
|
||||
if (dfs_mount(FS_PARTITION_NAME, "/flash", "lfs", 0, 0) == RT_EOK)
|
||||
{
|
||||
LOG_I("mtd nor flash mount to '/flash'");
|
||||
LOG_I("spi flash mount to '/flash'");
|
||||
}
|
||||
else
|
||||
{
|
||||
tid = rt_thread_create("mtd_mount", mtd_mount, RT_NULL,
|
||||
tid = rt_thread_create("spiflash_mount", spiflash_mount, RT_NULL,
|
||||
1024, RT_THREAD_PRIORITY_MAX - 3, 20);
|
||||
if (tid != RT_NULL)
|
||||
{
|
||||
@ -127,7 +125,7 @@ static int onboard_mtd_mount(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_E("create mtd_mount thread err!");
|
||||
LOG_E("create spiflash_mount thread err!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,11 +139,10 @@ static const struct romfs_dirent _romfs_root[] =
|
||||
#ifdef BSP_USING_SDCARD
|
||||
{ROMFS_DIRENT_DIR, "sdcard", RT_NULL, 0},
|
||||
#endif
|
||||
#ifdef BSP_USING_NOR_MTD_FS
|
||||
|
||||
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
|
||||
{ROMFS_DIRENT_DIR, "flash", RT_NULL, 0},
|
||||
#endif
|
||||
|
||||
// {ROMFS_DIRENT_DIR, "flash", RT_NULL, 0},
|
||||
};
|
||||
|
||||
const struct romfs_dirent romfs_root =
|
||||
@ -163,8 +160,8 @@ static int filesystem_mount(void)
|
||||
onboard_sdcard_mount();
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_NOR_MTD_FS
|
||||
onboard_mtd_mount();
|
||||
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
|
||||
onboard_spiflash_mount();
|
||||
#endif
|
||||
|
||||
return RT_EOK;
|
||||
|
@ -14,17 +14,16 @@
|
||||
#include <rtthread.h>
|
||||
#include <board.h>
|
||||
|
||||
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
|
||||
extern struct fal_flash_dev nor_flash0;
|
||||
#else
|
||||
#define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
|
||||
#define FLASH_SIZE_GRANULARITY_64K (64 * 1024)
|
||||
#define FLASH_SIZE_GRANULARITY_128K (7 * 128 * 1024)
|
||||
|
||||
#define STM32_FLASH_START_ADRESS_16K STM32_FLASH_START_ADRESS
|
||||
#define STM32_FLASH_START_ADRESS_64K (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
|
||||
#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
|
||||
|
||||
#ifdef BSP_USING_NOR_MTD_FS
|
||||
extern struct fal_flash_dev nor_flash0;
|
||||
#else
|
||||
extern const struct fal_flash_dev stm32_onchip_flash_16k;
|
||||
extern const struct fal_flash_dev stm32_onchip_flash_64k;
|
||||
extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||
@ -32,7 +31,7 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||
|
||||
|
||||
/* flash device table */
|
||||
#ifdef BSP_USING_NOR_MTD_FS
|
||||
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
|
||||
#define FAL_FLASH_DEV_TABLE \
|
||||
{ \
|
||||
&nor_flash0, \
|
||||
@ -50,10 +49,10 @@ extern const struct fal_flash_dev stm32_onchip_flash_128k;
|
||||
#ifdef FAL_PART_HAS_TABLE_CFG
|
||||
|
||||
/* partition table */
|
||||
#ifdef BSP_USING_NOR_MTD_FS
|
||||
#ifdef BSP_USING_SPI_FLASH_LITTLEFS
|
||||
#define FAL_PART_TABLE \
|
||||
{ \
|
||||
{FAL_PART_MAGIC_WROD, "filesystem",FAL_USING_NOR_FLASH_DEV_NAME, 0 , 1024 * 1024, 0}, \
|
||||
{FAL_PART_MAGIC_WROD, "filesystem",FAL_USING_NOR_FLASH_DEV_NAME, 0 , 16 * 1024 * 1024, 0}, \
|
||||
}
|
||||
#else
|
||||
#define FAL_PART_TABLE \
|
||||
|
Loading…
x
Reference in New Issue
Block a user