This single processor demo application shows how to do the TrustZone Partitioning. It is split into a secure and non-secure part. Some peripherals are assigned to either the secure or the non-secure zone to demonstrate the generation of PPC setup and interrupt configuration in the partition.h template. Using CMSIS-Zone, it generates:
The application itself shows how to implement calls between the secure and the non-secure part and how to use this to blink an LED.
The M2351.azone file of that project has the following configuration settings:
Secure
and NonSecure
CODE_NS
, CODE_S
, Veneer
, DATA_NS
, and DATA_S
The zones use different Flash and SRAM regions for code and data. To generate the output, click on the Generate button in the Zone Editor tool bar. This creates the following files in the ftl_gen
directory:
Template File | Generated File | Description |
---|---|---|
helper.ftlinc | N/A | Helper template file with FTL functions. |
mem_layout.h.ftl | mem_layout.h | Header file that contains the memory region definitions, for example for the linker scatter file. |
partition_gen.h.ftl | partition_gen.h | Configuration of the secure attribution unit (SAU) and the NVIC interrupt assignment. |
scatter_ns.sct.ftl | scatter_ns.sct | Example scatter file for the non-secure zone. |
scatter_s.sct.ftl | scatter_s.sct | Example scatter file for the secure zone. |
These files can be used in any IDE to create the final application. In the following, the usage in Arm Keil MDK is described.
The example project can be loaded, built and debugged in µVision by performing the following steps:
Secure
as active project.The multiproject workspace contains the Secure
project and the NonSecure
project:
The projects use the files generated in CMSIS-Zone as follows:
File | Used in | Description |
---|---|---|
mem_layout.h | Secure, NonSecure | Input for the scatter files. |
partition_gen.h | Secure | Configuration of the secure attribution unit (SAU) and the NVIC interrupt assignment. |
scatter_ns.sct | NonSecure | Scatter file for non-secure zone (initally based on generated file). |
scatter_s.sct | Secure | Scatter file for secure zone (initally based on generated file). |
The scatter files scatter_s.sct
and scatter_ns.sct
are using a preinclude to mem_layout.h to get the information about the different memory regions.
As explained previously, the #defines in mem_layout.h
can be used to create generic scatter files that are easy to update once changes in the CMSIS-Zone project happen. Using the mem_layout.h file from CMSIS-Zone, the following scatter file is used in the Sections
project: