Reputation: 823
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?
Upvotes: 8
Views: 9576
Reputation: 5073
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.
Upvotes: 19
Reputation: 1789
There is no 'hidden' cache inside the Cortex-M4. There is no documentation to support this, otherwise it wouldn't be hidden.
System level cache and TCM is of course a detail for the specific implementations, and for this reason the MPU can specify cache policy for different regions.
Upvotes: 1
Reputation: 3871
As far as I know there is no cache defined for the Cortex-M4 core and caches are not mentioned in the official Arm documentation for Cortex-M4. However, I know that many Cortex-M4 based micro controllers have caches, some only for flash accelerations others for access to ram as well. It is also common to have tightly coupled memory (TCM) instead of data caches as they give the program a more predictable behaviour.
Upvotes: 3