Hello everyone:
I'm trying to leverage the __attribute__((section(.ramfunc))) to execute function in RAM. However, a handfault error happened when it execute the instruction in the ram address.
My board is SAML11 Xplained Pro,Cortex-M23 core and the excution is in secure world.
The code runs in Thumb mode and the bx address is odd.
Has anyone met the same problem?
I have checked that the MPU is disabled.
Ok, so this might be the reason. I do not have the default map at hand, but IIRC, by default RAM is NX, so you need to setup the MPU and mark the RAM region as executable.
Thank you! I have found the trick is in the USER_ROW where is a RAM XN bit!