I am doing some benchmarking and I need to clear the cache before each test. I have this example here:
Caches and Self-Modifying Code
However, I just want to clean the whole cache. Is there an easy way to do that? I do not need to know the start and end address of the functions. I just want some simple code
Thanks.
Are you able to say if this is enough to clean the whole cache? Using the example in the OP
uint32_t * code = mmap(
NULL,
32768, // 32kb -- Whole Cache.
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS,
-1,
0);
Hi there,
I know that this is an old post, but I have a related question.
I should clean and invalidate the L2 cache on Cortex A9. Can I use your function? Instead of 32768 I will use 512000, the size of L2 cache.
It works?