From bb44667475a72921f4da2f99a43aa9742fb98ed1 Mon Sep 17 00:00:00 2001 From: ok-home Date: Mon, 9 Oct 2023 20:19:04 +0700 Subject: [PATCH] cmake.txt Kconfig --- CMakeLists.txt | 34 ++++++++++++--------- Kconfig.projbuild | 18 ++++++++++- example_ota_ws/debug.log | 3 -- example_ota_ws/dependencies.lock | 8 +---- example_ota_ws/main/example_ota_ws_update.c | 7 ++--- 5 files changed, 40 insertions(+), 30 deletions(-) delete mode 100644 example_ota_ws/debug.log diff --git a/CMakeLists.txt b/CMakeLists.txt index b786ae5..ebe169a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,18 +8,16 @@ set( priv_includedir private_include ) set(require - "" -) + ) set( priv_require - esp_http_server app_update - esp_encrypted_img + esp_http_server + mbedtls ) set( embed_file source/ota_ws_update.html ) set( embed_txt_file - "" ) if(CONFIG_OTA_PRE_ENCRYPTED_MODE) @@ -30,9 +28,15 @@ if(CONFIG_OTA_PRE_ENCRYPTED_MODE) list(APPEND priv_includedir esp_encrypted_img/include ) - list(APPEND embed_txt_file - rsa_key/private.pem - ) + 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.pem + ) + else() + list(APPEND embed_txt_file + ${project_dir}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private.pem + ) + endif() else() list(APPEND srcs source/ota_ws_update_esp.c @@ -56,12 +60,14 @@ if(CONFIG_OTA_PRE_ENCRYPTED_MODE) set(ESP_IMG_GEN_TOOL_PATH ${CMAKE_CURRENT_LIST_DIR}/esp_encrypted_img/tools/esp_enc_img_gen.py) #openssl genrsa -out rsa_key/private.pem 3072 - - # for rsa_key on components dir + + 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}/rsa_key/private.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app) - + ${COMPONENT_DIR}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private.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}/rsa_key/private.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app) + create_esp_enc_img(${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.bin + ${project_dir}/${CONFIG_OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY}/private.pem ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}_secure.bin app) + endif() endif() diff --git a/Kconfig.projbuild b/Kconfig.projbuild index f4803c2..95a1a14 100644 --- a/Kconfig.projbuild +++ b/Kconfig.projbuild @@ -1,4 +1,4 @@ -menu "OTA WS UPDATE" +menu "OTA websocket update" config OTA_DEFAULT_URI string "OTA page URI" @@ -24,4 +24,20 @@ menu "OTA WS UPDATE" help Ota pre-encrypted mode. + choice OTA_PRE_ENCRYPTED_RSA_KEY_LOCATION + depends on OTA_PRE_ENCRYPTED_MODE + prompt "RSA key directory" + default OTA_PRE_ENCRYPTED_RSA_KEY_ON_PROJECT_LOCATION + config OTA_PRE_ENCRYPTED_RSA_KEY_ON_PROJECT_LOCATION + bool "PROJECT_DIR" + config OTA_PRE_ENCRYPTED_RSA_KEY_ON_COMPONENT_LOCATION + bool "COMPONENT_DIR" + endchoice + + config OTA_PRE_ENCRYPTED_RSA_KEY_DIRECTORY + depends on OTA_PRE_ENCRYPTED_MODE + string "Ota pre-encrypted RSA key directory" + default "rsa_key" + + endmenu \ No newline at end of file diff --git a/example_ota_ws/debug.log b/example_ota_ws/debug.log deleted file mode 100644 index b121b81..0000000 --- a/example_ota_ws/debug.log +++ /dev/null @@ -1,3 +0,0 @@ -2023-10-05 19:44:46,943 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_STARTED -2023-10-05 19:44:46,944 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_READY2CONNECT -2023-10-05 19:45:24,371 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_STOPPED diff --git a/example_ota_ws/dependencies.lock b/example_ota_ws/dependencies.lock index cd52792..f39ac52 100644 --- a/example_ota_ws/dependencies.lock +++ b/example_ota_ws/dependencies.lock @@ -1,15 +1,9 @@ dependencies: - espressif/esp_encrypted_img: - component_hash: d2cbae51c946ec66bbf0e62d2b406aa6c92c0c97d7be7c32fb6ca541a36d20de - source: - service_url: https://api.components.espressif.com/ - type: service - version: 2.2.0 idf: component_hash: null source: type: idf version: 5.2.0 -manifest_hash: 0ee5924d580a0ce00333564716b4649c3118e31ddbcaf0fc6cd6071b000406ab +manifest_hash: 2ac596d0d5a708817329b21531cbf3574c7c8daaf36dca979b5dd32a78fc2857 target: esp32s3 version: 1.0.0 diff --git a/example_ota_ws/main/example_ota_ws_update.c b/example_ota_ws/main/example_ota_ws_update.c index 772f860..346a76c 100644 --- a/example_ota_ws/main/example_ota_ws_update.c +++ b/example_ota_ws/main/example_ota_ws_update.c @@ -9,14 +9,11 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" -#include "esp_event.h" +//#include "esp_event.h" #include "esp_log.h" -#include "esp_ota_ops.h" -#include "esp_wifi.h" +//#include "esp_wifi.h" #include "esp_http_server.h" -// #include - #include "nvs_wifi_connect.h" #include "ota_ws_update.h"