Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment of buffers in ff.h #5

Open
khevessy opened this issue Jan 17, 2023 · 2 comments
Open

Alignment of buffers in ff.h #5

khevessy opened this issue Jan 17, 2023 · 2 comments
Assignees
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

Comments

@khevessy
Copy link

khevessy commented Jan 17, 2023

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 return FR_INT_ERR as cache coherency operations probably don't work as expected. Turning the ENABLE_SCRATCH_BUFFER and ENABLE_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, change

BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */

to

BYTE win[_MAX_SS] __attribute__((aligned(32)));

and

BYTE buf[_MAX_SS]; /* File private data read/write window */

to

BYTE buf[_MAX_SS] __attribute__((aligned(32)));.

Then the issue goes away completely.

@ALABSTM ALABSTM added mw Middleware-related issue or pull-request fs File system-related issue or pull-request labels May 15, 2023
@ALABSTM ALABSTM assigned TOUNSTM and unassigned HBOSTM Jan 23, 2024
@TOUNSTM TOUNSTM added bug Something isn't working internal bug tracker Issue reported into a ticket in the internal bug tracking system labels Feb 6, 2024
@TOUNSTM
Copy link

TOUNSTM commented Feb 6, 2024

Hello @khevessy,

Thank you for your contribution. You are absolutely right about this point.
Actually, the point you raised has already been dealt and fixed internally. The fix will be made available in the frame of a future release.

Thank you again for your contribution. We are looking forward to reading from you again.

With regards,

@TOUNSTM TOUNSTM added the spotted before customer Spotted and fixed internally before being pointed out by users but not published yet label Feb 6, 2024
@TOUNSTM
Copy link

TOUNSTM commented Feb 6, 2024

ST Internal Reference: 133958

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: To release
Development

No branches or pull requests

4 participants