Skip to content

Conversation

@kilograham
Copy link
Contributor

@kilograham kilograham commented Dec 8, 2025

This PR is alpha level, and APIs/build process are subject to change:

See the corresponding examples branch: https://github.com/raspberrypi/pico-examples/tree/ns-alpha

This PR allows the user to build separate binaries for the Secure and NonSecure sides of RP2350, and have one call the other. It provides secure call APIs for the NonSecure side to call code on the Secure side, along with CMake functions to configure both binaries to have the same functionality.

This allows for simple use of the Secure/NonSecure split, for example to keep secrets on the Secure side, while running a WiFi/USB stack on the NonSecure side.

The hello_trustzone example is a minimal example showing how to create a Secure/NonSecure binary. It has NonSecure doing stdio_usb, and both sides using their respective timers. It also demonstrates a user secure call, allowing user NonSecure code to talk to Secure code. This produces a single hello_trustzone.uf2 file, which can be loaded onto any device with the trustzone_pt.json programmed. So steps are:
picotool partition create trustzone_pt.json pt.uf2
picotool load pt.uf2
picotool reboot -u
drag & drop hello_trustzone.uf2 onto the device

In addition there is a hello_trustzone_no_flash example for those not using flash - this doesn't require a partition table to load, either load in two parts with picotool:
picotool load hello_trustzone_no_flash_ns.uf2
picotool load hello_trustzone_no_flash_s.uf2 -x
or create a combined UF2 using the code in the new branch (https://github.com/raspberrypi/picotool/tree/uf2-combine), which can just be dragged & dropped (or loaded with picotool as a single UF2):
picotool uf2 combine hello_trustzone_no_flash_s.uf2 hello_trustzone_no_flash_ns.uf2 hello_trustzone_no_flash.uf2
drag & drop hello_trustzone_no_flash.uf2 onto the device

Allows for much simpler custom linker scripts
…ript_var variables

Means that CMake doesn't need to know the default memory addresses for different platforms
Non-secure side can successfully connect to WiFi
Make rolling XIP to the non-secure partition easier
…re_binary_default function to launch default nonsecure binary
Prevents nonsecure code printing secure data
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

Please do not submit against master, use develop instead

@kilograham kilograham changed the base branch from master to develop December 8, 2025 10:09
@kilograham kilograham self-assigned this Dec 8, 2025
@kilograham kilograham modified the milestones: 2.3.0, 2.2.1 Dec 8, 2025
@kilograham kilograham marked this pull request as draft December 8, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants