This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
hi,
MPU enable , cache enable in my program.
when I want to reset MCU, disable MPU , invalideCache , disable cache in sequence ?
thanks
Hi,
Invalidation of a cache means to clear it of data. The cache must always be invalidated after reset as its contents are undefined. If the cache contains dirty data, it is generally incorrect to invalidate it. Any updated data in the cache from writes to write-back cacheable regions would be lost by simple invalidation.
Cleaning a cache means writing the contents of dirty cache lines out to main memory and clearing the dirty bits in the cache line. This makes the contents of the cache line and main memory coherent with each other. This is only applicable for data caches in which a write-back policy is used.
So before MCU reset, the cache should be cleaned if the write-back policy is used in your code. After MCU reset, it is a good practice to invalidate the data cache.
Before you disable the MPU, you must clean and invalidate the data caches, then disable caches.