This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to enter Secure mode

Note: This was originally posted on 29th July 2011 at http://forums.arm.com

Hi all,
I want to use TCM in ARM1176ZJF-S core. It will be accessed in Non-secure world (cause I don't use TrustZone) but by default it's configured as secure TCM. So, it's not visible.  I need to change it to non-secure TCM which is indicated by the NS bit. According to the Ref, if I want to change the NS bit, I need to enter Secure privileged mode first.
My question is how can I enter that mode?
I tried the following, according to ARM1176JZF-S tech ref,

             asm("str     lr,[sp, #-4]!");
             asm("smc     #0");
             asm("mrc     p15, 0, %0, c9, c1, 2" 
                 : "=r" (tcm_secure));
             tcm_secure |= 1;
             asm("mcr     p15, 0, %0, c9, c1, 2"   /* set DTCM NS bit to 1 */
                 :
                 : "r" (tcm_secure));
             asm("movs    pc, lr");
             asm("ldr     lr, [sp, #0]!");


It doesn't work, however. Compiler says SMC is supported.
Please help, TCM troubles me for weeks.

Thanks for any input
Zova
Parents Reply Children
No data