Hi Joey!
I am using the S32G2 in multi-core, the A53 are running Linux, and the M7 have a custom baremetal running on them.
Unfortunately I cannot share the code, but I can try to explain in detail what I am noticing.
The MPU entry for the DTCM was "mistakenly" set to cacheable, when I did set it to cacheable I started seeing unaligned access exceptions, after looking into the assembly, GCC was indeed generating unaligned word access on the DTCM (used as stack).
I then added -mno-unaligned-access to my gcc options and now I can set the DTCM MPU region to uncacheable without generating any exceptions.
It also seems to solve the bug I was after, trace data showed no spikes in function execution time.
But I am still puzzled by the effect of cache on the DTCM,
- Why having the MPU region set to cacheable "masks" the unaligned access exceptions ?
- Why disabling the cache, while keeping the MPU region as cacheable does not generate unaligned exceptions? and also as side effect, solve the execution time spikes?