YH_505 发表于 2023-8-5 16:56:58

fatfs R0.15 使能FF_FS_EXFAT 后不可使用f_read()

本帖最后由 YH_505 于 2023-8-5 17:05 编辑

stm32f103平台移植了fatfs R0.15, 官网代码: http://elm-chan.org/fsw/ff/00index_e.html

使能了 “ #define FF_FS_EXFAT                1”, 有如下奇怪现象:
1. f_mout() 正常
2. 创建文件, f_write() 正常
3. f_open() f_findfirst()正常
但是只要工程中f_read()参与编译,任意地方使用f_read(), 都会导致上述功能不正常
只要关闭FF_FS_EXFAT 支持, fatfs全部功能都正常,但是这样就无法支持大容量卡了{:dizzy:}

按理大牛的不应该有这样的问题, 附上
/*********************************************************************************************************************/
另外R0.15 版本提供了stm32的例程,使用IAR8.40.1时, 只能使用low以下优化,
使用midium、high优化等级, 会锁死在xchg_spi()处, 官方驱动好处时在批量读写时切换SPI为16bit模式,暂时未作深究

/* Exchange a byte */
static BYTE xchg_spi (
        BYTE dat        /* Data to send */
)
{
        SPIx_DR = dat;                                /* Start an SPI transaction */
        while ((SPIx_SR & 0x83) != 0x03) ;        /* Wait for end of the transaction */
        return (BYTE)SPIx_DR;                /* Return received byte */
}

yuyu87 发表于 2023-8-5 17:26:44

先把fatfs的宏相关功能全部开启=1试试

YH_505 发表于 2023-8-5 17:42:58

yuyu87 发表于 2023-8-5 17:26
先把fatfs的宏相关功能全部开启=1试试
(引用自2楼)

EXFAT相关的,官方文档说明只和长文件名相关

YH_505 发表于 2023-8-5 17:49:01

官方说明有这么一句:
Note that enabling exFAT discards ANSI C (C89) compatibility
请注意,启用 exFAT 会丢弃 ANSI C (C89) 兼容性

应该和这个相关, 但是IAR编译设置选择的是Standard C, 不知道是否和ARM官方库还有关,比如R0.15版本依赖string.h, 但是官方库又是C89标准

hpdell 发表于 2023-9-25 15:57:12

YH_505 发表于 2023-8-5 17:49
官方说明有这么一句:
Note that enabling exFAT discards ANSI C (C89) compatibility
请注意,启用 exFAT...

没有用过 r0.15 , 目前还是使用 r0.14b


#define FF_FS_EXFAT                1
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
/To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
/Note that enabling exFAT discards ANSI C (C89) compatibility. */



这个FF_USE_LFN宏也需要定义为 1 才行
页: [1]
查看完整版本: fatfs R0.15 使能FF_FS_EXFAT 后不可使用f_read()