Change Cache Policy

The MPLAB® XC32 C compiler provides an easy to use cache configuration file: “pic32_init_cache.S” If you copy this file into your local project directory it will override the default runtime setup code used to initialize the cache. The default runtime setup code initializes the cache policy to write-back with write allocation.

You can find this file in the following XC32 install directory:

File: pic32_init_cache.S

/* Cache Coherency Attributes */
#define _CACHE_DISABLE                      2

/* Set __PIC32_CACHE_MODE to the desired coherency attribute */
#define __PIC32_CACHE_MODE      _CACHE_WRITEBACK_WRITEALLOCATE    //default runtime setup policy

Note: “__PIC32_CACHE_MODE” is used to define the KSEG0 cache coherency algorithm bits (K0<2:0>) found in the PIC32MZ’s “CONFIG” register. Please refer to the device data sheet for details.

20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.