当前位置:   article > 正文

RT-Thread--外部 flash 挂载 fatfs 文件系统_sfud fatfs

sfud fatfs

外部 flash 挂载 fatfs 文件系统

/*
 * 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 "dfs_file.h"
#include "drv_spi.h"
#include "spi_flash_sfud.h"

int main(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;
    };

    dfs_mkfs("elm", "W25Q128");

    if (dfs_mount("W25Q128", "/", "elm", 0, 0) == RT_EOK)
    {
        rt_kprintf("onchip elm filesystem mount to '/'\n");
    }
    else
    {
        rt_kprintf("onchip elm filesystem mount to '/' failed!\n");
    }
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/464076
推荐阅读
相关标签
  

闽ICP备14008679号