This is probably a dumb question, but I'm a bit stuck on the wording of the ARM CMSIS Cache manipulation functions.
The ARM CMSIS exposes functions that can "clean" cache, functions that can "invalidate" cache, and a set of functions that do both.
What these actually do is not clear, and the arm documentation is frankly confusing me:
- You can invalidate the whole data cache (flush data cache) in one operation without writing back dirty data.
- You can invalidate individual lines without writing back any dirty data (flush data cache single entry).
- You can perform cleaning on a line-by-line basis. The data is only written back through the write buffer when a dirty line is encountered, and the cleaned line remains in the cache (clean data cache single entry). You can clean cache lines using either their index within the data cache, or their address within memory.
- You can clean and flush individual lines in one operation, using either their index within the data cache, or their address within memory.
My understanding is that "flushing" data in cache will result in it being written back to main memory, and "invalidating" data in cache will cause the processor to re-read the main memory on the next attempt to access the data in question.
However, the ARM docs seem to be be implying that a flush operation is actually an invalidation operation, and what I've been thinking is a flush operation is actually a "clean" operation.
I assume I'm just grossly misinterpreting the documentation. Can someone point me in the right direction?
I'm specifically developing for a cortex M7, if it's relevant.