- This ARM Cortex-M33 secure/non-secure example project shows how to setup the TrustZone for running on ARMv8-M profile.
- The application uses CMSIS and can be executed on an Arm Virtual Hardware (AVH).
- The application demonstrates function calls between secure and non-secure state.
- CMSIS-Toolbox 2.6.0 or higher
- Arm Compiler 6.22 or higher
- Arm Virtual Hardware for FVP_MPS2_Cortex-M33 v11.26.11
- Required packs are listed in the file
SimpleTZ.csolution.yml
The project is generated using the CMSIS-Toolbox and is defined in csolution
format:
SimpleTZ.csolution.yml
lists the required packs, defines, hardware targets, and the build-types (along with the compiler).CM33_s.cproject.yml
defines the source files and the software components used for the secure part.CM33_ns.cproject.yml
defines the source files and the software components used for the non-secure part.
- Setup code and start for the non-secure application.
- Calls a secure function from non-secure state.
- Calls a secure function that call back to a non-secure function.
- Message :
- Switch from the secure execution to the non-secure execution.
- Messages :
- Start program execution in the non-secure state
- Show function calls and results of the program execution in the non-secure state
Note that the file SimpleTZ.cbuild-set.yml contains the selected context set for the application.
> cbuild SimpleTZ.csolution.yml --packs .Debug+AVH --toolchain AC6 --context-set
> FVP_MPS2_Cortex-M33 -a ./out/CM33_ns/AVH/Debug/CM33_ns.axf -a ./out/CM33_s/AVH/Debug/CM33_s.axf -f ./../FVP/FVP_MPS2_Cortex-M33/fvp_config.txt --stat
telnetterminal0: Listening for serial connection on port 5000
telnetterminal1: Listening for serial connection on port 5001
telnetterminal2: Listening for serial connection on port 5002
Jump to non-secure application at 0x00201565
Non-secure application...
func1(1) = 4
func2(func3, 2) = 9
Info: /OSCI/SystemC: Simulation stopped by user.
--- FVP_MPS2_Cortex_M33 statistics: -------------------------------------------
Simulated time : 0.000400s
User time : 0.004335s
System time : 0.004148s
Wall time : 0.008444s
Performance index : 0.05
cpu0 : 1.37 MIPS ( 11610 Inst)
cpu1 : 0.00 MIPS ( 0 Inst)
Total : 1.37 MIPS ( 11610 Inst)
Memory highwater mark : 0x11278000 bytes ( 0.268 GB )
-------------------------------------------------------------------------------