Hello, we are currently working on a project that involves using the TMS570LC43x microcontroller with a bare-metal software. This software employs a simple scheduling mechanism with two execution contexts: Code A, which runs in a periodic interrupt handler, and Code B, which executes in the background asynchronously to Code A. Our goal is to optimize the performance of Code A by enabling cache, while Code B work with cache disabled. There are sections of code shared between Code A and Code B, which will use a specific MPU region.
To achieve this, our plan is to reconfigure that shared code MPU region when switching to the Code A context, making it "MPU Cacheable." Then, when transitioning to Code B, we will reconfigure the MPU again to make it non-cacheable.
However, we have a concern: Changing the settings of an MPU region from cached to non-cached might invalidate the related cache entries. Therefore, we are uncertain about the safety of this approach. We would like to know if there are any potential issues or considerations we should take into account before proceeding with this approach.
Thank you