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
  • Note: This was originally posted on 31st July 2011 at http://forums.arm.com


    I suppose it would be far easier to just ignore TrustZone and stay in secure world. Why do you bother switching to non-secure at all?

    Kindly
    Marcus


    Thanks Marcus,
    I just want to put some data/code into TCM. It's okay to stay in secure world, but then, if I want to use TCM, I need to set the NS bit (to 0 according to the Tech Ref.) in the page table. Again, I think that's far more difficult for me to do that since MMU setup is done in bootloader and I don't know if there's any way to set that bit after booting has been done.
    All info I've got is:
    1 TCM is configured as Secure TCM
    2. TCM is visible in secure world only when NS bit in crossponding page table is set to zero.
    3. I want to put some code/data in TCM and access it
    4. I got this msg when run the example code in the topic [CLICK ME ]: Unhandled fault: external abort on non-linefetch (0x008) at 0x4001f000 Bus error

    So, in order to be simple and , more important, to be easier for me to go on( I'm a pretty new baby in the embedded world...) I think it's better to goto non-secure world and try to make it accordence to what's descriped in the Ref.

    Thanks,
    Zova
Reply
  • Note: This was originally posted on 31st July 2011 at http://forums.arm.com


    I suppose it would be far easier to just ignore TrustZone and stay in secure world. Why do you bother switching to non-secure at all?

    Kindly
    Marcus


    Thanks Marcus,
    I just want to put some data/code into TCM. It's okay to stay in secure world, but then, if I want to use TCM, I need to set the NS bit (to 0 according to the Tech Ref.) in the page table. Again, I think that's far more difficult for me to do that since MMU setup is done in bootloader and I don't know if there's any way to set that bit after booting has been done.
    All info I've got is:
    1 TCM is configured as Secure TCM
    2. TCM is visible in secure world only when NS bit in crossponding page table is set to zero.
    3. I want to put some code/data in TCM and access it
    4. I got this msg when run the example code in the topic [CLICK ME ]: Unhandled fault: external abort on non-linefetch (0x008) at 0x4001f000 Bus error

    So, in order to be simple and , more important, to be easier for me to go on( I'm a pretty new baby in the embedded world...) I think it's better to goto non-secure world and try to make it accordence to what's descriped in the Ref.

    Thanks,
    Zova
Children
No data