From bf1977e48e9401ec46e3d4a3993a0a8abb5bf9d8 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Thu, 31 Oct 2019 14:42:29 +0800 Subject: [PATCH 1/3] http_server: fix sdmmc related build error for esp32s2beta ESP32S2 does not have sdmmc, disable SD host for esp32s2 --- .../http_server/restful_server/main/Kconfig.projbuild | 1 + .../protocols/http_server/restful_server/main/esp_rest_main.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/protocols/http_server/restful_server/main/Kconfig.projbuild b/examples/protocols/http_server/restful_server/main/Kconfig.projbuild index ae0827734c..e184b936e2 100644 --- a/examples/protocols/http_server/restful_server/main/Kconfig.projbuild +++ b/examples/protocols/http_server/restful_server/main/Kconfig.projbuild @@ -21,6 +21,7 @@ menu "Example Configuration" Deploy website to host. It is recommended to choose this mode during developing. config EXAMPLE_WEB_DEPLOY_SD + depends on IDF_TARGET_ESP32 bool "Deploy website to SD card" help Deploy website to SD card. diff --git a/examples/protocols/http_server/restful_server/main/esp_rest_main.c b/examples/protocols/http_server/restful_server/main/esp_rest_main.c index 0f03f65a0f..9e28bf0ec7 100644 --- a/examples/protocols/http_server/restful_server/main/esp_rest_main.c +++ b/examples/protocols/http_server/restful_server/main/esp_rest_main.c @@ -7,7 +7,6 @@ CONDITIONS OF ANY KIND, either express or implied. */ #include "sdkconfig.h" -#include "driver/sdmmc_host.h" #include "driver/gpio.h" #include "esp_vfs_semihost.h" #include "esp_vfs_fat.h" @@ -20,6 +19,9 @@ #include "mdns.h" #include "lwip/apps/netbiosns.h" #include "protocol_examples_common.h" +#if CONFIG_EXAMPLE_WEB_DEPLOY_SD +#include "driver/sdmmc_host.h" +#endif #define MDNS_INSTANCE "esp home web server" From 845003a1c3c14bfd9309d007cfe209a5b933b408 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Fri, 1 Nov 2019 09:54:34 +0800 Subject: [PATCH 2/3] ASIO: fixed undefined ref to atomic functions and enabled examples for CI (esp32s2beta) Implemented the atomic functions needed to compile and link the asio examples on esp32s2beta. --- components/xtensa/stdatomic.c | 29 +++++++++++++++++++ .../protocols/asio/chat_client/CMakeLists.txt | 1 - .../protocols/asio/chat_server/CMakeLists.txt | 1 - .../asio/tcp_echo_server/CMakeLists.txt | 1 - .../asio/udp_echo_server/CMakeLists.txt | 1 - 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/components/xtensa/stdatomic.c b/components/xtensa/stdatomic.c index a4a9c383bf..2846ced402 100644 --- a/components/xtensa/stdatomic.c +++ b/components/xtensa/stdatomic.c @@ -34,6 +34,25 @@ return ret; \ } +#define FETCH_ADD(n, type) type __atomic_fetch_add_ ## n (type* ptr, type value, int memorder) \ +{ \ + unsigned state = portENTER_CRITICAL_NESTED(); \ + type ret = *ptr; \ + *ptr = *ptr + value; \ + portEXIT_CRITICAL_NESTED(state); \ + return ret; \ +} + +#define FETCH_SUB(n, type) type __atomic_fetch_sub_ ## n (type* ptr, type value, int memorder) \ +{ \ + unsigned state = portENTER_CRITICAL_NESTED(); \ + type ret = *ptr; \ + *ptr = *ptr - value; \ + portEXIT_CRITICAL_NESTED(state); \ + return ret; \ +} + + //this piece of code should only be compiled if the cpu doesn't support atomic compare and swap (s32c1i) #if XCHAL_HAVE_S32C1I == 0 @@ -44,4 +63,14 @@ CMP_EXCHANGE(2, uint16_t) CMP_EXCHANGE(4, uint32_t) CMP_EXCHANGE(8, uint64_t) +FETCH_ADD(1, uint8_t) +FETCH_ADD(2, uint16_t) +FETCH_ADD(4, uint32_t) +FETCH_ADD(8, uint64_t) + +FETCH_SUB(1, uint8_t) +FETCH_SUB(2, uint16_t) +FETCH_SUB(4, uint32_t) +FETCH_SUB(8, uint64_t) + #endif \ No newline at end of file diff --git a/examples/protocols/asio/chat_client/CMakeLists.txt b/examples/protocols/asio/chat_client/CMakeLists.txt index 38033d9431..ddcc068ba8 100644 --- a/examples/protocols/asio/chat_client/CMakeLists.txt +++ b/examples/protocols/asio/chat_client/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(asio_chat_client) diff --git a/examples/protocols/asio/chat_server/CMakeLists.txt b/examples/protocols/asio/chat_server/CMakeLists.txt index cd6a925f33..182f8d4024 100644 --- a/examples/protocols/asio/chat_server/CMakeLists.txt +++ b/examples/protocols/asio/chat_server/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(asio_chat_server) diff --git a/examples/protocols/asio/tcp_echo_server/CMakeLists.txt b/examples/protocols/asio/tcp_echo_server/CMakeLists.txt index cc906e36c7..6bf8f46825 100644 --- a/examples/protocols/asio/tcp_echo_server/CMakeLists.txt +++ b/examples/protocols/asio/tcp_echo_server/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(asio_tcp_echo_server) diff --git a/examples/protocols/asio/udp_echo_server/CMakeLists.txt b/examples/protocols/asio/udp_echo_server/CMakeLists.txt index 0ebe12f2ba..59493277c4 100644 --- a/examples/protocols/asio/udp_echo_server/CMakeLists.txt +++ b/examples/protocols/asio/udp_echo_server/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(asio_udp_echo_server) From 500c2470309b0a05ba5eba7b7711758f0402822f Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Thu, 31 Oct 2019 17:01:07 +0800 Subject: [PATCH 3/3] protocol examples: enable protocol examples for esp32sbeta Closes IDF-1027 --- examples/protocols/esp_http_client/CMakeLists.txt | 1 - examples/protocols/http2_request/CMakeLists.txt | 1 - examples/protocols/http_server/advanced_tests/CMakeLists.txt | 1 - examples/protocols/http_server/persistent_sockets/CMakeLists.txt | 1 - examples/protocols/http_server/restful_server/CMakeLists.txt | 1 - examples/protocols/http_server/simple/CMakeLists.txt | 1 - examples/protocols/https_mbedtls/CMakeLists.txt | 1 - examples/protocols/https_request/CMakeLists.txt | 1 - examples/protocols/https_server/CMakeLists.txt | 1 - examples/protocols/mqtt/publish_test/CMakeLists.txt | 1 - examples/protocols/mqtt/ssl/CMakeLists.txt | 1 - examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt | 1 - examples/protocols/mqtt/tcp/CMakeLists.txt | 1 - examples/protocols/mqtt/ws/CMakeLists.txt | 1 - examples/protocols/mqtt/wss/CMakeLists.txt | 1 - examples/protocols/openssl_client/CMakeLists.txt | 1 - examples/protocols/openssl_server/CMakeLists.txt | 1 - 17 files changed, 17 deletions(-) diff --git a/examples/protocols/esp_http_client/CMakeLists.txt b/examples/protocols/esp_http_client/CMakeLists.txt index 5dd29aeacb..cce8eb1e25 100644 --- a/examples/protocols/esp_http_client/CMakeLists.txt +++ b/examples/protocols/esp_http_client/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp-http-client-example) diff --git a/examples/protocols/http2_request/CMakeLists.txt b/examples/protocols/http2_request/CMakeLists.txt index b3ca02d772..0a720bf544 100644 --- a/examples/protocols/http2_request/CMakeLists.txt +++ b/examples/protocols/http2_request/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(http2-request) diff --git a/examples/protocols/http_server/advanced_tests/CMakeLists.txt b/examples/protocols/http_server/advanced_tests/CMakeLists.txt index 012f07e4d2..c3972d7d3c 100644 --- a/examples/protocols/http_server/advanced_tests/CMakeLists.txt +++ b/examples/protocols/http_server/advanced_tests/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(tests) diff --git a/examples/protocols/http_server/persistent_sockets/CMakeLists.txt b/examples/protocols/http_server/persistent_sockets/CMakeLists.txt index 85281d89a3..b6d34fb24b 100644 --- a/examples/protocols/http_server/persistent_sockets/CMakeLists.txt +++ b/examples/protocols/http_server/persistent_sockets/CMakeLists.txt @@ -6,7 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(persistent_sockets) diff --git a/examples/protocols/http_server/restful_server/CMakeLists.txt b/examples/protocols/http_server/restful_server/CMakeLists.txt index 67e91b8877..cb143ac640 100644 --- a/examples/protocols/http_server/restful_server/CMakeLists.txt +++ b/examples/protocols/http_server/restful_server/CMakeLists.txt @@ -4,5 +4,4 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) include($ENV{IDF_PATH}/tools/cmake/project.cmake) -set(SUPPORTED_TARGETS esp32) project(restful_server) diff --git a/examples/protocols/http_server/simple/CMakeLists.txt b/examples/protocols/http_server/simple/CMakeLists.txt index 335f96cd8c..db2ef2fa67 100644 --- a/examples/protocols/http_server/simple/CMakeLists.txt +++ b/examples/protocols/http_server/simple/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(simple) diff --git a/examples/protocols/https_mbedtls/CMakeLists.txt b/examples/protocols/https_mbedtls/CMakeLists.txt index b42d539004..a053cbaf04 100644 --- a/examples/protocols/https_mbedtls/CMakeLists.txt +++ b/examples/protocols/https_mbedtls/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(https-mbedtls) diff --git a/examples/protocols/https_request/CMakeLists.txt b/examples/protocols/https_request/CMakeLists.txt index 3ff9b29ad7..6e3f1265b9 100644 --- a/examples/protocols/https_request/CMakeLists.txt +++ b/examples/protocols/https_request/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(https_request) diff --git a/examples/protocols/https_server/CMakeLists.txt b/examples/protocols/https_server/CMakeLists.txt index 4c068c308b..35fe8ca898 100644 --- a/examples/protocols/https_server/CMakeLists.txt +++ b/examples/protocols/https_server/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(https_server) diff --git a/examples/protocols/mqtt/publish_test/CMakeLists.txt b/examples/protocols/mqtt/publish_test/CMakeLists.txt index c7d6c8ac55..4a46af3e58 100644 --- a/examples/protocols/mqtt/publish_test/CMakeLists.txt +++ b/examples/protocols/mqtt/publish_test/CMakeLists.txt @@ -6,7 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_publish) diff --git a/examples/protocols/mqtt/ssl/CMakeLists.txt b/examples/protocols/mqtt/ssl/CMakeLists.txt index 517c0221fd..2b78a842b8 100644 --- a/examples/protocols/mqtt/ssl/CMakeLists.txt +++ b/examples/protocols/mqtt/ssl/CMakeLists.txt @@ -6,7 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_ssl) diff --git a/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt b/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt index cd3de74aa4..472a3ca3ec 100644 --- a/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt +++ b/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt @@ -6,7 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_ssl_mutual_auth) diff --git a/examples/protocols/mqtt/tcp/CMakeLists.txt b/examples/protocols/mqtt/tcp/CMakeLists.txt index 25e9bc38a4..5a70e7aa01 100644 --- a/examples/protocols/mqtt/tcp/CMakeLists.txt +++ b/examples/protocols/mqtt/tcp/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_tcp) \ No newline at end of file diff --git a/examples/protocols/mqtt/ws/CMakeLists.txt b/examples/protocols/mqtt/ws/CMakeLists.txt index 6b7b93d19b..f0490061c9 100644 --- a/examples/protocols/mqtt/ws/CMakeLists.txt +++ b/examples/protocols/mqtt/ws/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_websocket) diff --git a/examples/protocols/mqtt/wss/CMakeLists.txt b/examples/protocols/mqtt/wss/CMakeLists.txt index 96fe21d5e5..2350bd8299 100644 --- a/examples/protocols/mqtt/wss/CMakeLists.txt +++ b/examples/protocols/mqtt/wss/CMakeLists.txt @@ -6,7 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_websocket_secure) diff --git a/examples/protocols/openssl_client/CMakeLists.txt b/examples/protocols/openssl_client/CMakeLists.txt index f391773012..577d4ae082 100644 --- a/examples/protocols/openssl_client/CMakeLists.txt +++ b/examples/protocols/openssl_client/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(openssl_client) diff --git a/examples/protocols/openssl_server/CMakeLists.txt b/examples/protocols/openssl_server/CMakeLists.txt index c930277274..9fb42034a5 100644 --- a/examples/protocols/openssl_server/CMakeLists.txt +++ b/examples/protocols/openssl_server/CMakeLists.txt @@ -6,6 +6,5 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(openssl_server)