Development approaches
- Single-developer approach: The developer (customer) is in charge of developing secure and nonsecure application. The user application can be protected by using RDP level 1 or RDP level 2.
Figure 12. Single-developer approach 
- Dual-developer approach: The first developer (customer 1) is in charge to develop the secure application and its associated nonsecure callable library (.lib/.h), and to provide a predefined linker file to the second developer (customer 2) who is in charge to develop the nonsecure application. This secure application is then loaded in the STM32L5/U5/U3 secure flash memory and protected using RDP level 0.5 to prevent further access to the secure memory region of the device. The second developer (customer 2) then starts his development on a preprogrammed STM32L5/U5/U3 using a linker file and the nonsecure callable library provided by customer 1.
When the RDP level is set to level 0.5, the customer 1 who provisions the secure flash memory part, must also think about the way to enable the JTAG/SWD for the nonsecure side (for customer 2) after booting in the secure side. For this reason, the customer 1 must implement a switch function that handovers to the nonsecure flash memory, to allow the customer 2 to develop the nonsecure part, and then may be to lock the device to RDP level 1 or level 2.
Figure 13. Dual-developer approach 
For more details, refer to sections 'Product life-cycle' and 'Software intellectual property protection and collaborative development' in the document AN5347_General-info.html#id_13614__entry_kq3_jtd_wkb or AN5347_General-info.html#id_13614__entry_vrc_1mc_4qb.
Using nonsecure peripherals
When a peripheral is allocated to the nonsecure world, both secure and nonsecure applications can access the peripheral registers.
In the nonsecure world , TrustZone for Armv8-M considerations are totally transparent for the developer. On the secure‑world side, the application must ensure that all system resources required by the peripheral are preconfigured, or available to the nonsecure world (such as GPIO, NVIC or DMA).
Using secure peripherals
When a peripheral is allocated to the secure world, only secure register accesses are granted. Interrupt handling must be managed in the secure world only. Two different software development approaches can be adopted depending on the software interaction requirements between secure and nonsecure projects to use this peripheral.
When working with peripherals that do not require specific interaction with the nonsecure world, the secure world drives them as a standard peripheral without any specific considerations.
If interactions between nonsecure and secure worlds are required to drive the secure peripherals, the secure application must provide nonsecure callable APIs and callbacks to the nonsecure world.
Conclusion
The Arm TrustZone technology partitions hardware into secure and nonsecure worlds.
Through the IDAU that defines fixed memory-map security attribution with the user configurable SAU and other features (in flash memory and GTZC), all of STM32 MCU resources are configurable in both secure and nonsecure worlds, including the memory map, the flash memory, SRAM, external memories, peripherals, and peripheral interrupts.
Revision history
| Date | Version | Changes |
|---|---|---|
| 11-Oct-2019 | 1 | Initial release. |
| 14-Oct-2019 | 2 | Updated Figure 6. Memory and peripheral data access rules summary . |
| 10-Feb-2020 | 3 | Updated:
Added:
|
| 2-Mar-2020 | 4 | Updated:
Added Section 9.1 TrustZone/RDP deactivation demonstration using the STM32CubeProgrammer. |
| 28-Sep-2021 | 5 |
Updated:
|
| 08-Apr-2022 | 6 | Updated:
|
| 24-Feb-2025 | 7 |
|