Skip to main content
Graduate II
November 21, 2025
Question

Bug in fx_stm32_sd_driver.c

  • November 21, 2025
  • 1 reply
  • 187 views

I think I have found a bug in the mentioned file (in my case the file comes from x-cube_azrtos-h7, but the problem seems to be present in other versions to).
In the function fx_stm32_sd_driver() there is a check that the passed Databuffer (media_ptr→fx_media_driver_buffer) is 4 Byte alligned, if this is true then the function sd_read_data() uses directly the passed buffer otherwise it uses a local scratch buffer. But after the DMA the function needs to invalidate the cache (by calling invalidate_cache_by_addr), on the Cortex M7 a cache line is 32 Byte.
This may overwrite data in the cache out side of the buffer.

Correction:
Set use_scratch_buffer to false only when fx_media_driver_buffer is 32 Byte aligned and a multiple of 32 Byte.

    This topic has been closed for replies.

    1 reply

    ST Employee
    December 3, 2025

    Hello @MHoll.2 , 

    Thank you for bringing this issue to our attention.

    I have escalated it to the relevant internal team for further investigation.

    Internal ticket number: 223007 (This is an internal tracking number and is not accessible or usable by customers).

    Kind regards, 

    DHIF Khaled