From dd6af27273b7b56173c783c46c0bd695539861c3 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Tue, 5 Sep 2023 18:46:20 -0400 Subject: [PATCH 01/14] Update libcoap to 4abe0ea Updates libcoap to 4abe0ea to pick up DTLS Connection ID support, which was added in https://github.com/obgm/libcoap/pull/1153. Signed-off-by: Daniel Mangum --- external/libcoap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/libcoap b/external/libcoap index 600eb783c..4abe0ea7a 160000 --- a/external/libcoap +++ b/external/libcoap @@ -1 +1 @@ -Subproject commit 600eb783c9b340ddac917db2273bc809341b5c65 +Subproject commit 4abe0ea7aae64edd28faf2e71750208954ca2efa From 9466d9c2ae04648f54a103152d12ec1bbb234a19 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Tue, 5 Sep 2023 18:47:30 -0400 Subject: [PATCH 02/14] Update esp_idf port with new libcoap config Updates esp_idf port to accommodate the new version of libcoap, which includes updating included file names, as well as setting new config values. Signed-off-by: Daniel Mangum --- port/esp_idf/components/coap/CMakeLists.txt | 13 ++++++++----- port/esp_idf/libcoap/include/coap3/coap.h | 7 ++++--- port/esp_idf/libcoap/include/coap_config.h | 6 ++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/port/esp_idf/components/coap/CMakeLists.txt b/port/esp_idf/components/coap/CMakeLists.txt index 5df73e2bc..919a624cc 100644 --- a/port/esp_idf/components/coap/CMakeLists.txt +++ b/port/esp_idf/components/coap/CMakeLists.txt @@ -5,30 +5,33 @@ set(sdk_port ${sdk_root}/port) set(libcoap_dir ${sdk_root}/external/libcoap) set(libcoap_srcs - "${libcoap_dir}/src/block.c" "${libcoap_dir}/src/coap_address.c" "${libcoap_dir}/src/coap_asn1.c" "${libcoap_dir}/src/coap_async.c" + "${libcoap_dir}/src/coap_block.c" "${libcoap_dir}/src/coap_cache.c" "${libcoap_dir}/src/coap_debug.c" + "${libcoap_dir}/src/coap_dtls.c" "${libcoap_dir}/src/coap_encode.c" "${libcoap_dir}/src/coap_event.c" "${libcoap_dir}/src/coap_hashkey.c" "${libcoap_dir}/src/coap_io.c" + "${libcoap_dir}/src/coap_layers.c" "${libcoap_dir}/src/coap_mbedtls.c" "${libcoap_dir}/src/coap_mem.c" - "${libcoap_dir}/src/coap_notls.c" + "${libcoap_dir}/src/coap_net.c" + "${libcoap_dir}/src/coap_netif.c" "${libcoap_dir}/src/coap_option.c" + "${libcoap_dir}/src/coap_pdu.c" "${libcoap_dir}/src/coap_prng.c" + "${libcoap_dir}/src/coap_resource.c" "${libcoap_dir}/src/coap_session.c" "${libcoap_dir}/src/coap_str.c" "${libcoap_dir}/src/coap_subscribe.c" "${libcoap_dir}/src/coap_tcp.c" "${libcoap_dir}/src/coap_time.c" "${libcoap_dir}/src/coap_uri.c" - "${libcoap_dir}/src/net.c" - "${libcoap_dir}/src/pdu.c" - "${libcoap_dir}/src/resource.c" + "${libcoap_dir}/src/coap_ws.c" ) idf_component_register( diff --git a/port/esp_idf/libcoap/include/coap3/coap.h b/port/esp_idf/libcoap/include/coap3/coap.h index add0787de..ee02a3acf 100644 --- a/port/esp_idf/libcoap/include/coap3/coap.h +++ b/port/esp_idf/libcoap/include/coap3/coap.h @@ -24,9 +24,9 @@ extern "C" { #include "coap3/libcoap.h" #include "coap3/coap_forward_decls.h" -#include "coap3/block.h" #include "coap3/coap_address.h" #include "coap3/coap_async.h" +#include "coap3/coap_block.h" #include "coap3/coap_cache.h" #include "coap3/coap_debug.h" #include "coap3/coap_dtls.h" @@ -36,13 +36,14 @@ extern "C" { #include "coap3/coap_mem.h" #include "coap3/coap_net.h" #include "coap3/coap_option.h" +#include "coap3/coap_pdu.h" #include "coap3/coap_prng.h" #include "coap3/coap_str.h" +#include "coap3/coap_resource.h" #include "coap3/coap_subscribe.h" #include "coap3/coap_time.h" #include "coap3/coap_uri.h" -#include "coap3/pdu.h" -#include "coap3/resource.h" +#include "coap3/coap_ws.h" #ifdef __cplusplus } diff --git a/port/esp_idf/libcoap/include/coap_config.h b/port/esp_idf/libcoap/include/coap_config.h index 04c6a9e84..6bf814622 100644 --- a/port/esp_idf/libcoap/include/coap_config.h +++ b/port/esp_idf/libcoap/include/coap_config.h @@ -40,4 +40,10 @@ #define HAVE_GETRANDOM +#define COAP_WITH_LIBMBEDTLS + +#define COAP_CLIENT_SUPPORT 1 +#define COAP_IPV4_SUPPORT 1 +#define COAP_WS_SUPPORT 0 + #endif /* _CONFIG_H_ */ From b6c2030292881cc702d3fbf22ba99a1b9c0a7982 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Wed, 6 Sep 2023 14:19:20 -0400 Subject: [PATCH 03/14] Update libcoap header includes in Zephyr port Updates the list of included headers from the new libcoap version in the Zephyr port. Signed-off-by: Daniel Mangum --- port/zephyr/libcoap/include/coap3/coap.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/port/zephyr/libcoap/include/coap3/coap.h b/port/zephyr/libcoap/include/coap3/coap.h index 9ca7ddc73..6ae9cdb07 100644 --- a/port/zephyr/libcoap/include/coap3/coap.h +++ b/port/zephyr/libcoap/include/coap3/coap.h @@ -8,9 +8,9 @@ extern "C" { #include "coap3/libcoap.h" #include "coap3/coap_forward_decls.h" -#include "coap3/block.h" #include "coap3/coap_address.h" #include "coap3/coap_async.h" +#include "coap3/coap_block.h" #include "coap3/coap_cache.h" #include "coap3/coap_debug.h" #include "coap3/coap_dtls.h" @@ -20,13 +20,14 @@ extern "C" { #include "coap3/coap_mem.h" #include "coap3/coap_net.h" #include "coap3/coap_option.h" +#include "coap3/coap_pdu.h" #include "coap3/coap_prng.h" #include "coap3/coap_str.h" +#include "coap3/coap_resource.h" #include "coap3/coap_subscribe.h" #include "coap3/coap_time.h" #include "coap3/coap_uri.h" -#include "coap3/pdu.h" -#include "coap3/resource.h" +#include "coap3/coap_ws.h" #ifdef __cplusplus } From d06fbf8bc5329bf48adf66be04d9a4751082dc66 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Wed, 6 Sep 2023 14:20:46 -0400 Subject: [PATCH 04/14] Update libcoap targets in Zephyr port Updates the list of targets in the libcoap Zephyr port to accommodate renaming and additions. Signed-off-by: Daniel Mangum --- port/zephyr/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/port/zephyr/CMakeLists.txt b/port/zephyr/CMakeLists.txt index ec37c0bcd..4f69361cb 100644 --- a/port/zephyr/CMakeLists.txt +++ b/port/zephyr/CMakeLists.txt @@ -73,26 +73,30 @@ zephyr_library_sources( ../../external/heatshrink/src/heatshrink_decoder.c # libcoap - ../../external/libcoap/src/block.c ../../external/libcoap/src/coap_address.c ../../external/libcoap/src/coap_asn1.c ../../external/libcoap/src/coap_async.c + ../../external/libcoap/src/coap_block.c ../../external/libcoap/src/coap_cache.c ../../external/libcoap/src/coap_debug.c + ../../external/libcoap/src/coap_dtls.c ../../external/libcoap/src/coap_encode.c ../../external/libcoap/src/coap_event.c ../../external/libcoap/src/coap_hashkey.c + ../../external/libcoap/src/coap_layers.c ../../external/libcoap/src/coap_mem.c + ../../external/libcoap/src/coap_net.c + ../../external/libcoap/src/coap_netif.c ../../external/libcoap/src/coap_option.c + ../../external/libcoap/src/coap_pdu.c ../../external/libcoap/src/coap_prng.c + ../../external/libcoap/src/coap_resource.c ../../external/libcoap/src/coap_session.c ../../external/libcoap/src/coap_str.c ../../external/libcoap/src/coap_subscribe.c ../../external/libcoap/src/coap_tcp.c ../../external/libcoap/src/coap_uri.c - ../../external/libcoap/src/net.c - ../../external/libcoap/src/pdu.c - ../../external/libcoap/src/resource.c + ../../external/libcoap/src/coap_ws.c libcoap/io.c libcoap/log.c libcoap/time.c From 272d45026d00978aebc4a9da5453beff07192b64 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Wed, 6 Sep 2023 14:23:45 -0400 Subject: [PATCH 05/14] Rename coap_network_{send|read} to coap_socket_{send|recv} Matches the upstream change in libcoap. See https://github.com/obgm/libcoap/commit/aa34b5f. Signed-off-by: Daniel Mangum --- port/zephyr/libcoap/io.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/port/zephyr/libcoap/io.c b/port/zephyr/libcoap/io.c index d9b5d8056..ae04993aa 100644 --- a/port/zephyr/libcoap/io.c +++ b/port/zephyr/libcoap/io.c @@ -36,10 +36,10 @@ unsigned int coap_io_prepare_io( *num_sockets = 0; -#ifndef WITHOUT_ASYNC +#if COAP_ASYNC_SUPPORT /* Check to see if we need to send off any Async requests */ timeout = coap_check_async(ctx, now); -#endif /* WITHOUT_ASYNC */ +#endif /* COAP_ASYNC_SUPPORT */ /* Check to see if we need to send off any retransmit request */ nextpdu = coap_peek_next(ctx); @@ -186,7 +186,7 @@ void coap_packet_get_memmapped(coap_packet_t* packet, unsigned char** address, s ssize_t coap_socket_send( coap_socket_t* sock, - coap_session_t* session, + const coap_session_t* session, const uint8_t* data, size_t data_len) { LOG_DBG("coap_socket_send()"); @@ -261,11 +261,11 @@ void coap_socket_close(coap_socket_t* sock) { sock->fd = -1; } -ssize_t coap_network_read(coap_socket_t* sock, coap_packet_t* packet) { +ssize_t coap_socket_recv(coap_socket_t* sock, coap_packet_t* packet) { ssize_t ret; if ((sock->flags & COAP_SOCKET_CAN_READ) == 0) { - LOG_DBG("coap_network_read: COAP_SOCKET_CAN_READ not set"); + LOG_DBG("coap_socket_recv: COAP_SOCKET_CAN_READ not set"); return -1; } @@ -273,7 +273,7 @@ ssize_t coap_network_read(coap_socket_t* sock, coap_packet_t* packet) { sock->flags &= ~COAP_SOCKET_CAN_READ; if (!(sock->flags & COAP_SOCKET_CONNECTED)) { - LOG_DBG("coap_network_read: !COAP_SOCKET_CONNECTED"); + LOG_DBG("coap_socket_recv: !COAP_SOCKET_CONNECTED"); return -1; } @@ -281,13 +281,13 @@ ssize_t coap_network_read(coap_socket_t* sock, coap_packet_t* packet) { if (ret < 0) { if (errno == ECONNREFUSED || errno == EHOSTUNREACH) { /* client-side ICMP destination unreachable, ignore it */ - LOG_WRN("%s: coap_network_read: ICMP: %s", + LOG_WRN("%s: coap_socket_recv: ICMP: %s", sock->session ? coap_session_str(sock->session) : "", strerror(errno)); return -2; } - LOG_WRN("%s: coap_network_read: %s", + LOG_WRN("%s: coap_socket_recv: %s", sock->session ? coap_session_str(sock->session) : "", strerror(errno)); @@ -306,10 +306,11 @@ ssize_t coap_network_read(coap_socket_t* sock, coap_packet_t* packet) { return -1; } -ssize_t coap_network_send( - coap_socket_t* sock, - const coap_session_t* session, - const uint8_t* data, - size_t datalen) { - return -1; +const char * +coap_socket_format_errno(int error) { + return strerror(error); +} +const char * +coap_socket_strerror(void) { + return coap_socket_format_errno(errno); } From 062fd38be8d047910d313e467d178941b60b2eb6 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Wed, 6 Sep 2023 14:25:36 -0400 Subject: [PATCH 06/14] Use libcoap layers in zephyr port Utilizes the new layers in libcoap that allows for one layer to pass data to and from the next without explicitly specifying the type of the next layer. Signed-off-by: Daniel Mangum --- port/zephyr/libcoap/tls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/port/zephyr/libcoap/tls.c b/port/zephyr/libcoap/tls.c index 30d10211b..d7d5e0834 100644 --- a/port/zephyr/libcoap/tls.c +++ b/port/zephyr/libcoap/tls.c @@ -111,7 +111,7 @@ int coap_dtls_zephyr_connect(coap_session_t* session) { } int coap_dtls_send(coap_session_t* session, const uint8_t* data, size_t data_len) { - return coap_session_send(session, data, data_len); + return (int)session->sock.lfunc[COAP_LAYER_TLS].l_write(session, data, data_len); } void coap_dtls_startup(void) {} From 43e17dca99bacfcf2bda0b56c677275a318c6921 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Wed, 6 Sep 2023 14:59:38 -0400 Subject: [PATCH 07/14] Rename libcoap zephyr files to match upstream Renames the libcoap zephyr files to match the new upstream naming scheme. Signed-off-by: Daniel Mangum --- port/zephyr/CMakeLists.txt | 6 +++--- port/zephyr/libcoap/{io.c => coap_io_zephyr.c} | 0 port/zephyr/libcoap/{time.c => coap_time.c} | 0 port/zephyr/libcoap/{tls.c => coap_zephyrtls.c} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename port/zephyr/libcoap/{io.c => coap_io_zephyr.c} (100%) rename port/zephyr/libcoap/{time.c => coap_time.c} (100%) rename port/zephyr/libcoap/{tls.c => coap_zephyrtls.c} (100%) diff --git a/port/zephyr/CMakeLists.txt b/port/zephyr/CMakeLists.txt index 4f69361cb..a37390caa 100644 --- a/port/zephyr/CMakeLists.txt +++ b/port/zephyr/CMakeLists.txt @@ -97,10 +97,10 @@ zephyr_library_sources( ../../external/libcoap/src/coap_tcp.c ../../external/libcoap/src/coap_uri.c ../../external/libcoap/src/coap_ws.c - libcoap/io.c + libcoap/coap_io_zephyr.c + libcoap/coap_time.c + libcoap/coap_zephyrtls.c libcoap/log.c - libcoap/time.c - libcoap/tls.c # miniz ../../external/miniz/miniz_tinfl.c diff --git a/port/zephyr/libcoap/io.c b/port/zephyr/libcoap/coap_io_zephyr.c similarity index 100% rename from port/zephyr/libcoap/io.c rename to port/zephyr/libcoap/coap_io_zephyr.c diff --git a/port/zephyr/libcoap/time.c b/port/zephyr/libcoap/coap_time.c similarity index 100% rename from port/zephyr/libcoap/time.c rename to port/zephyr/libcoap/coap_time.c diff --git a/port/zephyr/libcoap/tls.c b/port/zephyr/libcoap/coap_zephyrtls.c similarity index 100% rename from port/zephyr/libcoap/tls.c rename to port/zephyr/libcoap/coap_zephyrtls.c From 0efb076e163b6c3172721458e076cbdd96999737 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Thu, 7 Sep 2023 11:31:42 -0400 Subject: [PATCH 08/14] Set CID supported socket option when DLTS CIDs enabled Sets the CID supported socket option when the mbedTLS config has been set. This will cause devices to send CIDs that are negotiated with the server, but will not request that the server does the same. Signed-off-by: Daniel Mangum --- port/zephyr/libcoap/coap_io_zephyr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/port/zephyr/libcoap/coap_io_zephyr.c b/port/zephyr/libcoap/coap_io_zephyr.c index ae04993aa..4b6eb38b6 100644 --- a/port/zephyr/libcoap/coap_io_zephyr.c +++ b/port/zephyr/libcoap/coap_io_zephyr.c @@ -215,6 +215,16 @@ int coap_socket_connect_udp( goto close_socket; } + // If Connection IDs are enabled, set socket option to send CIDs, but not require that the + // server sends one in return. +#ifdef CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID + int ENABLED = 1; + ret = zsock_setsockopt(sock->fd, SOL_TLS, TLS_DTLS_CID, &ENABLED, sizeof(ENABLED)); + if (ret < 0) { + goto close_socket; + } +#endif /* CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID */ + if (session->proto == COAP_PROTO_UDP) { ret = zsock_connect(sock->fd, &connect_addr.addr.sa, connect_addr.size); if (ret < 0) { From 82ddc7e0c35e995e212c47cdf05a0839f81e7bab Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Thu, 7 Sep 2023 17:45:21 -0400 Subject: [PATCH 09/14] Enable coredump decode in esp-idf test Enables coredump decode in esp-idf test so that we can get a stack trace without having to access the binary. Signed-off-by: Daniel Mangum --- examples/esp_idf/test/sdkconfig.defaults | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/esp_idf/test/sdkconfig.defaults b/examples/esp_idf/test/sdkconfig.defaults index c6aa4ac91..94c8719ad 100644 --- a/examples/esp_idf/test/sdkconfig.defaults +++ b/examples/esp_idf/test/sdkconfig.defaults @@ -24,5 +24,6 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n CONFIG_GOLIOTH_ALLOCATION_TRACKING=1 +CONFIG_ESP_COREDUMP_DECODE=y CONFIG_GOLIOTH_COAP_HOST_URI="coaps://coap.golioth.dev" From 26e3b32ee436dd2905022a57d80585604379aa01 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Fri, 8 Sep 2023 04:40:49 -0400 Subject: [PATCH 10/14] Do not call coap_cleanup() when ending session Removes the coap_cleanup() call when ending a session as it destroys resources that are required for ongoing operation. Signed-off-by: Daniel Mangum --- src/golioth_coap_client.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/golioth_coap_client.c b/src/golioth_coap_client.c index 77fbd0317..076b81e0d 100644 --- a/src/golioth_coap_client.c +++ b/src/golioth_coap_client.c @@ -948,7 +948,6 @@ static void golioth_coap_client_thread(void* arg) { coap_free_context(coap_context); GSTATS_INC_FREE("context"); } - coap_cleanup(); // Small delay before starting a new session golioth_sys_msleep(1000); From 2e96970aed9e6caf961a16deb2bcd3846cd7b5b2 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Fri, 8 Sep 2023 04:52:03 -0400 Subject: [PATCH 11/14] Call coap_startup() to remove warning If coap_startup() is not called prior to any other coap_* function calls, a warning is emitted. ``` coap_startup() should be called before any other coap_*() functions are called ``` This proactively calls coap_startup() to ensure the library is initialized, even though coap_new_context() will do so implicitly. Signed-off-by: Daniel Mangum --- src/golioth_coap_client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/golioth_coap_client.c b/src/golioth_coap_client.c index 076b81e0d..674f1f7c9 100644 --- a/src/golioth_coap_client.c +++ b/src/golioth_coap_client.c @@ -966,6 +966,9 @@ golioth_client_t golioth_client_create(const golioth_client_config_t* config) { time_t t; srand(time(&t)); + // Initialize libcoap prior to any coap_* function calls. + coap_startup(); + _initialized = true; } From 07bf2b2e3d50b2cc7c8db06163e07ad4591fa676 Mon Sep 17 00:00:00 2001 From: Sam Friedman Date: Fri, 8 Sep 2023 10:14:23 -0400 Subject: [PATCH 12/14] examples: esp-idf: enable size optimizations Previously, enabling size optimizations would cause a compiler error. The error has been fixed in newer versions of ESP-IDF, so we can re-enable size optimizations. See https://github.com/espressif/esp-idf/issues/10322 Signed-off-by: Sam Friedman --- examples/esp_idf/certificate_auth/sdkconfig.defaults | 3 +-- examples/esp_idf/cpp/sdkconfig.defaults | 3 +-- examples/esp_idf/golioth_basics/sdkconfig.defaults | 5 +---- examples/esp_idf/magtag_demo/sdkconfig.defaults | 3 +-- examples/esp_idf/test/sdkconfig.defaults | 3 +-- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/esp_idf/certificate_auth/sdkconfig.defaults b/examples/esp_idf/certificate_auth/sdkconfig.defaults index b6000dece..9b3b7e021 100644 --- a/examples/esp_idf/certificate_auth/sdkconfig.defaults +++ b/examples/esp_idf/certificate_auth/sdkconfig.defaults @@ -8,8 +8,7 @@ CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n -# TODO - re-enable once resolved: https://github.com/espressif/esp-idf/issues/10322 -#CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_OPTIMIZATION_SIZE=y # Default sdkconfig parameters to use the OTA # partition table layout, with a 4MB flash size diff --git a/examples/esp_idf/cpp/sdkconfig.defaults b/examples/esp_idf/cpp/sdkconfig.defaults index 7117b2329..9d3bedc8d 100644 --- a/examples/esp_idf/cpp/sdkconfig.defaults +++ b/examples/esp_idf/cpp/sdkconfig.defaults @@ -8,8 +8,7 @@ CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n -# TODO - re-enable once resolved: https://github.com/espressif/esp-idf/issues/10322 -#CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_OPTIMIZATION_SIZE=y # GLTH_LOGX statements will automatically upload to Golioth Logs service CONFIG_GOLIOTH_AUTO_LOG_TO_CLOUD=1 diff --git a/examples/esp_idf/golioth_basics/sdkconfig.defaults b/examples/esp_idf/golioth_basics/sdkconfig.defaults index 88605acc2..dec16cb6f 100644 --- a/examples/esp_idf/golioth_basics/sdkconfig.defaults +++ b/examples/esp_idf/golioth_basics/sdkconfig.defaults @@ -8,10 +8,7 @@ CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n -# TODO - re-enable once resolved: https://github.com/espressif/esp-idf/issues/10322 -# Until then, optimize for performance, otherwise IRAM will overflow (BLE stack uses a lot of IRAM). -#CONFIG_COMPILER_OPTIMIZATION_SIZE=y -CONFIG_COMPILER_OPTIMIZATION_PERF=y +CONFIG_COMPILER_OPTIMIZATION_SIZE=y # OTA Partition Table CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y diff --git a/examples/esp_idf/magtag_demo/sdkconfig.defaults b/examples/esp_idf/magtag_demo/sdkconfig.defaults index f71bbb2df..d6bc41f00 100644 --- a/examples/esp_idf/magtag_demo/sdkconfig.defaults +++ b/examples/esp_idf/magtag_demo/sdkconfig.defaults @@ -8,8 +8,7 @@ CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n -# TODO - re-enable once resolved: https://github.com/espressif/esp-idf/issues/10322 -#CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_OPTIMIZATION_SIZE=y # Refer to Adafruit schematic: # https://cdn-learn.adafruit.com/assets/assets/000/096/946/original/adafruit_products_MagTag_sch.png?1605026160 diff --git a/examples/esp_idf/test/sdkconfig.defaults b/examples/esp_idf/test/sdkconfig.defaults index 94c8719ad..6aaddf965 100644 --- a/examples/esp_idf/test/sdkconfig.defaults +++ b/examples/esp_idf/test/sdkconfig.defaults @@ -8,8 +8,7 @@ CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n -# TODO - re-enable once resolved: https://github.com/espressif/esp-idf/issues/10322 -#CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_PARTITION_TABLE_CUSTOM=y From b0e0e9e70f357290381a15696cdbce836d658318 Mon Sep 17 00:00:00 2001 From: Sam Friedman Date: Fri, 8 Sep 2023 10:21:44 -0400 Subject: [PATCH 13/14] ci: build with esp-idf v5.1.1 v5.1.1 is the latest version of ESP-IDF Signed-off-by: Sam Friedman --- .github/workflows/lint_build_unit_test.yml | 8 ++++---- .github/workflows/test_esp32s3.yml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint_build_unit_test.yml b/.github/workflows/lint_build_unit_test.yml index 59c107849..2902c9ec1 100644 --- a/.github/workflows/lint_build_unit_test.yml +++ b/.github/workflows/lint_build_unit_test.yml @@ -75,13 +75,13 @@ jobs: - name: Build ESP-IDF golioth_basics project uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.0 + esp_idf_version: v5.1.1 target: esp32 path: 'examples/esp_idf/golioth_basics' - name: Build ESP-IDF cpp project uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.0 + esp_idf_version: v5.1.1 target: esp32 path: 'examples/esp_idf/cpp' - name: Create empty certs/keys required by certificate_auth project @@ -95,13 +95,13 @@ jobs: - name: Build ESP-IDF certificate_auth project uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.0 + esp_idf_version: v5.1.1 target: esp32 path: 'examples/esp_idf/certificate_auth' - name: Build ESP-IDF magtag_demo project uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.0 + esp_idf_version: v5.1.1 target: esp32 path: 'examples/esp_idf/magtag_demo' diff --git a/.github/workflows/test_esp32s3.yml b/.github/workflows/test_esp32s3.yml index 6fe88e931..487d408f5 100644 --- a/.github/workflows/test_esp32s3.yml +++ b/.github/workflows/test_esp32s3.yml @@ -26,7 +26,7 @@ jobs: - name: Build test project uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.0 + esp_idf_version: v5.1.1 target: esp32s3 path: 'examples/esp_idf/test' - name: Create build tarball for serial flashing @@ -49,7 +49,7 @@ jobs: - name: Rebuild test project with version 1.2.99 uses: espressif/esp-idf-ci-action@v1 with: - esp_idf_version: v5.0 + esp_idf_version: v5.1.1 target: esp32s3 path: 'examples/esp_idf/test' - name: Copy test.bin to test_new.bin From f5d30b00047a24f07b6ca6ccc90e7a2c0b6a1b84 Mon Sep 17 00:00:00 2001 From: Sam Friedman Date: Fri, 8 Sep 2023 10:24:55 -0400 Subject: [PATCH 14/14] readmes: update supported ESP-IDF version to 5.1.1 Update README instructions to match latest supported version of ESP-IDF Signed-off-by: Sam Friedman --- README.md | 6 +++--- examples/esp_idf/README.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 01b6e67c1..0ff018edf 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ The `verify.py` script will return 0 on success (all tests pass), and non-zero o | Board | Platform | Module | Last Tested Commit | | --- | --- | --- | --- | -| ESP32-S3-DevKitC-1 | ESP-IDF (v5.0) | ESP32-S3-WROOM-1 | Every commit, CI/CD | -| ESP32-DevKitC-32E | ESP-IDF (v5.0) | ESP32-WROOM-32E | v0.7.0 (Jun 15, 2023) | -| ESP32-C3-DevKitM-1 | ESP-IDF (v5.0) | ESP32-C3-MINI-1 | v0.7.0 (Jun 15, 2023) | +| ESP32-S3-DevKitC-1 | ESP-IDF (v5.1.1) | ESP32-S3-WROOM-1 | Every commit, CI/CD | +| ESP32-DevKitC-32E | ESP-IDF (v5.1.1) | ESP32-WROOM-32E | v0.7.0 (Jun 15, 2023) | +| ESP32-C3-DevKitM-1 | ESP-IDF (v5.1.1) | ESP32-C3-MINI-1 | v0.7.0 (Jun 15, 2023) | | CY8CPROTO-062-4343W | ModusToolbox (3.0.0) | PSoCĀ® 6 CYW4343W | v0.7.0 (Jun 15, 2023) | diff --git a/examples/esp_idf/README.md b/examples/esp_idf/README.md index b9b922a08..4668bad2e 100644 --- a/examples/esp_idf/README.md +++ b/examples/esp_idf/README.md @@ -2,11 +2,11 @@ This repo contains a set of examples intended to build and run in the latest release of esp-idf -(currently [5.0](https://github.com/espressif/esp-idf/releases/tag/v5.0)). +(currently [5.1.1](https://github.com/espressif/esp-idf/releases/tag/v5.1.1)). ### Install esp-idf -Install version 5.0 of esp-idf using the +Install version 5.1.1 of esp-idf using the [installation directions from Espressif](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#installation). This is the version of esp-idf this SDK is tested against. @@ -16,7 +16,7 @@ For Linux users, you can install esp-idf with these commands: sudo apt-get install git wget flex bison gperf python3 python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 mkdir -p ~/esp cd ~/esp -git clone --recursive https://github.com/espressif/esp-idf.git -b v5.0 +git clone --recursive https://github.com/espressif/esp-idf.git -b v5.1.1 cd esp-idf ./install.sh all ```