cancel
Showing results for 
Search instead for 
Did you mean: 

SCB_CleanDCache_by_Addr needs to accept an address not 32 byte aligned.

Thomas E.
Associate II

The function SCB_CleanDCache_by_Addr needs to be able to handle address that are not 32 byte aligned, but expanding the data cache flushing region to conforming addresses that included the requested region.

netXduo calls the function regardless of regions and does not expand the region to the 32 byte alignment.

Thus current our mitigation is completely turn off data caching on the part.

STM please fix. As of 2021.10.23 using the latest H7 pack and STM32cubeMX.

5 REPLIES 5
TDK
Guru

> The function SCB_CleanDCache_by_Addr needs to be able to handle address that are not 32 byte aligned

Blindly expanding the region so it matches a 32-byte boundary will introduce other problems. The array itself needs to be aligned and a multiple of 32-bytes. This is not something that can be solved within the SCB_CleanDCache_by_Addr function.

If you feel a post has answered your question, please click "Accept as Solution".
Piranha
Chief II

Those functions were fixed (implementing the address and size expansion) by ARM long ago:

https://github.com/ARM-software/CMSIS_5/commit/ab35be31712f978b8b031d6438ea180c107cf171

Just check/update the CMSIS core related include files. ST is terribly slow in updating anything, but the current version is correct.

https://github.com/STMicroelectronics/STM32CubeH7/blob/5975bffae9358bc2b2890a35a203d940a395efef/Drivers/CMSIS/Include/core_cm7.h#L2542

As TDK said, it doesn't magically solve all cache related problems. For proper usage of those functions, read my post here:

https://community.st.com/s/question/0D53W00000oXSzySAG/different-cache-behavior-between-stm32h7-and-stm32f7

Well then a bug should be filed against NetX?

Interesting, thanks for the thought. I will have to investigate more.

@Pavel A.​. could be checkin vs. egg, but to y'alls point, it looks like netXduo started to add fixes for it. But did not get all the way.

0693W00000FDWmIQAX.png 

Again, thanks for the input.

What immediately looks wrong in the above snippet: there's no definition for the CPU cache line size.

The buffer management layer of netX (?) must know it to allocate the buffers aligned on this size.

Otherwise, as @piranha and @TDK noted, clean/invalidate just will introduce subtle bugs or undefined behavior.