/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-04-28 tyustli first version
*/#include<rtthread.h>#include<rtdevice.h>#include<board.h>#include"spi_flash.h"#include"spi_flash_sfud.h"#include"drv_spi.h"#define FS_PARTITION_NAME "filesystem"#include"fal.h"#include"dfs_file.h"intmain(int argc,char*argv[]){__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")){return-RT_ERROR;};fal_init();struct rt_device *flash_dev =fal_mtd_nor_device_create(FS_PARTITION_NAME);if(flash_dev ==NULL){rt_kprintf("Can't create a mtd device on '%s' partition.\n", FS_PARTITION_NAME);}else{rt_kprintf("Create a mtd device on the %s partition of flash successful.\n", FS_PARTITION_NAME);}if(rt_device_find(FS_PARTITION_NAME)!= RT_NULL){dfs_mkfs("lfs", FS_PARTITION_NAME);if(dfs_mount(FS_PARTITION_NAME,"/","lfs",0,0)== RT_EOK){rt_kprintf("onchip lfs filesystem mount to '/'\n");}else{rt_kprintf("onchip lfs filesystem mount to '/' failed!\n");}}else{rt_kprintf("find filesystem portion failed\r\n");}return RT_EOK;}