Alignment of buffers in ff.h #5
Labels
bug
Something isn't working
fs
File system-related issue or pull-request
internal bug tracker
Issue reported into a ticket in the internal bug tracking system
mw
Middleware-related issue or pull-request
spotted before customer
Spotted and fixed internally before being pointed out by users but not published yet
I am using FatFS library on STM32H723 MCU with FreeRTOS and DMA. I have encountered the issue mentioned here on the forum. When buffers are not aligned, file access functions like
f_read
returnFR_INT_ERR
as cache coherency operations probably don't work as expected. Turning theENABLE_SCRATCH_BUFFER
andENABLE_SD_DMA_CACHE_MAINTENANCE
defines on in sd_diskio.c template also does not help. I do not know if ST is able to fix those issues in the library, but the fix is simple, changestm32_mw_fatfs/src/ff.h
Line 125 in 5042a94
to
BYTE win[_MAX_SS] __attribute__((aligned(32)));
and
stm32_mw_fatfs/src/ff.h
Line 170 in 5042a94
to
BYTE buf[_MAX_SS] __attribute__((aligned(32)));
.Then the issue goes away completely.
The text was updated successfully, but these errors were encountered: