suikan4github / murasaki

STM32 HAL class library
MIT License
17 stars 3 forks source link

Cache handling API should not call when the D Cache is disabled. #156

Closed suikan4github closed 1 year ago

suikan4github commented 1 year ago

Describe the bug CleanDataCacheByAddress() sometimes causes Hard Fault if the D Cache is disabled in STMH7.

This is measured in the STM32H7 audio demo .

Expected behavior The CleanDataCacheByAddress() calls SCB_CleanDCache_by_Addr() of the CMSIS. This function must not call if the D Cache is disabled.

There is a related discussion on the BBS.

To fix it, wrap the entire function by

    if ( SCB->CCR & SCB_CCR_DC_Msk != 0 )
    {
    }

Where SCB->CCR DC is the status of Data Cache Enable. See ARM Cortex-M7 Devices Generic User Guide r1p0.

suikan4github commented 1 year ago

Merged to develop. Ready to release.