2021-10-23 06:58 AM
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.
2021-10-23 07:22 AM
> 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.
2021-10-23 07:50 AM
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.
As TDK said, it doesn't magically solve all cache related problems. For proper usage of those functions, read my post here:
2021-10-23 08:59 AM
Well then a bug should be filed against NetX?
2021-10-23 09:21 AM
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.
Again, thanks for the input.
2021-10-23 09:29 AM
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.