From c1f535207fc5ea4fc8767227522073077c173c7d Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:36:46 +0200 Subject: [PATCH] Prepare IDF Libs compile (#22250) * Prepare IDF Libs compile --- .gitignore | 3 + CMakeLists.txt | 8 ++ pio-tools/add_c_flags.py | 8 +- sdkconfig.defaults | 284 ++++++++++++++++++++++++++++++++++++++ tasmota/idf_component.yml | 18 +++ 5 files changed, 317 insertions(+), 4 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 sdkconfig.defaults create mode 100644 tasmota/idf_component.yml diff --git a/.gitignore b/.gitignore index 3e9ee902a..2b1761446 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ *.o *.gcno *.gcda +dependencies.lock ## Project files ###### managed_components @@ -16,6 +17,8 @@ managed_components .clang_complete .gcc-flags.json .cache +.dummy +sdkconfig.* data unpacked_fs unpacked_boards diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..0bb697982 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.16.0) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) + +project(tasmota) + +if(CONFIG_IDF_TARGET_ESP32C2) + include(relinker) +endif() diff --git a/pio-tools/add_c_flags.py b/pio-tools/add_c_flags.py index 345d4e814..835add5c0 100644 --- a/pio-tools/add_c_flags.py +++ b/pio-tools/add_c_flags.py @@ -1,7 +1,7 @@ Import("env") build_flags = env['BUILD_FLAGS'] -chip = env.get("BOARD_MCU").lower() +mcu = env.get("BOARD_MCU").lower() # General options that are passed to the C++ compiler env.Append(CXXFLAGS=["-Wno-volatile"]) @@ -10,12 +10,12 @@ env.Append(CXXFLAGS=["-Wno-volatile"]) env.Append(CFLAGS=["-Wno-discarded-qualifiers", "-Wno-implicit-function-declaration", "-Wno-incompatible-pointer-types"]) # Remove build flags which are not valid for risc-v -if chip in ("esp32c2", "esp32c3", "esp32c6", "esp32h2"): +if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"): try: build_flags.pop(build_flags.index("-mno-target-align")) except: - do_nothing="" + pass try: build_flags.pop(build_flags.index("-mtarget-align")) except: - do_nothing="" \ No newline at end of file + pass diff --git a/sdkconfig.defaults b/sdkconfig.defaults new file mode 100644 index 000000000..2a7504384 --- /dev/null +++ b/sdkconfig.defaults @@ -0,0 +1,284 @@ +CONFIG_AUTOSTART_ARDUINO=y +# CONFIG_WS2812_LED_ENABLE is not set +CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y +CONFIG_APP_REPRODUCIBLE_BUILD=y +CONFIG_COMPILER_HIDE_PATHS_MACROS=y +CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y +CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y +# CONFIG_APP_COMPILE_TIME_DATE is not set +CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +CONFIG_BOOT_ROM_LOG_ALWAYS_OFF=y +CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y +CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +CONFIG_I2S_ISR_IRAM_SAFE=y +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y +CONFIG_COMPILER_DISABLE_GCC12_WARNINGS=y +CONFIG_COMPILER_DISABLE_GCC13_WARNINGS=y +CONFIG_COMPILER_DISABLE_GCC14_WARNINGS=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y +CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y +CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y +# CONFIG_COMPILER_CXX_EXCEPTIONS is not set +# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set +# CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set +# CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR is not set +CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y +# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set +CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y +CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048 +CONFIG_ESP_TASK_WDT_PANIC=y +CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y +# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set +# CONFIG_ESP_WIFI_FTM_ENABLE is not set +# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set +# CONFIG_ESP_WIFI_CSI_ENABLED is not set +# CONFIG_ESP_WIFI_ENABLE_WPA3_SAE is not set +# CONFIG_ESP_WIFI_ENABLE_SAE_PK is not set +# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set +# CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set +# CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT is not set +# CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 +# CONFIG_ESP_WIFI_IRAM_OPT is not set +# CONFIG_ESP_WIFI_RX_IRAM_OPT is not set +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 +CONFIG_ESP_PHY_REDUCE_TX_POWER=y +CONFIG_ETH_TRANSMIT_MUTEX=y +CONFIG_ETH_SPI_ETHERNET_DM9051=y +CONFIG_ETH_SPI_ETHERNET_W5500=y +CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL=y +CONFIG_FATFS_CODEPAGE_850=y +CONFIG_FATFS_LFN_STACK=y +# CONFIG_FATFS_API_ENCODING_ANSI_OEM is not set +CONFIG_FATFS_API_ENCODING_UTF_8=y +# CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set +CONFIG_FMB_TIMER_PORT_ENABLED=y +CONFIG_FREERTOS_HZ=1000 +# CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set +# CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is not set +# CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT is not set +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 +# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y +CONFIG_HAL_ASSERTION_DISABLE=y +CONFIG_HEAP_POISONING_LIGHT=y +CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 +CONFIG_HTTPD_WS_SUPPORT=y +CONFIG_LOG_DEFAULT_LEVEL_NONE=y +# CONFIG_LOG_COLORS is not set +CONFIG_LWIP_LOCAL_HOSTNAME="tasmota" +CONFIG_LWIP_MAX_SOCKETS=16 +CONFIG_LWIP_SO_RCVBUF=y +CONFIG_LWIP_IP_FORWARD=y +CONFIG_LWIP_IPV4_NAPT=y +# CONFIG_LWIP_DHCP_DOES_ARP_CHECK is not set +CONFIG_LWIP_TCP_SYNMAXRTX=6 +CONFIG_LWIP_TCP_MSS=1436 +CONFIG_LWIP_TCP_RTO_TIME=3000 +CONFIG_LWIP_TCP_MSL=6000 +CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=2000 +CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560 +CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y +CONFIG_LWIP_IPV6_AUTOCONFIG=y +CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 +CONFIG_LWIP_MAX_SOCKETS=16 +CONFIG_LWIP_DHCP_RESTORE_LAST_IP=n +CONFIG_LWIP_DHCP_OPTIONS_LEN=128 +CONFIG_LWIP_SNTP_MAX_SERVERS=3 +# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set +CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 +CONFIG_NEWLIB_NANO_FORMAT=y +# CONFIG_DAC_DMA_AUTO_16BIT_ALIGN is not set + +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y +CONFIG_MBEDTLS_TLS_DISABLED=y +# CONFIG_MBEDTLS_TLS_ENABLED is not set +# CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 +# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set +# CONFIG_MBEDTLS_PKCS7_C is not set +# CONFIG_MBEDTLS_ERROR_STRINGS is not set + +# +# Symmetric Ciphers +# +CONFIG_MBEDTLS_AES_C=y +# CONFIG_MBEDTLS_CAMELLIA_C is not set +# CONFIG_MBEDTLS_DES_C is not set +# CONFIG_MBEDTLS_BLOWFISH_C is not set +# CONFIG_MBEDTLS_XTEA_C is not set +# CONFIG_MBEDTLS_CCM_C is not set +# CONFIG_MBEDTLS_GCM_C is not set +# CONFIG_MBEDTLS_NIST_KW_C is not set +# end of Symmetric Ciphers + + +# +# TLS Key Exchange Methods +# + +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y +# CONFIG_MBEDTLS_PSK_MODES is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA is not set +# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA is not set + +CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +# CONFIG_MBEDTLS_SSL_RENEGOTIATION is not set +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set +# CONFIG_MBEDTLS_SSL_ALPN is not set +# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set + +CONFIG_MBEDTLS_CMAC_C=y +CONFIG_MBEDTLS_ROM_MD5=y +CONFIG_MBEDTLS_HARDWARE_ECC=y +CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_HARDWARE_SHA=y +# CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK is not set +# CONFIG_MBEDTLS_HAVE_TIME is not set +# CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set +# CONFIG_MBEDTLS_SHA512_C is not set +# CONFIG_MBEDTLS_RIPEMD160_C is not set + +# +# Certificates +# +# CONFIG_MBEDTLS_PEM_PARSE_C is not set +# CONFIG_MBEDTLS_PEM_WRITE_C is not set +# CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set +# CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set +# end of Certificates + +CONFIG_MBEDTLS_ECP_C=y +CONFIG_MBEDTLS_ECDH_C=y +CONFIG_MBEDTLS_ECDSA_C=y +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +# CONFIG_MBEDTLS_DHM_C is not set +# CONFIG_MBEDTLS_ECJPAKE_C is not set +# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set +# CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set +# CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set +# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set +# CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set + +CONFIG_OPENSSL_ASSERT_DO_NOTHING=y +CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 +CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y +# CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE is not set +CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y +CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10 +CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2 +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 +# CONFIG_UNITY_ENABLE_FLOAT is not set +# CONFIG_UNITY_ENABLE_DOUBLE is not set +# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set +# CONFIG_USE_WAKENET is not set +# CONFIG_USE_MULTINET is not set +# CONFIG_VFS_SUPPORT_SELECT is not set +# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set +# CONFIG_VFS_SUPPORT_TERMIOS is not set +# CONFIG_SPI_MASTER_ISR_IN_IRAM is not set +# CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096 +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0 + +CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=1 +CONFIG_DSP_MAX_FFT_SIZE_1024=y + +CONFIG_LITTLEFS_MAX_PARTITIONS=2 +CONFIG_LITTLEFS_MULTIVERSION=y +CONFIG_LITTLEFS_DISK_VERSION_2_0=y + +# +# Disable Cameras not used +# +# CONFIG_OV7670_SUPPORT is not set +# CONFIG_OV7725_SUPPORT is not set +# CONFIG_NT99141_SUPPORT is not set +# CONFIG_GC2145_SUPPORT is not set +# CONFIG_GC032A_SUPPORT is not set +# CONFIG_GC0308_SUPPORT is not set +# CONFIG_BF3005_SUPPORT is not set +# CONFIG_BF20A6_SUPPORT is not set +# CONFIG_SC030IOT_SUPPORT is not set + +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_STACK_NO_LOG=y +# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set +# CONFIG_BLE_MESH is not set +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 +# CONFIG_BT_NIMBLE_NVS_PERSIST is not set +# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set +# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set +# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set + +CONFIG_BT_CTRL_MODEM_SLEEP=y +CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y +CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y +# CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set +CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y +CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y +CONFIG_RTC_CLK_CAL_CYCLES=576 +# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 diff --git a/tasmota/idf_component.yml b/tasmota/idf_component.yml new file mode 100644 index 000000000..6e5f92897 --- /dev/null +++ b/tasmota/idf_component.yml @@ -0,0 +1,18 @@ +dependencies: + # Required IDF version + idf: ">=5.1" + espressif/cmake_utilities: + version: "0.*" + espressif/esp32-camera: + version: "master" + git: https://github.com/espressif/esp32-camera.git + require: public + rules: + - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" + espressif/fb_gfx: + version: "master" + path: components/fb_gfx + git: https://github.com/espressif/esp32-arduino-lib-builder.git + require: public + rules: + - if: "target in [esp32, esp32s2, esp32s3, esp32p4]"