-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
86 lines (74 loc) · 3.11 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(i2c_sensor)
if(DEFINED UNTRUSTED)
message("#################################################")
message("#################################################")
message(STATUS "Building untrusted setup")
message("#################################################")
message("#################################################")
target_compile_definitions(app PUBLIC UNTRUSTED)
# OLED DRIVER
if(DEFINED EMULATED)
target_compile_definitions(app PUBLIC EMULATED)
else()
target_include_directories(app PRIVATE driver/oled_driver )
target_include_directories(app PRIVATE driver/oled_driver/Config )
target_include_directories(app PRIVATE driver/oled_driver/OLED )
target_include_directories(app PRIVATE driver/oled_driver/GUI )
target_include_directories(app PRIVATE driver/oled_driver/Example )
file(GLOB_RECURSE oled_driver_sources CONFIGURE_DEPENDS driver/oled_driver/*.c)
endif()
target_include_directories(app PRIVATE src/ )
# included because driver code is full of these warnings
target_compile_options(app PRIVATE -Wno-missing-braces)
target_compile_options(app PRIVATE -Wno-comment)
target_sources(app PRIVATE
${oled_driver_sources}
src/main.c
trusted_peripheral/trusted_peripheral.c
)
else()
message("#################################################")
message("#################################################")
message(STATUS "Building trusted setup")
message("#################################################")
message("#################################################")
target_compile_definitions(app PUBLIC TRUSTED)
# NOTE force test flash layout for more flash memory
set_property(TARGET zephyr_property_target
APPEND PROPERTY TFM_CMAKE_OPTIONS
-DTFM_S_REG_TEST=ON
#-DCRYPTO_HW_ACCELERATOR=OFF # doesn't work
)
target_sources(app PRIVATE
src/main.c
src/trusted_peripheral_ns.c
)
# secure partition
get_target_property(TFM_BINARY_DIR tfm TFM_BINARY_DIR)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/trusted_peripheral/tfm_manifest_list.yaml.in
${CMAKE_CURRENT_BINARY_DIR}/trusted_peripheral/tfm_manifest_list.yaml
)
set_property(TARGET zephyr_property_target
APPEND PROPERTY TFM_CMAKE_OPTIONS
-DTFM_EXTRA_MANIFEST_LIST_FILES=${CMAKE_CURRENT_BINARY_DIR}/trusted_peripheral/tfm_manifest_list.yaml
-DTFM_EXTRA_PARTITION_PATHS=${CMAKE_CURRENT_LIST_DIR}/trusted_peripheral
)
if(DEFINED EMULATED)
target_compile_definitions(app PUBLIC EMULATED)
set_property(TARGET zephyr_property_target
APPEND PROPERTY TFM_CMAKE_OPTIONS
-DEMULATED=1
)
else()
endif()
# include folder that has tfm_api.h
target_include_directories(app PRIVATE
$<TARGET_PROPERTY:tfm,TFM_BINARY_DIR>/install/interface/include
)
target_compile_definitions(app
PRIVATE TFM_PARTITION_TRUSTED_PERIPHERAL
)
endif()