7.5.1 CMCC-based Tightly-Coupled Memory
Some SAM microcontrollers based on the Cortex®-M4, such as the SAME54 or SAMD51, feature a ARM Cortex-M Cache Controller (CMCC) peripheral. With CMCC, a part of the cache can be used as Tightly-Coupled Memory (TCM) for deterministic code performance by loading the critical code in a WAY and locking it.
To have functions and objects placed into CMCC-based TCM, use the tcm
attribute with those functions and objects which need to be repositioned, then use the
-mtcm=size
option to set the size (in bytes)
of the TCM and ensure that the device-specific runtime startup code and linker script
configure the TCM. The size
specified must be one
permitted by the device and can be specified as a decimal number or as a hexadecimal
number with a leading 0x
. When an invalid size has been specified,
check the error message to see the sizes acceptable by that device. Once enabled, the
preprocessor macro __XC32_TCM_LENGTH
will be defined and equated to the
size of the TCM area.