We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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]!");
The SMC instruction (from a privileged processor mode) will cause the core to trap execution to the exception table in Monitor mode, just like a user-kernel switch using the "SVC" instruction. So you can't just drop an "SMC" inline with your program code, that's not likely to work.What does happen when you reach the monitor exception table is entirely down to the monitor mode software which is installed, so I can't help on that bit =)
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?KindlyMarcus
It is also worth noting that the "typical" user model is that the bootstrap (running in secure) sets up the platform, assigning periphals, TCM, etc to the correct worlds, and the proceeds with the boot of the higher levels of the system.It is unusual to want to re-partition resources after this point, especially things like TCM, so can't your bootloader do this?
It will be accessed in Non-secure world (cause I don't use TrustZone) but by default it's configured as secure TCM.