-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
74 lines (68 loc) · 2.16 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
set( srcs
source/ota_ws_update_http.c
)
set( includedir
include
)
set( priv_includedir
private_include
)
set(require
)
set( priv_require
app_update
esp_http_server
mbedtls
)
set( embed_file
source/ota_ws_update.html
)
set( embed_txt_file
)
if(CONFIG_OTA_PRE_ENCRYPTED_MODE)
list(APPEND srcs
source/ota_ws_update_esp_preencrypted.c
esp_encrypted_img/src/esp_encrypted_img.c
)
list(APPEND priv_includedir
esp_encrypted_img/include
)
if(CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_ON_COMPONENT_LOCATION)
list(APPEND embed_txt_file
${COMPONENT_DIR}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private_rsa_3072.pem
)
else()
list(APPEND embed_txt_file
${project_dir}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private_rsa_3072.pem
)
endif()
else()
list(APPEND srcs
source/ota_ws_update_esp.c
)
endif()
idf_component_register(
SRCS ${srcs}
INCLUDE_DIRS ${includedir}
PRIV_INCLUDE_DIRS ${priv_includedir}
REQUIRES ${require}
PRIV_REQUIRES ${priv_require}
EMBED_FILES ${embed_file}
EMBED_TXTFILES ${embed_txt_file}
)
if(CONFIG_OTA_PRE_ENCRYPTED_MODE)
include(esp_encrypted_img/project_include.cmake)
#redefine ESP_IMG_GEN_TOOL_PATH
set(ESP_IMG_GEN_TOOL_PATH ${CMAKE_CURRENT_LIST_DIR}/esp_encrypted_img/tools/esp_enc_img_gen.py)
# command for generate RSA key
#openssl genrsa -out rsa_key/private_rsa_3072.pem 3072
if(CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_ON_COMPONENT_LOCATION)
# for rsa_key on components project_dir
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
${COMPONENT_DIR}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private_rsa_3072.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app)
else()
# for rsa_key on project dir
create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin
${project_dir}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private_rsa_3072.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app)
endif()
endif()