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 ?
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.