This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Enabling MPU causes clearing of Stack in Cortex R5F

Hi 

After enabling MPU, my stack is getting cleared. 

If the caches are disabled, it works fine. But when the caches are enabled, this problem occurs.

what is the relation between MPU and Cache in this context ?

Can anyone please explain. 


Thanks,

Parents
  • I suspect the answer is to do with changing of cache-ability.

    When the MPU on the Cortex-R5 is disabled, a "default" set of MPU regions are used. These are described here:
    developer.arm.com/.../About-the-MPU

    So, if you run with the MPU disabled and data cache enabled, some data accesses could result in lines being pulled into the data cache.  And, if the region is write-back, then writes might only be initially done into to the data cache. If you then enable the MPU, the Cortex-R5 will start using whatever properties you've now specified in the regions. If a given address goes from cacheable to non-cacheable, that could lead you no longer "seeing" data previous pulled into the data cache.

Reply
  • I suspect the answer is to do with changing of cache-ability.

    When the MPU on the Cortex-R5 is disabled, a "default" set of MPU regions are used. These are described here:
    developer.arm.com/.../About-the-MPU

    So, if you run with the MPU disabled and data cache enabled, some data accesses could result in lines being pulled into the data cache.  And, if the region is write-back, then writes might only be initially done into to the data cache. If you then enable the MPU, the Cortex-R5 will start using whatever properties you've now specified in the regions. If a given address goes from cacheable to non-cacheable, that could lead you no longer "seeing" data previous pulled into the data cache.

Children
No data