SmartThingsCommunity / st-device-sdk-c-ref

SmartThings SDK Reference for Direct Connected Devices for C
Apache License 2.0
118 stars 173 forks source link

Issues with ota_demo #145

Open KIMSUNIK opened 6 months ago

KIMSUNIK commented 6 months ago

I recently updated my development environment to stdk 1.8.14 and idf v5.0.2. Several problems have been occured in ota_demo.

1. Some sha256-related functions are no longer supported and cannot be compiled, so an update is required.

https://github.com/espressif/mbedtls/blob/dd91f30058dfad68d80267cc82cd8472c4aa54b5/include/mbedtls/compat-2.x.h

/home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c: In function '_crypto_sha256': /home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c:286:15: error: implicit declaration of function 'mbedtls_sha256_ret'; did you mean 'mbedtls_sha256_free'? [-Werror=implicit-function-declaration] 286 | ret = mbedtls_sha256_ret(src, src_len, dst, 0); | ^~~~~~ | mbedtls_sha256_free /home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c: In function '_update_device': /home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c:475:13: error: implicit declaration of function 'mbedtls_sha256_starts_ret'; did you mean 'mbedtls_sha256_starts'? [-Werror=implicit-function-declaration] 475 | if (mbedtls_sha256_starts_ret( &ctx, 0) != 0 ) { | ^~~~~~~~~ | mbedtls_sha256_starts /home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c:611:29: error: implicit declaration of function 'mbedtls_sha256_update_ret'; did you mean 'mbedtls_sha256_update'? [-Werror=implicit-function-declaration] 611 | if (mbedtls_sha256_update_ret(&ctx, (const unsigned char *)upgrade_data_buf, data_read) != 0) { | ^~~~~~~~~ | mbedtls_sha256_update /home/esp32/st-device-sdk-c-ref/apps/esp32/project/main/ota_util.c:632:13: error: implicit declaration of function 'mbedtls_sha256_finish_ret'; did you mean 'mbedtls_sha256_finish'? [-Werror=implicit-function-declaration] 632 | if (mbedtls_sha256_finish_ret( &ctx, md) != 0) { | ^~~~~~~~~ | mbedtls_sha256_finish cc1: some warnings being treated as errors ninja: build stopped: subcommand failed. HINT: You maybe using pre FreeRTOS V8.0.0 APIs. The backward compatibility of such APIs is no longer enabled by default. Please turn on CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY explicitly to use such APIs. HINT: Please check that the function name is correct. Also it is possible that you've forgot to import mbedtls_sha256_ret library(s) in header file or add the necessary REQURIES component. Try to add missing libraries to your project header file or check idf_component_register(REQUIRES ...) section in your component CmakeList.txt file. For more information run 'idf.py docs -sp api-guides/build-system.html'. Also, please check if the function has been removed, renamed or replaced by an alternative function - refer to the migration guide for more information. HINT: The issue is better to resolve by replacing format specifiers to 'PRI'-family macros (include header file).

2. When compiling ota_demo, the following error occurs.

esp32@esp32-VirtualBox:~/st-device-sdk-c-ref$ python build.py esp32 ota_demo all /bin/sh: 22: ./export.sh: [[: not found Detecting the Python interpreter Checking "python3" ... Checking "python" ... Python 3.7.5 "python" has been detected Checking Python compatibility Checking other ESP-IDF version. Adding ESP-IDF tools to PATH... Checking if Python packages are up to date... Constraint file: /home/esp32/.espressif/espidf.constraints.v5.0.txt Requirement files:

/home/esp32/st-device-sdk-c-ref/bsp/esp32/tools/check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources Executing action: all (aliases: build) Running cmake in directory /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/build Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32 -DCCACHE_ENABLE=0 /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo"... -- Found Git: /usr/bin/git (found version "2.17.1") -- The C compiler identification is GNU 11.2.0 -- The CXX compiler identification is GNU 11.2.0 -- The ASM compiler identification is GNU -- Found assembler: /home/esp32/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /home/esp32/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /home/esp32/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Building ESP-IDF components for target esp32 -- Project sdkconfig file /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/sdkconfig -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of time_t -- Check size of time_t - done -- Found Python3: /home/esp32/.espressif/python_env/idf5.0_py3.7_env/bin/python (found version "3.7.5") found components: Interpreter -- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS -- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success -- App "ota_demo" version: v1.8.7-5-gaf35890-dirty -- Adding linker script /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/build/esp-idf/esp_system/ld/memory.ld -- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_system/ld/esp32/sections.ld.in -- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.ld -- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.api.ld -- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld -- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld -- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld -- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld -- Adding linker script /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/soc/esp32/ld/esp32.peripherals.ld Enter component.cmake -- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_netif esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 iot-core_config json log lwip main mbedtls mqtt newlib nvs_flash openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa -- Component paths: /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/app_trace /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/app_update /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/bootloader /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/bootloader_support /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/bt /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/cmock /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/console /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/cxx /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/driver /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/efuse /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp-tls /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_adc /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_app_format /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_common /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_eth /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_event /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_gdbstub /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_hid /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_http_client /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_http_server /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_https_ota /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_https_server /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_hw_support /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_lcd /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_local_ctrl /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_netif /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_partition /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_phy /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_pm /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_psram /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_ringbuf /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_rom /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_system /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_timer /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esp_wifi /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/espcoredump /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/esptool_py /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/fatfs /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/freertos /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/hal /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/heap /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/http_parser /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/idf_test /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/ieee802154 /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/iot-core_config /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/json /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/log /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/lwip /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/main /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/mbedtls /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/mqtt /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/newlib /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/nvs_flash /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/openthread /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/partition_table /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/perfmon /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/protobuf-c /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/protocomm /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/pthread /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/sdmmc /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/soc /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/spi_flash /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/spiffs /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/tcp_transport /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/ulp /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/unity /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/usb /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/vfs /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/wear_levelling /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/wifi_provisioning /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/wpa_supplicant /home/esp32/st-device-sdk-c-ref/bsp/esp32/components/xtensa -- Configuring done CMake Error at /home/esp32/st-device-sdk-c-ref/iot-core/src/CMakeLists.txt:71 (add_subdirectory): Target "iotcore" links to:

idf::espressif__libsodium

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

-- Generating done CMake Generate step failed. Build files cannot be regenerated correctly. cmake failed with exit code 1, output of the command is in the /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/build/log/idf_py_stderr_output_18744 and /home/esp32/st-device-sdk-c-ref/apps/esp32/ota_demo/build/log/idf_py_stdout_output_18744

Usage: python build.py apps/[BSP_NAME]/[APP_NAME] or python build.py [BSP_NAME] [APP_NAME]

[BSP_NAME] : [APP_NAME] esp32 : light_example, switch_example, ota_demo esp32c3 : light_example, switch_example emw3166 : light_example, switch_example rtl8720c : light_example, switch_example esp32s2 : light_example emw3080 : light_example, switch_example esp32_v3.3 : light_example, switch_example, ota_demo rtl8195 : light_example, switch_example rtl8721c : light_example, switch_example esp8266 : light_example, switch_example

ex) python build.py apps/esp32/switch_example ex) python build.py esp32 light_example

junyoun-kim commented 5 months ago

@KIMSUNIK We've updated ota_demo app with #146 . Could you retry with latest commit?