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.

Cold cache

Hi,

I'm running some memory tests and I would like to start the cache from cold before the tests. Is there a quick way of flushing the cache on my C6670 platform? The closest I can find is Cache_inv() but I can't be sure what it actually does...

Thank you.

Chiang

  • Chiang,

    CACHE_inv is the correct function.  Essentially, it marks the cache contents as invalid, so that any read from external memory will result in a miss and the real value will be fetched from external.  When a device is initially powered, the cache comes up in an invalidated state, so the first read from any location causes a similar fetch from external.

    Be sure to invalidate both the L1 and L2 caches.

    Regards,

    Dan

     

  • Assuming the CACHE calls are made from C code, use the writeback invalidate calls (CACHE_wbInvL1dWait(), CACHE_invL1pWait(), and CACHE_wbInvL2Wait()). 

    Use of the pure invalidate calls may discard initializations that occurred before the user code started.  Both BIOS (if used) and the C runtime library perform such initializations.  The writeback+invalidate will preserve these initializations.

    The L1P can be safely invalidated since it is read only.

    It is very rare where you would want to invalidate a whole data cache.  If you have a reason to invalidate, it almost always will be a block invalidate option.  The block invalidates are used for managing DMA buffers.  After the HW (or another core) writes the DMA buffer, the CPU performs a block invalidate to make sure it sees the new data written by the DMA.