We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a question regarding declaring a variable as volatile. If the memory region is configured as cacheable by configuring the MPU and if the variable is declared as volatile, will it be cached ? If any reads from the core will result in direct main memory read always, though the region is cached ?
Hello
The compiler would have no knowledge of what memory regions are cacheable. If it is placed in a cacheable region, then yes, it will be cached.
Use scatter loading, and/or attribute settings to locate such a variable appropriately.
See https://developer.arm.com/documentation/101754/0620/armlink-Reference/Scatter-loading-Features/Root-region-and-the-initial-entry-point/Methods-of-placing-functions-and-data-at-specific-addresses/Placing-a-variable-at-a-specific-address-without-scatter-loading