Skip to content

Commit 003526c

Browse files
committed
More comments
1 parent 9e1c709 commit 003526c

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

trustzone/hello_trustzone/CMakeLists.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,25 @@ target_link_libraries(hello_trustzone_s
66
pico_secure
77
)
88

9+
# Packaged no_flash binary
910
pico_set_binary_type(hello_trustzone_s no_flash)
1011
pico_package_uf2_output(hello_trustzone_s 0x10000000)
1112
pico_add_extra_outputs(hello_trustzone_s)
1213

1314
# Add non-secure executable
1415
add_executable(hello_trustzone_ns nonsecure.c)
15-
pico_set_uf2_family(hello_trustzone_ns "rp2350-arm-ns")
1616
target_link_libraries(hello_trustzone_ns
1717
pico_stdlib
1818
)
19+
20+
# Set UF2 family manually
21+
pico_set_uf2_family(hello_trustzone_ns "rp2350-arm-ns")
22+
23+
# Use stdio_usb
1924
pico_enable_stdio_uart(hello_trustzone_ns 0)
2025
pico_enable_stdio_usb(hello_trustzone_ns 1)
26+
27+
# Default flash binary
2128
pico_add_extra_outputs(hello_trustzone_ns)
2229

2330
# Set security options
@@ -29,7 +36,7 @@ pico_set_security_options(hello_trustzone_s hello_trustzone_ns
2936
# Set security ram split
3037
pico_set_security_ram_split(hello_trustzone_s hello_trustzone_ns SIMPLE 64k 2k)
3138

32-
# Create combined UF2 (ns first)
39+
# Create combined UF2, for loading into the partition table (non-secure first)
3340
pico_concatenate_uf2_outputs(hello_trustzone hello_trustzone_ns hello_trustzone_s)
3441

3542

@@ -43,18 +50,24 @@ target_link_libraries(hello_trustzone_no_flash_s
4350
pico_secure
4451
)
4552

53+
# no_flash binary for secure side
4654
pico_set_binary_type(hello_trustzone_no_flash_s no_flash)
4755
pico_add_extra_outputs(hello_trustzone_no_flash_s)
4856

4957
# Add non-secure executable
5058
add_executable(hello_trustzone_no_flash_ns nonsecure.c)
51-
pico_set_uf2_family(hello_trustzone_no_flash_ns "rp2350-arm-ns")
5259
target_link_libraries(hello_trustzone_no_flash_ns
5360
pico_stdlib
5461
)
62+
63+
# Set UF2 family manually
64+
pico_set_uf2_family(hello_trustzone_ns "rp2350-arm-ns")
65+
66+
# Use stdio_usb
5567
pico_enable_stdio_uart(hello_trustzone_no_flash_ns 0)
5668
pico_enable_stdio_usb(hello_trustzone_no_flash_ns 1)
5769

70+
# no_flash binary for non-secure side too
5871
pico_set_binary_type(hello_trustzone_no_flash_ns no_flash)
5972
pico_add_extra_outputs(hello_trustzone_no_flash_ns)
6073

@@ -67,6 +80,6 @@ pico_set_security_options(hello_trustzone_no_flash_s hello_trustzone_no_flash_ns
6780
# Set security ram split (with NO_FLASH)
6881
pico_set_security_ram_split(hello_trustzone_no_flash_s hello_trustzone_no_flash_ns SIMPLE 64k 2k NO_FLASH)
6982

70-
# Create combined CMake target
83+
# Create combined CMake target, for easy building
7184
add_custom_target(hello_trustzone_no_flash ALL
7285
DEPENDS hello_trustzone_no_flash_s hello_trustzone_no_flash_ns)

trustzone/hello_trustzone/nonsecure.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ int main() {
1414
// Request user IRQ from secure, which stdio_usb will use
1515
user_irq_request_unused_from_secure(1);
1616

17+
// Start stdio_usb
1718
stdio_usb_init();
1819

1920
// Repeating timer

trustzone/hello_trustzone/secure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int main()
6060
rom_get_boot_info(&info);
6161
printf("Boot partition: %d\n", info.partition);
6262

63-
// Roll QMI to matching Non-Secure partition
63+
// Roll QMI to matching Non-Secure partition, as Non-Secure runs from XIP
6464
int ns_partition = rom_get_owned_partition(info.partition);
6565
printf("Matching Non-Secure partition: %d\n", ns_partition);
6666
int rc = rom_roll_qmi_to_partition(ns_partition);

0 commit comments

Comments
 (0)