Search code examples
cachingarmmicrocontrollercpu-cachecortex-m

Is there a cache in the ARM Cortex-M4?


I want to know if there is a cache inside the ARM Cortex-M4.

I did not find any clue in the technical reference manual, but is that official or hidden? I know that some microcontrollers have a cache, but then it's between the bus and the RAM, not inside the core.

Do you know of any document that clarifies this?


Solution

  • Short answer:

    No, there is no cache inside the ARM Cortex-M4 core.

    Long answer:

    According to the Wikipedia page about ARM Cortex-M (link) the instruction and data caches are silicon options for the Cortex-M architecture, and the Cortex-M4 does not include such caches.

    A reliable source is ARM Application Note 321: ARM Cortex™-M Programming Guide to Memory Barrier Instructions (html / pdf), which states:

    The Cortex-M0, Cortex-M0+, Cortex-M1, Cortex-M3, and Cortex-M4 processors do not have any internal cache memory. However, it is possible for a SoC design to integrate a system level cache.

    It then follows with:

    Note: A small caching component is present in the Cortex-M3 and Cortex-M4 processors to accelerate flash memory accesses during instruction fetches.

    Also, later in the same application note it mentions:

    Some Cortex-M3 and Cortex-M4 designs might have an implementation specific program cache to accelerate program memory accesses.

    So, to summarize, the ARM Cortex-M4 core does not contain a (relevant) cache.

    However, it is recommended to check the datasheet of the actual microcontroller you are using. For example, the NXP i.MX 7 Series (link) does include a Cortex-M4 with instruction and data cache, but as you already state in your question, this is outside the core.