You probably don’t want to do this because of lower performance (~ 10x) and higher power consumption. That said, this is how you do it:
The MPLAB XC32 C compiler provides an easy to use cache configuration file:“pic32_init_cache.S” If youcopy this file into your local project directory it will override the default runtime setup code used to initialize the cache.
Change the “__PIC32_CACHE_MODE” from
“_CACHE_WRITEBACK_WRITEALLOCATE” to “_CACHE_DISABLE”
You can find this file in the following XC32 install directory:
…xc32/vx.xx/pic32-libs/libpic32/stubs
File: pic32_init_cache.S
/* Cache Coherency Attributes */#define _CACHE_WRITEBACK_WRITEALLOCATE 3#define _CACHE_WRITETHROUGH_WRITEALLOCATE 1#define _CACHE_WRITETHROUGH_NOWRITEALLOCATE 0#define _CACHE_DISABLE 2/* Set __PIC32_CACHE_MODE to the desired coherency attribute *///#define __PIC32_CACHE_MODE _CACHE_WRITEBACK_WRITEALLOCATE //default runtime setup policy#define __PIC32_CACHE_MODE _CACHE_DISABLENote: “__PIC32_CACHE_MODE” is used to define theKSEG0 cache coherency algorithm bits (K0<2:0>) found in the PIC32MZ’s “CONFIG” register. Please refer to the device data sheet for details.

