Skip to content

Commit e8330a7

Browse files
committed
Updated examples/trustzone
1 parent 1988805 commit e8330a7

3 files changed

Lines changed: 32 additions & 12 deletions

File tree

examples/trustzone/CMakeLists.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
cmake_minimum_required(VERSION 3.20)
1+
# See: https://cmake.org/cmake/help/latest/prop_sf/GENERATED.html
2+
cmake_minimum_required(VERSION 3.30)
23

34
project(TrustZone LANGUAGES C)
45

56
add_subdirectory(secure)
67
add_subdirectory(non-secure)
78

8-
# TODO 1: Add `secure-import-lib` as a dependency for `non-secure`
9-
add_custom_target()
10-
add_dependencies()
11-
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
add_executable(non-secure)
22

3-
target_sources(non-secure PRIVATE non-secure-hello.c)
3+
# TODO 5: Add `secure-import-lib` as a dependency for `non-secure`
44

5+
6+
target_sources(non-secure PRIVATE
7+
non-secure-hello.c
8+
)
59
target_compile_options(non-secure PRIVATE
610
--cpu=$<TARGET_PROPERTY:secure,CPU>
711
--no_wrap_diagnostics
812
)
913

1014
target_include_directories(non-secure PRIVATE
11-
# TODO 4: Make use of the `secure` include directories
15+
# TODO 6: Make use of the `secure` include directories
16+
1217
)
1318

1419
target_link_options(non-secure PRIVATE
1520
--cpu=$<TARGET_PROPERTY:secure,CPU>
1621
--config ${CMAKE_CURRENT_SOURCE_DIR}/v2m-mps2_ns.icf
1722
--semihosting
18-
# TODO 5: Link against the import library generated from the `secure` target
19-
# TODO 6: Specify "no entry point" for the `non-secure` target
23+
# TODO 7a: Add the generated import library to the `non-secure` target
24+
25+
# TODO 7b: Specify "no entry point" for the `non-secure` target
26+
2027
)

examples/trustzone/secure/CMakeLists.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ add_executable(secure)
33
target_sources(secure PRIVATE secure-hello.c)
44

55
set_target_properties(secure PROPERTIES
6-
CPU cortex-m33
6+
CPU cortex-m33
77
)
88

99
target_compile_options(secure PRIVATE
1010
--cpu=$<TARGET_PROPERTY:CPU>
11-
# TODO 2: Enable the CMSE in the compiler flags
11+
# TODO 1: Enable the CMSE in the compiler flags
12+
1213
)
1314

1415
target_include_directories(secure PUBLIC
@@ -19,5 +20,20 @@ target_link_options(secure PRIVATE
1920
--semihosting
2021
--cpu=$<TARGET_PROPERTY:CPU>
2122
--config ${CMAKE_CURRENT_SOURCE_DIR}/v2m-mps2_s.icf
22-
# TODO 3: Set the linker to produce an import library, consumed by the `non-secure` target
23+
# TODO 2: Set the linker to produce an import library object file
24+
2325
)
26+
27+
# TODO 3: Add a custom target for explicitly marking the secure import library as `GENERATED`
28+
# (required for Ninja targets)
29+
30+
31+
32+
33+
34+
35+
# TODO 4: Include the secure import library in the generator's clean target
36+
# (clean with: cmake --build build --target clean)
37+
38+
39+

0 commit comments

Comments
 (0)