|
| 1 | +The M2351 is a TrustZone target that requires two codes: secure and nonsecure. Secure code runs first to set up the secure environment and then brings up the nonsecure code. `NuMaker-mbed-TZ-secure-example.hex` is the pre-built secure image, and `cmse_lib.o` is its accompanying |
| 2 | +secure gateway library, which exports secure functions to nonsecure code. It is built from the [non-PSA secure code template](https://github.com/OpenNuvoton/NuMaker-mbed-TZ-secure-example). Because secure and nonsecure code may start at an address other than `0x0`, we have chosen `.hex` rather than `.bin` as the output format. |
| 3 | + |
| 4 | +## Hardware partition |
| 5 | + |
| 6 | +On TrustZone targets, you need to partition the hardware first for secure code to run on secure world and nonsecure code to run on nonsecure world. |
| 7 | + |
| 8 | +The pre-built secure code has the following hardware partition: |
| 9 | + |
| 10 | +- Flash (512KiB in total): 256KiB for secure and 256KiB for nonsecure. |
| 11 | +- SRAM (96KiB in total): 32KiB for secure and 64KiB for nonsecure. |
| 12 | +- Peripherals: Most are configured to nonsecure except the following, which are hardwired or reserved: |
| 13 | + - **SYS/CLK** hardwired to secure. Accessible to nonsecure through a secure gateway. |
| 14 | + - **FMC** hardwired to secure. Accessible to nonsecure through a secure gateway. |
| 15 | + - **WDT** hardwired to secure. Accessible to nonsecure through a secure gateway. |
| 16 | + - **RTC** configured to secure. Accessible to nonsecure through a secure gateway. |
| 17 | + - **TMR0/1** hardwired to secure. TMR0 implements secure `us_ticker`, and TMR1 implements secure `lp_ticker`. |
| 18 | + - **TMR2/3** configured to nonsecure. TMR2 implements nonsecure `us_ticker`, and TMR3 implements nonsecure `lp_ticker`. |
| 19 | + - **PDMA0** hardwired to secure. Implements secure asynchronous transfer. |
| 20 | + - **PDMA1** configured to nonsecure. Implements nonsecure asynchronous transfer. |
| 21 | + |
| 22 | +## Pre-built secure code files |
| 23 | + |
| 24 | +- NuMaker-mbed-TZ-secure-example.hex |
| 25 | + Pre-built secure image generated in non-PSA secure target build and to combine with non-secure image in non-PSA non-secure target post-build |
| 26 | +- cmse_lib.o |
| 27 | + Pre-built secure gateway library generated in non-PSA secure target build and to link with non-secure code in non-PSA non-secure target build |
| 28 | + |
| 29 | +## Reference |
| 30 | + |
| 31 | +Please refer to the [non-PSA secure code template](https://github.com/OpenNuvoton/NuMaker-mbed-TZ-secure-example) for details. |
0 commit comments