diff --git a/.gitignore b/.gitignore
index 96e4168cb..3fdeac4dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,88 +1,124 @@
-# Object files
-*.o
-*.ko
-*.lo
-
-# Libraries
-*.lib
-*.a
-*.la
-
-# Shared objects (inc. Windows DLLs)
-*.dll
-*.so
-*.so.*
-*.dylib
-
-# Executables
-*.exe
-*.out
-*.app
-
-# autoconf misc
-aclocal.m4
-lt*.m4
-*.cache
-config.*
-configure
-libtool
-libtool.m4
-*.log
-*.gz
-Makefile
-Makefile.in
-*.deps
-.dirstamp
-*.libs
-stamp-h
-src/stamp-h1
-build-aux/
-wolfmqtt-config
-aminclude.am
-
-# vim
-*.swp
-tags
-diff
-.vimrc
-
-# test output
-
-# scan-build
-client.plist
-
-# other
-Debug
-.vs
-*.aps
-*.sdf
-*.user
-*.opensdf
-*.trs
-firmware.bin
-wolfmqtt/options.h
-IDE/ARDUINO/wolfMQTT
-IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.X/dist/default/
-build/
-
-# examples
-examples/aws/awsiot
-examples/azure/azureiothub
-examples/firmware/fwclient
-examples/firmware/fwpush
-examples/mqttclient/mqttclient
-examples/mqttsimple/mqttsimple
-examples/nbclient/nbclient
-examples/sn-client/sn-client
-examples/sn-client/sn-client_qos-1
-examples/sn-client/sn-multithread
-examples/multithread/multithread
-examples/wiot/wiot
-examples/pub-sub/mqtt-pub
-examples/pub-sub/mqtt-sub
-
-# eclipse
-.cproject
-.project
-.settings
-
+# Object files
+*.o
+*.ko
+*.lo
+
+# Libraries
+*.lib
+*.a
+*.la
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+
+# autoconf misc
+aclocal.m4
+lt*.m4
+*.cache
+config.*
+configure
+libtool
+libtool.m4
+*.log
+*.gz
+Makefile
+Makefile.in
+*.deps
+.dirstamp
+*.libs
+stamp-h
+src/stamp-h1
+build-aux/
+wolfmqtt-config
+aminclude.am
+
+# vim
+*.swp
+tags
+diff
+.vimrc
+
+# test output
+
+# scan-build
+client.plist
+
+# other
+Debug
+.vs
+*.aps
+*.sdf
+*.user
+*.opensdf
+*.trs
+firmware.bin
+wolfmqtt/options.h
+IDE/ARDUINO/wolfMQTT
+IDE/Microchip-Harmony/wolfmqtt_client/firmware/mqtt_client.X/dist/default/
+build/
+
+# examples
+examples/aws/awsiot
+examples/azure/azureiothub
+examples/firmware/fwclient
+examples/firmware/fwpush
+examples/mqttclient/mqttclient
+examples/mqttsimple/mqttsimple
+examples/nbclient/nbclient
+examples/sn-client/sn-client
+examples/sn-client/sn-client_qos-1
+examples/sn-client/sn-multithread
+examples/multithread/multithread
+examples/wiot/wiot
+examples/pub-sub/mqtt-pub
+examples/pub-sub/mqtt-sub
+
+# eclipse
+.cproject
+.project
+.settings
+
+# All backup files
+*.bak
+
+# auto-created CMake backups
+**/CMakeLists.txt.old
+**/CMakeLists.txt.bak
+
+# VisualGDB
+**/.visualgdb
+**/*.vgdbproj.*.user
+
+# Espressif sdk config default should be saved in sdkconfig.defaults
+# we won't track the actual working sdkconfig files
+/IDE/Espressif/**/out/
+/IDE/Espressif/**/sdkconfig
+/IDE/Espressif/**/sdkconfig.old
+
+# Espressif managed components to exclude:
+/IDE/Espressif/**/managed_components/**
+
+# Espressif managed component lock files to exclude.
+# "In general, it's ok to have it under version control, however, it ties
+# the solution to the exact version of ESP-IDF and will be ignored if an
+# example is built against another IDF version or for a different target.
+# So it's better to git ignore it for the examples."
+/IDE/Espressif/**/dependencies.lock
+
+# exclude any local oqs components
+/IDE/Espressif/ESP-IDF/examples/**/components/oqs
+
+# The only ESP Registry Files specific to this location
+/IDE/Espressif/ESP-IDF/examples/wolfssl_test/**/components/cryptoauthlib
+
+# Never exclude Espressif config.h files
+!/IDE/Espressif/**/config.h
+
diff --git a/IDE/Espressif/ESP-IDF/README.md b/IDE/Espressif/ESP-IDF/README.md
new file mode 100644
index 000000000..63d1d6d63
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/README.md
@@ -0,0 +1,51 @@
+# Espressif ESP-IDF Examples
+
+These are the core [examples](./examples/README.md) for wolfMQTT:
+
+- [template](./examples/wolfmqtt_template/README.md)
+
+- [AWS IoT MQTT](./examples/AWS_IoT_MQTT/README.md)
+
+For details on wolfMQTT [see the wolfMQTT Manual](https://www.wolfssl.com/documentation/manuals/wolfmqtt/wolfMQTT-Manual.pdf).
+
+## Installing wolfSSL for Espressif projects
+
+[Core examples](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples)
+have a local `components/wolfssl` directory with a special CMakeFile.txt that does not require
+wolfSSL to be installed.
+
+If you want to install wolfSSL, see the setup for [wolfSSL](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF#setup-for-linux)
+and [wolfSSH](https://github.com/wolfSSL/wolfssh/tree/master/ide/Espressif#setup-for-linux).
+
+## VisualGDB
+
+Users of VisualGDB can find project files in each respective example `.\VisualGDB` directory.
+For convenience, there are separate project for various target chip sets and ESP-IDF version.
+
+For devices without a built-in JTAG, the projects are configured with the open source [Tigard](https://www.crowdsupply.com/securinghw/tigard)
+and using port `COM20`.
+
+For devices _with_ a built-in JTAG, the projects are using `COM9`
+
+Edit the COM port for your project:
+
+- ESP-IDF Project; Bootloader COM Port.
+- Raw Terminal; COM Port
+
+
+## Troubleshooting
+
+If unusual errors occur, exit Visual Studio and manually delete these directories to start over:
+
+- `.\build`
+- `.\VisualGDB\.visualgdb`
+- `.\VisualGDB\.vs`
+
+
+[RSA peripheral 50% slower on ESP32-S3/C3 than S2](https://www.esp32.com/viewtopic.php?t=23830)
+
+[GPIO6,GPIO7,GPIO8,and GPIO9 changed for ESP32-WROOM-32E](https://esp32.com/viewtopic.php?t=29058)
+
+
+
+
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/CMakeLists.txt
new file mode 100644
index 000000000..af507c835
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/CMakeLists.txt
@@ -0,0 +1,117 @@
+# wolfSSL Espressif Example Project CMakeLists.txt
+# v1.0
+#
+# The following lines of boilerplate have to be in your project's
+# CMakeLists in this exact order for cmake to work correctly
+cmake_minimum_required(VERSION 3.16)
+
+# enable wolfssl user_settings.h project-wide
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
+set(WOLFSSL_USER_SETTINGS ON)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFMQTT_USER_SETTINGS")
+set(WOLFMQTT_USER_SETTINGS ON)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_AWSIOT_EXAMPLE")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_MQTT_TLS")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFMQTT_EXTERN_CERT")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_MAIN_DRIVER")
+
+
+
+# The wolfSSL CMake file should be able to find the source code.
+# Otherwise, assign an environment variable or set it here:
+#
+# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
+# set(WOLFMQTT_ROOT "~/workspace/wolfmqtt-other-source")
+
+# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find
+# USE_MY_PRIVATE_CONFIG path for my_private_config.h
+#
+# Expected path varies:
+#
+# WSL: /mnt/c/workspace
+# Linux: ~/workspace
+# Windows: C:\workspace
+#
+if(WIN32)
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
+ message("Detected Windows")
+endif()
+if(CMAKE_HOST_UNIX)
+ message("Detected UNIX")
+endif()
+if(APPLE)
+ message("Detected APPLE")
+endif()
+if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
+ message("Detected WSL")
+endif()
+if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
+ message("Detected Linux")
+endif()
+if(APPLE)
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
+ message("Detected Apple")
+endif()
+# End optional WOLFSSL_CMAKE_SYSTEM_NAME
+
+# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
+set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+
+if (EXISTS "${PROTOCOL_EXAMPLES_DIR}")
+ message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
+ set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR")
+else()
+ message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
+endif()
+
+# Check that there are not conflicting wolfSSL components
+# The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl
+# The local component wolfSSL directory will be in ./components/wolfssl
+if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" )
+ # These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake'
+ # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL)
+ # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL)
+ # So we'll error out and let the user decide how to proceed:
+ message(WARNING "\nFound wolfSSL components in\n"
+ "./managed_components/wolfssl__wolfssl\n"
+ "and\n"
+ "./components/wolfssl\n"
+ "in project directory: \n"
+ "${CMAKE_HOME_DIRECTORY}")
+ message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n"
+ "If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove "
+ "or rename the idf_component.yml file typically found in ./main/")
+else()
+ message(STATUS "No conflicting wolfSSL components found.")
+endif()
+
+
+# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
+set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+
+if (EXISTS "${PROTOCOL_EXAMPLES_DIR}")
+ message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
+ set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR")
+else()
+ message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
+endif()
+
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+
+#set(COMPONENTS
+ #main
+ #wolfssl
+ #wolfmqtt
+#) # set components
+
+project(wolfssl_mqtt_aws_iot)
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/README.md b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/README.md
new file mode 100644
index 000000000..107020dc9
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/README.md
@@ -0,0 +1,91 @@
+# wolfSSL Example Project: wolfMQTT for AWS IoT
+
+This is an example based on the [AWS IoT Example](https://github.com/wolfSSL/wolfMQTT/tree/master/examples/aws).
+
+## Getting Started
+
+The easiest way to get started is by using the Espressif Managed Component Registry
+at https://components.espressif.com
+
+The latest experimental development version can be found at the staging site:
+[gojimmypi/mywolfmqtt](https://components-staging.espressif.com/components/gojimmypi/mywolfmqtt/versions/1.0.14-test?language=en).
+
+```bash
+#!/bin/bash
+
+. ~/esp/esp-idf/export.sh
+
+# Needed for Staging site:
+export IDF_COMPONENT_REGISTRY_URL=https://components-staging.espressif.com
+
+idf.py create-project-from-example "gojimmypi/mywolfmqtt^1.0.14-test:AWS_IoT_MQTT"
+
+cd AWS_IoT_MQTT
+
+# Set your SSID and wifi Password in example configuration
+idf.py menuconfig
+
+idf.py -p /dev/ttyS9 -b 921600 flash monitor -b 115200
+
+```
+
+### Prerequisites
+
+It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) has been installed.
+
+### Files Included
+
+- [main.c](./main/main.c) with a simple call to an Espressif library (`ESP_LOGI`) and a call to a wolfSSL library (`esp_ShowExtendedSystemInfo`) .
+
+- See [components/wolfssl/include](./components/wolfssl/include/user_settings.h) directory to edit the wolfSSL `user_settings.h`.
+
+- Edit [main/CMakeLists.txt](./main/CMakeLists.txt) to add/remove source files.
+
+- The [components/wolfssl/CMakeLists.txt](./components/wolfssl/CMakeLists.txt) typically does not need to be changed.
+
+- Optional [VisualGDB Project](./VisualGDB/wolfssl_template_IDF_v5.1_ESP32.vgdbproj) for Visual Studio using ESP32 and ESP-IDF v5.1.
+
+- Edit the project [CMakeLists.txt](./CMakeLists.txt) to optionally point this project's wolfSSL component source code at a different directory:
+
+```
+set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
+```
+
+
+## Getting Started:
+
+Here's an example using the command-line [idf.py](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-py.html).
+
+Edit your `WRK_IDF_PATH`to point to your ESP-IDF install directory.
+
+```
+WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.1
+
+echo "Run export.sh from ${WRK_IDF_PATH}"
+. ${WRK_IDF_PATH}/export.sh
+
+# build the example:
+idf.py build
+
+# flash the code onto the serial device at /dev/ttyS19
+idf.py flash -p /dev/ttyS19 -b 115200
+
+# build, flash, and view UART output with one command:
+idf.py flash -p /dev/ttyS19 -b 115200 monitor
+```
+
+Press `Ctrl+]` to exit `idf.py monitor`. See [additional monitor keyboard commands](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html).
+
+## Other Examples:
+
+For examples, see:
+
+- [TLS Client](../wolfssl_client/README.md)
+- [TLS Server](../wolfssl_server/README.md)
+- [Benchmark](../wolfssl_benchmark/README.md)
+- [Test](../wolfssl_test/README.md)
+- [wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32)
+- [wolfssh-examples](https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif)
+
+
+
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/VisualGDB/wolfssl_mqtt_aws_iot_IDF_v5.1_ESP32.sln b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/VisualGDB/wolfssl_mqtt_aws_iot_IDF_v5.1_ESP32.sln
new file mode 100644
index 000000000..1b7972562
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/VisualGDB/wolfssl_mqtt_aws_iot_IDF_v5.1_ESP32.sln
@@ -0,0 +1,79 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33927.249
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "wolfssl_mqtt_aws_iot_IDF_v5.1_ESP32", "wolfssl_mqtt_aws_iot_IDF_v5.1_ESP32.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wolfmqtt", "wolfmqtt", "{36E20B72-864F-499D-9189-7B950DDFA192}"
+ ProjectSection(SolutionItems) = preProject
+ ..\components\wolfmqtt\CMakeLists.txt = ..\components\wolfmqtt\CMakeLists.txt
+ ..\components\wolfmqtt\install_wolfMQTT.cmd = ..\components\wolfmqtt\install_wolfMQTT.cmd
+ ..\components\wolfmqtt\README.md = ..\components\wolfmqtt\README.md
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wolfssl", "wolfssl", "{9D9C7505-51DD-4FD9-ADD7-904213E3C844}"
+ ProjectSection(SolutionItems) = preProject
+ ..\components\wolfssl\CMakeLists.txt = ..\components\wolfssl\CMakeLists.txt
+ ..\components\wolfssl\include\config.h = ..\components\wolfssl\include\config.h
+ ..\..\..\..\..\..\wolfssl\wolfcrypt\port\Espressif\esp32-crypt.h = ..\..\..\..\..\..\wolfssl\wolfcrypt\port\Espressif\esp32-crypt.h
+ ..\components\wolfssl\README.md = ..\components\wolfssl\README.md
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "include", "include", "{F8CBF6BB-D253-4834-B587-58BA6F6C18D1}"
+ ProjectSection(SolutionItems) = preProject
+ ..\components\wolfssl\include\config.h = ..\components\wolfssl\include\config.h
+ ..\components\wolfssl\include\user_settings.h = ..\components\wolfssl\include\user_settings.h
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E03FB71E-E338-4645-A173-346BD0F8ACE4}"
+ ProjectSection(SolutionItems) = preProject
+ ..\README.md = ..\README.md
+ ..\..\..\..\component-manager\wolfssl_component_publish.sh = ..\..\..\..\component-manager\wolfssl_component_publish.sh
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{F01EAA7C-488C-495F-8369-8E64E7B009FD}"
+ ProjectSection(SolutionItems) = preProject
+ ..\..\..\..\..\..\examples\mqttexample.c = ..\..\..\..\..\..\examples\mqttexample.c
+ ..\..\..\..\..\..\examples\mqttexample.h = ..\..\..\..\..\..\examples\mqttexample.h
+ ..\..\..\..\..\..\examples\mqttnet.c = ..\..\..\..\..\..\examples\mqttnet.c
+ ..\..\..\..\..\..\examples\mqttnet.h = ..\..\..\..\..\..\examples\mqttnet.h
+ ..\..\..\..\..\..\examples\mqttport.c = ..\..\..\..\..\..\examples\mqttport.c
+ ..\..\..\..\..\..\examples\mqttport.h = ..\..\..\..\..\..\examples\mqttport.h
+ ..\..\..\..\..\..\examples\mqttuart.c = ..\..\..\..\..\..\examples\mqttuart.c
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "aws", "aws", "{45F1DF18-4619-4BA4-913B-D3B346391C37}"
+ ProjectSection(SolutionItems) = preProject
+ ..\..\..\..\..\..\examples\aws\awsiot.c = ..\..\..\..\..\..\examples\aws\awsiot.c
+ ..\..\..\..\..\..\examples\aws\awsiot.h = ..\..\..\..\..\..\examples\aws\awsiot.h
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|VisualGDB = Debug|VisualGDB
+ Release|VisualGDB = Release|VisualGDB
+ Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
+ Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {F8CBF6BB-D253-4834-B587-58BA6F6C18D1} = {9D9C7505-51DD-4FD9-ADD7-904213E3C844}
+ {45F1DF18-4619-4BA4-913B-D3B346391C37} = {F01EAA7C-488C-495F-8369-8E64E7B009FD}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {9E35A5E5-D3ED-4ED8-8721-F0EE87EA56AB}
+ EndGlobalSection
+EndGlobal
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/VisualGDB/wolfssl_mqtt_aws_iot_IDF_v5.1_ESP32.vgdbproj b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/VisualGDB/wolfssl_mqtt_aws_iot_IDF_v5.1_ESP32.vgdbproj
new file mode 100644
index 000000000..d24af30eb
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/VisualGDB/wolfssl_mqtt_aws_iot_IDF_v5.1_ESP32.vgdbproj
@@ -0,0 +1,269 @@
+
+
+
+
+
+ Unknown
+
+ true
+
+ 7bbd1486-d457-4e49-92ba-0cfc9d80849e
+ true
+ true
+ SourceDirs
+
+
+
+
+
+ com.visualgdb.xtensa-esp32-elf
+
+ 12.2.0
+ 12.1
+ 1
+
+
+ ..
+ DEBUG
+ build/$(PlatformName)/$(ConfigurationName)
+
+ false
+ $(ToolchainNinja)
+ $(BuildDir)
+
+
+
+ false
+ $(SYSPROGS_CMAKE_PATH)
+
+
+ true
+ false
+ false
+ Ninja
+ false
+ RemoveBuildDirectory
+ false
+
+
+ true
+ true
+ true
+ false
+ true
+ false
+ true
+ HideOuterProjectTargets
+ true
+ false
+ true
+
+
+ true
+ eadcc9ab-72b3-4b51-a838-593e5d80ddf7
+
+ Upper
+ HeaderDirectoryAndSubdirectories
+ true
+
+
+ release/v5.1
+ esp-idf/v5.1
+ ESPIDF
+
+ COM19
+ false
+ false
+ ESP32
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default
+
+
+
+ COM19
+
+ 115200
+ 8
+ None
+ One
+ None
+
+
+ 0
+ false
+ false
+ false
+ ASCII
+
+
+ 255
+ 0
+ 0
+ 0
+
+
+ 255
+ 169
+ 169
+ 169
+
+
+ 255
+ 211
+ 211
+ 211
+
+
+ 255
+ 144
+ 238
+ 144
+
+
+ 255
+ 169
+ 169
+ 169
+
+
+
+ 16
+ true
+ true
+ true
+ true
+ 0
+
+ LF
+ false
+ false
+ false
+
+
+
+ true
+
+
+
+
+ Unknown
+
+ true
+ true
+ true
+
+
+
+ false
+
+
+
+
+ Debug
+
+
+
+ Release
+
+
+
+
+
+
+
+
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+
+ false
+ false
+ false
+ false
+ false
+ false
+ true
+ false
+ None
+ false
+ false
+ app_main
+ true
+ false
+ false
+ true
+ 0
+ false
+ 0
+ true
+ false
+
+
+ openocd
+
+ -f interface/ftdi/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg
+
+
+
+ false
+
+ 131072
+ Enabled
+
+ set remotetimeout 60
+ target remote :$$SYS:GDB_PORT$$
+ mon gdb_breakpoint_override hard
+ mon reset halt
+ load
+
+ false
+ 0
+ 0
+ false
+
+ 5000
+ 1
+ true
+
+ size2MB
+ freq40M
+ DIO
+
+ true
+
+
+ true
+ Disabled
+ 0
+ false
+ false
+ true
+ false
+ false
+
+ _estack
+ 0
+ false
+
+ true
+
+
\ No newline at end of file
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/CMakeLists.txt
new file mode 100644
index 000000000..81fed19e8
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/CMakeLists.txt
@@ -0,0 +1,308 @@
+#
+# Copyright (C) 2006-2023 wolfSSL Inc. All rights reserved.
+#
+# This file is part of wolfMQTT.
+#
+# Contact licensing@wolfssl.com with any questions or comments.
+#
+# https://www.wolfssl.com
+#/
+
+#
+# This is the CMakeLists.txt for the Espressif ESP-IDF wolfMQTT component
+#
+cmake_minimum_required(VERSION 3.5)
+
+# Attention!
+#
+# When editing component CMake files, consider the following :
+#
+# NO Managed Components: Normal stand-alone app, "as cloned" from github.
+# There's no notion of staging names (e.g. mywolfmqtt) regardless of environment settings.
+# All of the component source is local. See settings such s WOLFSSL_ROOT=[your path]
+#
+# Partially Managed Components. This one is tricky. When publishing a component with examples,
+# those examples will have a chicken-and-egg problem: the required component is not yet published.
+# Adding to the complexity is the notion of staging components, that are purposely prefixed with
+# "my" (e.g. mywolfmqtt) to distinguish from production, live components (e.g. wolfmqtt)
+#
+# Partially Managed Component Examples are typically only encountered by the component publisher
+# and only at publish time, such as when performing the pre-publish build check.
+#
+# A partially managed component may also be manually created, when adding a managed component to
+# and existing project. For example:
+#
+# idf.py add-dependency "wolfssl/wolfssh^1.4.15-stable"
+#
+# Fully Managed Components. This is the typical example as created from the Component Registry:
+# For example:
+#
+# idf.py create-project-from-example "wolfssl/wolfssh^1.4.15-stable:wolfssh_server"
+#
+# In all cases, keep in mind that components other than wolfssl will depend on the wolfssl component.
+#
+
+# Component naming is only adjusted when using Managed Components, and only when using staging site.
+if( "$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com" )
+ # TODO: Is checking these two variables really the best way to detect an active Component Manager?
+ message(STATUS "component_manager_interface_version = ${component_manager_interface_version}")
+ message(STATUS "managed_components = ${managed_components}")
+ if( ("${managed_components}" STREQUAL "") AND ("${component_manager_interface_version}" STREQUAL "") )
+ # We've found a staging component, but did not detect the component manager
+ set(WOLFSSL_COMPONENT_NAME "wolfssl")
+ else()
+ set(WOLFSSL_COMPONENT_NAME "mywolfssl")
+ endif()
+else()
+ set(WOLFSSL_COMPONENT_NAME "wolfssl")
+endif()
+
+# COMPONENT_NAME = wolfmqtt
+# The component name is the directory name. "No feature to change this".
+# See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685
+
+# set the root of wolfMQTT in top-level project CMakelists.txt:
+# set(WOLFMQTT_ROOT "C:/some path/with/spaces")
+# set(WOLFMQTT_ROOT "c:/workspace/wolfmqtt-[username]")
+# set(WOLFMQTT_ROOT "/mnt/c/some path/with/spaces")
+# or use this logic to assign value from Environment Variable WOLFMQTT_ROOT,
+# or assume this is an example 7 subdirectories below:
+
+# We are typically in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
+# The root of wolfSSL is 7 directories up from here:
+
+# function: IS_WOLFMQTT_SOURCE
+# parameter: DIRECTORY_PARAMETER - the directory to test
+# output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfmqtt directory, otherwise blank.
+function(IS_WOLFMQTT_SOURCE DIRECTORY_PARAMETER RESULT)
+ if (EXISTS "${DIRECTORY_PARAMETER}/wolfmqtt/mqtt_client.h")
+ if (EXISTS "${DIRECTORY_PARAMETER}/wolfmqtt")
+ message(STATUS "1")
+ endif()
+ if (EXISTS "${DIRECTORY_PARAMETER}")
+ message(STATUS "2")
+ endif()
+ if (EXISTS "${DIRECTORY_PARAMETER}/src")
+ message(STATUS "3")
+ endif()
+ set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE)
+ else()
+ set(${RESULT} "" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# function: FIND_WOLFMQTT_DIRECTORY
+# parameter: OUTPUT_FOUND_WOLFMQTT_DIRECTORY contains root of source code, otherwise blank
+#
+function(FIND_WOLFMQTT_DIRECTORY OUTPUT_FOUND_WOLFMQTT_DIRECTORY)
+ message(STATUS "Starting FIND_WOLFMQTT_DIRECTORY")
+ set(CURRENT_SEARCH_DIR "$ENV{WOLFMQTT_ROOT}")
+ if( "${CURRENT_SEARCH_DIR}" STREQUAL "" )
+ message(STATUS "The WOLFMQTT_ROOT environment variable is not set. Searching...")
+ else()
+ get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFMQTT_ROOT}" ABSOLUTE)
+ IS_WOLFMQTT_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFMQTT)
+ if("${FOUND_WOLFMQTT}")
+ message(STATUS "Found WOLFMQTT_ROOT via Environment Variable:")
+ else()
+ message(FATAL_ERROR "WOLFMQTT_ROOT Environment Variable defined, but path not found:")
+ message(STATUS "$ENV{WOLFMQTT_ROOT}")
+ endif()
+ endif()
+
+ # we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfmqtt
+ message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
+ get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
+ message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
+
+ # loop through all the parents, looking for wolfmqtt
+ while(NOT CURRENT_SEARCH_DIR STREQUAL "/" AND NOT CURRENT_SEARCH_DIR STREQUAL "" )
+ string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
+ # wolfmqtt may simply be in a parent directory, such as for local examples in wolfmqtt repo
+ IS_WOLFMQTT_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFMQTT)
+ if( FOUND_WOLFMQTT )
+ message(STATUS "Found wolfmqtt in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ set(${OUTPUT_FOUND_WOLFMQTT_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
+ return()
+ endif()
+
+ if( THIS_USER )
+ # Check for "wolfmqtt-[username]" subdirectory as we recurse up the directory tree
+ set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfmqtt-${THIS_USER})
+ message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
+
+ #if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
+ IS_WOLFMQTT_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFMQTT )
+ if ( FOUND_WOLFMQTT )
+ message(STATUS "Found wolfmqtt in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
+ set(${OUTPUT_FOUND_WOLFMQTT_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
+ return()
+ endif()
+ endif()
+
+ # Next check for no user suffix "wolfmqtt" subdirectory as we recurse up the directory tree
+ set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfmqtt)
+ # if(EXISTS ${CURRENT_SEARCH_DIR} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR} AND EXISTS "${CURRENT_SEARCH_DIR}/wolfcrypt/src")
+ IS_WOLFMQTT_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFMQTT )
+ if ( FOUND_WOLFMQTT )
+ message(STATUS "Found wolfmqtt in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ set(${OUTPUT_FOUND_WOLFMQTT_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
+ return()
+ endif()
+
+ # Move up one directory level
+ set(PRIOR_SEARCH_DIR "${CURRENT_SEARCH_DIR}")
+ get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
+ message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
+ # when the search directory is empty, we'll give up
+ set(CURRENT_SEARCH_DIR "")
+ endif()
+ endwhile()
+
+ # If not found, set the output variable to empty before exiting
+ set(${OUTPUT_FOUND_WOLFMQTT_DIRECTORY} "" PARENT_SCOPE)
+endfunction()
+
+# These flags apply only to compiling this component independently.
+# be sure to include this like in the root CMakeFiles.txt
+# for proper application-wide use of WOLFSSL_USER_SETTINGS:
+#
+# add_compile_definitions("WOLFSSL_USER_SETTINGS")
+# add_compile_definitions("WOLFMQTT_USER_SETTINGS")
+#
+# if using ESP-IDF prior to 4.4, see:
+# https://github.com/wolfSSL/wolfssl/issues/5727
+if (CONFIG_DEBUG_WOLFMQTT)
+ message(STATUS "Config DEBUG_WOLFMQTT is enabled for components/wolfmqtt")
+endif()
+
+if (WOLFSSL_USER_SETTINGS)
+ message(STATUS "Component wolfmqtt: Found predefined WOLFSSL_USER_SETTINGS")
+else()
+ # wolfSSL settings should have occurred in project makefiles
+ #message(WARNING "Component wolfmqtt: Setting WOLFSSL_USER_SETTINGS \
+ #(should have been a project-wide setting)")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWOLFSSL_USER_SETTINGS")
+endif()
+
+if (WOLFMQTT_USER_SETTINGS)
+ message(STATUS "Component wolfmqtt: Found predefined WOLFMQTT_USER_SETTINGS")
+else()
+ # wolfSSL settings should have occurred in project makefiles. See
+ message(WARNING "Component wolfmqtt: Setting WOLFMQTT_USER_SETTINGS
+ (should have been a project-wide setting)")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFMQTT_USER_SETTINGS")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWOLFMQTT_USER_SETTINGS")
+endif()
+
+# Pick up the KConfig value and assign to cmake variable as appropriate
+if(CONFIG_USE_WOLFMQTT_TLS)
+ if (CONFIG_DEBUG_WOLFMQTT)
+ message(STATUS "Config USE_WOLFMQTT_TLS is enabled for components/wolfmqtt")
+ endif()
+ set(MQTT_TLS_DEFINE "ENABLE_MQTT_TLS")
+ add_compile_definitions("${MQTT_TLS_DEFINE}")
+else()
+ if (CONFIG_DEBUG_WOLFMQTT)
+ message(STATUS "Config USE_WOLFMQTT_TLS is NOT enabled for components/wolfmqtt")
+ endif()
+ set(MQTT_TLS_DEFINE "")
+endif()
+
+message(STATUS "wolfmqtt CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
+
+set(CMAKE_CURRENT_SOURCE_DIR ".")
+set(WOLFMQTT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
+set(INCLUDE_PATH ${WOLFMQTT_ROOT})
+
+
+
+set(COMPONENT_REQUIRES lwip ${WOLFSSL_COMPONENT_NAME})
+
+
+# list(REMOVE_ITEM ASM_FILES ".*\\.(asm|S)")
+
+message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
+message(STATUS "WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+message(STATUS "ASM_FILES = ${ASM_FILES}")
+
+
+if(CMAKE_BUILD_EARLY_EXPANSION)
+ message(STATUS "wolfmqtt component CMAKE_BUILD_EARLY_EXPANSION:")
+ idf_component_register(
+ REQUIRES "wolfssl" # "${COMPONENT_REQUIRES}"
+ )
+else()
+ FIND_WOLFMQTT_DIRECTORY(WOLFMQTT_ROOT)
+
+ set(WOLFMQTT_ROOT "${WOLFMQTT_ROOT}" CACHE STRING "WOLFMQTT_ROOT")
+ if(WOLFMQTT_ROOT)
+ message(STATUS "Found wolfmqtt directory at: ${WOLFMQTT_ROOT}")
+ else()
+ message(STATUS "wolfmqtt directory not found.")
+ # Abort. We need wolfmqtt _somewhere_.
+ message(FATAL_ERROR "Could not find wolfmqtt in ${WOLFMQTT_ROOT}.\n"
+ "Try setting WOLFMQTT_ROOT environment variable or git clone.")
+ endif()
+
+ # Do not include example directories here.
+ # CMake will otherwise not see the example code at all, or see it as a duplicate.
+ set(COMPONENT_SRCDIRS "${WOLFMQTT_ROOT}/src"
+ # "${WOLFMQTT_ROOT}/examples"
+ # "${WOLFMQTT_ROOT}/examples/aws"
+ )
+
+
+ if(EXISTS "${WOLFMQTT_ROOT}")
+ message(STATUS "Confirmed exists: WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+ else()
+ message(STATUS "ERROR: Result WOLFMQTT_ROOT does not exist: ${WOLFMQTT_ROOT}")
+ endif()
+
+ if(EXISTS "${WOLFMQTT_ROOT}/src")
+ message(STATUS "Confirmed exists: WOLFMQTT_ROOT/src = ${WOLFMQTT_ROOT}/src")
+ else()
+ message(STATUS "ERROR: Result WOLFMQTT_ROOT does not exist: ${WOLFMQTT_ROOT}/src")
+ endif()
+
+ if(EXISTS "${COMPONENT_SRCDIRS}")
+ message(STATUS "Confirmed exists: COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
+ else()
+ message(STATUS "ERROR: Result COMPONENT_SRCDIRS does not exist: ${COMPONENT_SRCDIRS}")
+ endif()
+
+ message(STATUS "WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+ set(COMPONENT_ADD_INCLUDEDIRS
+ "."
+ "./include"
+ "${WOLFMQTT_ROOT}"
+ "${WOLFMQTT_ROOT}/examples"
+ "${WOLFMQTT_ROOT}/wolfmqtt"
+ "${WOLFMQTT_ROOT}/examples/aws"
+ )
+ # list(REMOVE_ITEM ASM_FILES ".*\\.(asm|S)")
+
+ message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
+ message(STATUS "ASM_FILES = ${ASM_FILES}")
+ set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}")
+ set(COMPONENT_REQUIRES lwip ${WOLFSSL_COMPONENT_NAME})
+ idf_component_register(
+ SRC_DIRS "${COMPONENT_SRCDIRS}"
+ INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}"
+ REQUIRES "${COMPONENT_REQUIRES}"
+ EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
+ PRIV_REQUIRES "${WOLFSSL_COMPONENT_NAME}" # this will typically only be needed for wolfSSL benchmark
+ )
+endif()
+
+# check to see if there's both a local copy and EDP-IDF copy of the wolfmqtt components
+if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfmqtt/" AND EXISTS "$ENV{IDF_PATH}/components/wolfmqtt/" )
+ message(STATUS "")
+ message(WARNING "WARNING: Found components/wolfmqtt in both local project and IDF_PATH")
+ message(STATUS "")
+endif()
+# end multiple component check
+
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/Kconfig b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/Kconfig
new file mode 100644
index 000000000..3e642e36c
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/Kconfig
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2006-2022 wolfSSL Inc. All rights reserved.
+#
+# This file is part of wolfSSL.
+#
+# Contact licensing@wolfssl.com with any questions or comments.
+#
+# https://www.wolfssl.com
+#/
+#
+# Kconfig for wolfssl
+#
+#
+# see project CMakeLists.txt file to enable wolfMQTT with USE_MQTT_LIBRARY
+
+menu "wolfMQTT"
+
+ config USE_WOLFMQTT
+ bool "Use wolfMQTT (requires wolfSSL)"
+ default y
+
+ config USE_WOLFMQTT_TLS
+ bool "Use TLS for wolfMQTT (requires wolfSSL)"
+ default y
+
+ config DEBUG_WOLFMQTT
+ bool "Enable debug messages for wolfMQTT"
+ default y
+
+ config VERBOSE_WOLFMQTT_CMAKE
+ bool "Enable verbose messages for wolfMQTT in CMake"
+ default y
+
+endmenu # wolfMQTT
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/README.md b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/README.md
new file mode 100644
index 000000000..934ecff4e
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/README.md
@@ -0,0 +1,62 @@
+# wolfMQTT for Espressif ESP-IDF
+
+[wolfMQTT](https://www.wolfMQTT.com) provides commercial-grade, world-class encryption libraries to secure connections
+from tiny embedded devices to the largest cloud and super computing platforms.
+
+Makers and students can use these libraries free of charge, as long as they abide by abide by the terms of GPLV2 licensing.
+
+Commercial customers are invited to contact wolfSSL for licensing options.
+Visit [wolfSSL.com/Espressif/](https://www.wolfSSL.com/Espressif/) to learn
+more about Espressif-specific development efforts for wolfSSL, wolfMQTT, wolfSSH, and more.
+
+## Getting Started
+
+The easiest way to get started is by using the Espressif Managed Component Registry
+at
+
+The latest experimental development version can be found at the staging site:
+[gojimmypi/mywolfmqtt](https://components-staging.espressif.com/components/gojimmypi/mywolfmqtt/versions/1.0.14-test?language=en).
+
+```
+#!/bin/bash
+
+. ~/esp/esp-idf/export.sh
+
+# Needed for Staging site:
+export IDF_COMPONENT_REGISTRY_URL=https://components-staging.espressif.com
+
+idf.py create-project-from-example "gojimmypi/mywolfmqtt^1.0.14-test:AWS_IoT_MQTT"
+
+cd AWS_IoT_MQTT
+
+idf.py -p /dev/ttyS9 -b 921600 flash monitor -b 115200
+
+```
+
+## Copy Installation Option
+
+If you wish to _copy_ all the files to the local project component directory,
+run `install_wolfMQTT.cmd` from this directory in Windows, Mac or Linux:
+
+
+
+#### Linux
+```
+./install_wolfMQTT.cmd
+```
+
+#### Mac
+```
+./install_wolfMQTT.cmd
+```
+
+#### Windows
+```
+.\install_wolfMQTT.cmd
+```
+
+#### WSL
+```
+./install_wolfMQTT.cmd
+```
+
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/component.mk b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/component.mk
new file mode 100644
index 000000000..fdfa650d8
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/component.mk
@@ -0,0 +1,41 @@
+# component.mk
+#
+# Copyright (C) 2006-2022 wolfSSL Inc.
+#
+# This file is part of wolfMQTT.
+#
+# wolfMQTT is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# wolfMQTT is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+#
+#
+# This file is for legacy build systems only
+
+CFLAGS += -DWOLFSSL_USER_SETTINGS
+CFLAGS += -DWOLFMQTT_USER_SETTINGS
+
+COMPONENT_ADD_INCLUDEDIRS := . ./include
+
+COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/freertos/include/freertos"
+# COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/soc/esp32s3/include/soc"
+
+COMPONENT_SRCDIRS := src ../wolfssl/wolfcrypt/src
+COMPONENT_SRCDIRS += ../wolfssl/wolfcrypt/src/port/Espressif
+COMPONENT_SRCDIRS += ../wolfssl/wolfcrypt/src/port/atmel
+
+CFLAGS +=-DWOLFSSL_USER_SETTINGS
+
+COMPONENT_OBJEXCLUDE := ../wolfssl/wolfcrypt/src/aes_asm.o
+COMPONENT_OBJEXCLUDE += ../wolfssl/wolfcrypt/src/evp.o
+COMPONENT_OBJEXCLUDE += ../wolfssl/wolfcrypt/src/misc.o
+COMPONENT_OBJEXCLUDE += src/bio.o
\ No newline at end of file
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/include/README.md b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/include/README.md
new file mode 100644
index 000000000..7834a91ed
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/include/README.md
@@ -0,0 +1,7 @@
+# wolfMQTT README
+
+This directory exists to appease the ESP-IDF component manager.
+
+The wolfSSL `user_settings.h` does NOT belong in this directory.
+
+For details on wolfMQTT [see the wolfMQTT Manual](https://www.wolfssl.com/documentation/manuals/wolfmqtt/wolfMQTT-Manual.pdf).
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/install_wolfMQTT.cmd b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/install_wolfMQTT.cmd
new file mode 100644
index 000000000..01cbfc626
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfmqtt/install_wolfMQTT.cmd
@@ -0,0 +1,32 @@
+echo NOTICE: This used the experimental sparse checkout.
+echo See https://git-scm.com/docs/git-sparse-checkout/2.37.0
+echo and https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/
+echo ""
+echo intialize...
+git init
+
+echo remote origin https://github.com/wolfSSL/wolfMQTT.git
+git remote add origin https://github.com/wolfSSL/wolfMQTT.git
+
+echo setting fetch depth = 1
+git fetch --depth 1
+
+echo enabling sparse checkout to limit only files for this component
+git config core.sparsecheckout true
+
+echo it seems only when all parameters are on the git sparse-checkout command does this do what is desired to include and exclude proprly:
+git sparse-checkout set /src/ /test/ /wolfMQTT/ /wolfcrypt/ !/wolfcrypt/src/*.S !/wolfcrypt/src/*.asm /wolfcrypt/src/port/Espressif/ /wolfcrypt/src/port/atmel/
+
+echo checking out master branch....
+git checkout -b master
+
+echo by the time we get here, we should be excluding everything except those items
+echo of interest for the wolfMQTT component
+git pull origin master
+
+mkdir include
+git show master:IDE/Espressif/ESP-IDF/user_settings.h > include/user_settings.h
+git show master:IDE/Espressif/ESP-IDF/libs/CMakeLists.txt > CMakeLists.txt
+git show master:IDE/Espressif/ESP-IDF/libs/component.mk > component.mk
+
+echo wolfMQTT installed!
\ No newline at end of file
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/CMakeLists.txt
new file mode 100644
index 000000000..5e230091c
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/CMakeLists.txt
@@ -0,0 +1,544 @@
+#
+# Copyright (C) 2006-2023 wolfSSL Inc.
+#
+# This file is part of wolfSSL.
+#
+# wolfSSL is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# wolfSSL is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+#
+# cmake for wolfssl Espressif projects
+#
+# Version 5.6.0.011 for detect test/benchmark
+#
+# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
+#
+
+cmake_minimum_required(VERSION 3.16)
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
+set(CMAKE_CURRENT_SOURCE_DIR ".")
+set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
+set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
+
+# find the user name to search for possible "wolfssl-username"
+message(STATUS "USERNAME = $ENV{USERNAME}")
+if( "$ENV{USER}" STREQUAL "" ) # the bash user
+ if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user
+ message(STATUS "could not find USER or USERNAME")
+ else()
+ # the bash user is not blank, so we'll use it.
+ set(THIS_USER "$ENV{USERNAME}")
+ endif()
+else()
+ # the bash user is not blank, so we'll use it.
+ set(THIS_USER "$ENV{USER}")
+endif()
+message(STATUS "THIS_USER = ${THIS_USER}")
+
+
+# COMPONENT_NAME = wolfssl
+# The component name is the directory name. "No feature to change this".
+# See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685
+
+# set the root of wolfSSL in top-level project CMakelists.txt:
+# set(WOLFSSL_ROOT "C:/some path/with/spaces")
+# set(WOLFSSL_ROOT "c:/workspace/wolfssl-[username]")
+# set(WOLFSSL_ROOT "/mnt/c/some path/with/spaces")
+# or use this logic to assign value from Environment Variable WOLFSSL_ROOT,
+# or assume this is an example 7 subdirectories below:
+
+# We are typically in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
+# The root of wolfSSL is 7 directories up from here:
+
+# function: IS_WOLFSSL_SOURCE
+# parameter: DIRECTORY_PARAMETER - the directory to test
+# output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfssl directory, otherwise blank.
+function(IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER RESULT)
+ if (EXISTS "${DIRECTORY_PARAMETER}/wolfcrypt/src")
+ set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE)
+ else()
+ set(${RESULT} "" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# function: FIND_WOLFSSL_DIRECTORY
+# parameter: OUTPUT_FOUND_WOLFSSL_DIRECTORY contains root of source code, otherwise blank
+#
+function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
+ message(STATUS "Starting FIND_WOLFSSL_DIRECTORY")
+ set(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}")
+ if( "${CURRENT_SEARCH_DIR}" STREQUAL "" )
+ message(STATUS "The WOLFSSL_ROOT environment variable is not set. Searching...")
+ else()
+ get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}" ABSOLUTE)
+ IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
+ if("${FOUND_WOLFSSL}")
+ message(STATUS "Found WOLFSSL_ROOT via Environment Variable:")
+ else()
+ message(FATAL_ERROR "WOLFSSL_ROOT Environment Variable defined, but path not found:")
+ message(STATUS "$ENV{WOLFSSL_ROOT}")
+ endif()
+ endif()
+
+ # we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfssl
+ message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
+ get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
+ message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
+
+ # loop through all the parents, looking for wolfssl
+ while(NOT CURRENT_SEARCH_DIR STREQUAL "/" AND NOT CURRENT_SEARCH_DIR STREQUAL "" )
+ string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
+ # wolfSSL may simply be in a parent directory, such as for local examples in wolfssl repo
+ IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
+ if( FOUND_WOLFSSL )
+ message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
+ return()
+ endif()
+
+ if( THIS_USER )
+ # Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
+ set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
+ message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
+
+ #if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
+ IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
+ if ( FOUND_WOLFSSL )
+ message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
+ set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
+ return()
+ endif()
+ endif()
+
+ # Next check for no user suffix "wolfssl" subdirectory as we recurse up the directory tree
+ set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl)
+ # if(EXISTS ${CURRENT_SEARCH_DIR} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR} AND EXISTS "${CURRENT_SEARCH_DIR}/wolfcrypt/src")
+ IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
+ if ( FOUND_WOLFSSL )
+ message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
+ return()
+ endif()
+
+ # Move up one directory level
+ set(PRIOR_SEARCH_DIR "${CURRENT_SEARCH_DIR}")
+ get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
+ message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
+ # when the search directory is empty, we'll give up
+ set(CURRENT_SEARCH_DIR "")
+ endif()
+ endwhile()
+
+ # If not found, set the output variable to empty before exiting
+ set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} "" PARENT_SCOPE)
+endfunction()
+
+
+# Example usage:
+
+
+
+
+if(CMAKE_BUILD_EARLY_EXPANSION)
+ message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
+ idf_component_register(
+ REQUIRES "${COMPONENT_REQUIRES}"
+ PRIV_REQUIRES # esp_hw_support
+ esp_timer
+ driver # this will typically only be needed for wolfSSL benchmark
+ )
+
+else()
+ # not CMAKE_BUILD_EARLY_EXPANSION
+ message(STATUS "************************************************************************************************")
+ message(STATUS "wolfssl component config:")
+ message(STATUS "************************************************************************************************")
+
+ # search for wolfSSL
+ FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
+ if(WOLFSSL_ROOT)
+ message(STATUS "NEW Found wolfssl directory at: ${WOLFSSL_ROOT}")
+ else()
+ message(STATUS "NEW wolfssl directory not found.")
+ # Abort. We need wolfssl _somewhere_.
+ message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n"
+ "Try setting WOLFSSL_ROOT environment variable or git clone.")
+ endif()
+
+ set(INCLUDE_PATH ${WOLFSSL_ROOT})
+
+ set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/src/")
+
+ if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_benchmark" )
+ set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark")
+ endif()
+
+ if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_test" )
+ set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/test")
+ endif()
+
+ set(COMPONENT_SRCDIRS "\"${WOLFSSL_ROOT}/src/\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel\""
+ "\"${WOLFSSL_EXTRA_PROJECT_DIR}\""
+ ) # COMPONENT_SRCDIRS
+
+ message(STATUS "This COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
+
+ set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
+ add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
+
+
+ # Espressif may take several passes through this makefile. Check to see if we found IDF
+ string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
+
+ # get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
+ file(GLOB EXCLUDE_ASM *.S)
+ file(GLOB EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
+
+ message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
+ message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
+ message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
+
+ #
+ # Check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components.
+ #
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
+ #
+ # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
+ #
+ message(STATUS "")
+ message(STATUS "**************************************************************************************")
+ message(STATUS "")
+ message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
+ message(STATUS "")
+ message(STATUS "To proceed: ")
+ message(STATUS "")
+ message(STATUS "Remove either the local project component: ${WOLFSSL_PROJECT_DIR} ")
+ message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
+ message(STATUS "")
+ message(STATUS "")
+ message(STATUS "**************************************************************************************")
+ message(STATUS "")
+
+ message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
+ # Abort CMake after fatal error.
+
+ # Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
+
+ else()
+ if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
+ #
+ # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
+ #
+ message(STATUS "")
+ message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
+ message(STATUS "")
+ else()
+ #
+ # wolfSSL is not an ESP-IDF component.
+ # We need to now determine if it is local and if so if it is part of the wolfSSL repo,
+ # or if wolfSSL is simply installed as a local component.
+ #
+
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}" )
+ #
+ # wolfSSL found in local project.
+ #
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}/wolfcrypt/" )
+ message(STATUS "")
+ message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
+ message(STATUS "")
+ #
+ # Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
+ #
+ # We won't do anything else here, as it will be assumed the original install completed successfully.
+ #
+ else() # full wolfSSL not installed in local project
+ #
+ # This is the developer repo mode. wolfSSL will be assumed to be not installed to ESP-IDF nor local project
+ # In this configuration, we are likely running a wolfSSL example found directly in the repo.
+ #
+ message(STATUS "")
+ message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
+ message(STATUS "")
+
+ message(STATUS "************************************************************************************************")
+ # When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
+ # However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
+ #
+ # first check if there's a [root]/include/user_settings.h
+ if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
+ message(FATAL_ERROR "Found stray wolfSSL user_settings.h in "
+ "${WOLFSSL_ROOT}/include/user_settings.h "
+ " (please move it to ${WOLFSSL_PROJECT_DIR}/include/user_settings.h )")
+ # Abort CMake after fatal error.
+ else()
+ # we won't overwrite an existing user settings file, just note that we already have one:
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/user_settings.h" )
+ message(STATUS "Using existing wolfSSL user_settings.h in "
+ "${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
+ else()
+ message(STATUS "Installing wolfSSL user_settings.h to "
+ "${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
+ file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h"
+ DESTINATION "${CMAKE_HOME_DIRECTORY}/wolfssl/include/")
+ endif()
+ endif() # user_settings.h
+
+ # next check if there's a [root]/include/config.h
+ if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
+ message(STATUS "******************************************************************************")
+ message(STATUS "******************************************************************************")
+ message(STATUS "Found stray wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h" )
+ message(STATUS " Please move it to ${WOLFSSL_PROJECT_DIR}/include/config.h" )
+ message(STATUS "******************************************************************************")
+ message(STATUS "******************************************************************************")
+ else()
+ # we won't overwrite an existing user settings file, just note that we already have one:
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/config.h" )
+ message(STATUS "Using existing wolfSSL config.h ${WOLFSSL_PROJECT_DIR}/include/config.h")
+ else()
+ message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_PROJECT_DIR}/include/config.h")
+ file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_PROJECT_DIR}/include/")
+ file(RENAME "${WOLFSSL_PROJECT_DIR}/include/dummy_config_h" "${WOLFSSL_PROJECT_DIR}/include/config.h")
+ endif() # Project config.h
+ endif() # WOLFSSL_ROOT config.h
+ message(STATUS "************************************************************************************************")
+ message(STATUS "")
+ endif()
+
+ else()
+ # we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
+ if($WOLFSSL_FOUND_IDF)
+ message(STATUS "")
+ message(STATUS "WARNING: wolfSSL not found.")
+ message(STATUS "")
+ else()
+ # probably needs to be re-parsed by Espressif
+ message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
+ endif() # else we have not found ESP-IDF yet
+ endif() # else not a local wolfSSL component
+
+ endif() #else not an ESP-IDF component
+ endif() # else not local copy and EDP-IDF wolfSSL
+
+
+ # RTOS_IDF_PATH is typically:
+ # "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
+ # depending on the environment, we may need to swap backslashes with forward slashes
+ string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
+
+ string(REPLACE "\\" "/" WOLFSSL_ROOT ${WOLFSSL_ROOT})
+
+ if(IS_DIRECTORY "${RTOS_IDF_PATH}")
+ message(STATUS "Found current RTOS path: ${RTOS_IDF_PATH}")
+ else()
+ # ESP-IDF prior version 4.4x has a different RTOS directory structure
+ string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
+ if(IS_DIRECTORY "${RTOS_IDF_PATH}")
+ message(STATUS "Found legacy RTOS path: ${RTOS_IDF_PATH}")
+ else()
+ message(STATUS "Could not find RTOS path")
+ endif()
+ endif()
+
+ # wolfSSL-specific include directories
+ set(COMPONENT_ADD_INCLUDEDIRS
+ "./include" # this is the location of local project wolfssl user_settings.h
+ "\"${WOLFSSL_ROOT}/\""
+ "\"${WOLFSSL_ROOT}/wolfssl/\""
+ "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
+ "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/port/Espressif\""
+ "\"${RTOS_IDF_PATH}/\""
+ )
+
+ # Optionally include cryptoauthlib if present
+ if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
+ list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
+ endif()
+
+ list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/\"")
+ list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\"")
+
+
+ # Some files are known to be included elsewhere, or not used for Espressif
+ set(COMPONENT_SRCEXCLUDE
+ "\"${WOLFSSL_ROOT}/src/bio.c\""
+ "\"${WOLFSSL_ROOT}/src/conf.c\""
+ "\"${WOLFSSL_ROOT}/src/misc.c\""
+ "\"${WOLFSSL_ROOT}/src/pk.c\""
+ "\"${WOLFSSL_ROOT}/src/ssl_asn1.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/x509.c\""
+ "\"${WOLFSSL_ROOT}/src/x509_str.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm64.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_armthumb.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c32.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c64.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_cortexm.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64_asm.S\""
+ "\"${EXCLUDE_ASM}\""
+ )
+
+ spaces2list(COMPONENT_REQUIRES)
+
+ separate_arguments(COMPONENT_SRCDIRS NATIVE_COMMAND "${COMPONENT_SRCDIRS}")
+ separate_arguments(COMPONENT_SRCEXCLUDE NATIVE_COMMAND "${COMPONENT_SRCEXCLUDE}")
+ separate_arguments(COMPONENT_ADD_INCLUDEDIRS NATIVE_COMMAND "${COMPONENT_ADD_INCLUDEDIRS}")
+
+ #
+ # See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-component-requirements
+ #
+ message(STATUS "COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
+ message(STATUS "COMPONENT_ADD_INCLUDEDIRS = ${COMPONENT_ADD_INCLUDEDIRS}")
+ message(STATUS "COMPONENT_REQUIRES = ${COMPONENT_REQUIRES}")
+ message(STATUS "COMPONENT_SRCEXCLUDE = ${COMPONENT_SRCEXCLUDE}")
+
+ #
+ # see https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/build-system.html?highlight=space%20path
+ #
+ set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}")
+ idf_component_register(
+ SRC_DIRS "${COMPONENT_SRCDIRS}"
+ INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}"
+ REQUIRES "${COMPONENT_REQUIRES}"
+ EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
+ PRIV_REQUIRES esp_timer driver # this will typically only be needed for wolfSSL benchmark
+ )
+ # some optional diagnostics
+ if (1)
+ get_cmake_property(_variableNames VARIABLES)
+ list (SORT _variableNames)
+ message(STATUS "")
+ message(STATUS "ALL VARIABLES BEGIN")
+ message(STATUS "")
+ foreach (_variableName ${_variableNames})
+ if ( ("${_variableName}" STREQUAL "bootloader_binary_files")
+ OR ("${_variableName}" STREQUAL "Component paths")
+ OR ("${_variableName}" STREQUAL "component_targets")
+ OR ("${_variableName}" STREQUAL "__COMPONENT_TARGETS")
+ OR ("${_variableName}" STREQUAL "CONFIGS_LIST")
+ OR ("${_variableName}" STREQUAL "__CONFIG_VARIABLES")
+ OR ("${_variableName}" STREQUAL "val")
+ OR ("${_variableName}" MATCHES "^__idf_")
+ )
+ # Truncate the displayed value:
+ string(SUBSTRING "${${_variableName}}" 0 70 truncatedValue)
+ message(STATUS "${_variableName} = ${truncatedValue} ... (truncated)")
+ else()
+ message(STATUS "${_variableName}=${${_variableName}}")
+ endif()
+ endforeach()
+ message(STATUS "")
+ message(STATUS "ALL VARIABLES END")
+ message(STATUS "")
+ endif()
+
+ # target_sources(wolfssl PRIVATE "\"${WOLFSSL_ROOT}/wolfssl/\"" "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt\"")
+
+endif() # CMAKE_BUILD_EARLY_EXPANSION
+
+
+
+# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
+if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
+ message(STATUS "")
+ message(STATUS "")
+ message(STATUS "********************************************************************")
+ message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
+ message(STATUS "********************************************************************")
+ message(STATUS "")
+endif()
+# end multiple component check
+
+
+#
+# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
+#
+# Save the THIS_VAR as a string in a macro called VAR_OUPUT
+#
+# VAR_OUPUT: the name of the macro to define
+# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
+# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
+#
+function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
+ # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
+ string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
+
+ # if we had a successful operation, save the THIS_VAR in VAR_OUPUT
+ if(${IS_VALID_VALUE})
+ # strip newline chars in THIS_VAR parameter and save in VAR_VALUE
+ string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
+
+ # we'll could percolate the value to the parent for possible later use
+ # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
+
+ # but we're only using it here in this function
+ set(${VAR_OUPUT} ${VAR_VALUE})
+
+ # we'll print what we found to the console
+ message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
+
+ # the interesting part is defining the VAR_OUPUT name a value to use in the app
+ add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
+ else()
+ # if we get here, check the execute_process command and parameters.
+ message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
+ set(${VAR_OUPUT} "Unknown")
+ endif()
+endfunction() # LIBWOLFSSL_SAVE_INFO
+
+# create some programmatic #define values that will be used by ShowExtendedSystemInfo().
+# see wolfcrypt\src\port\Espressif\esp32_utl.c
+if(NOT CMAKE_BUILD_EARLY_EXPANSION)
+ set (git_cmd "git")
+ message(STATUS "Adding macro definitions:")
+
+ # LIBWOLFSSL_VERSION_GIT_ORIGIN: git config --get remote.origin.url
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "config" "--get" "remote.origin.url" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_ORIGIN "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_BRANCH: git rev-parse --abbrev-ref HEAD
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--abbrev-ref" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_BRANCH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_HASH: git rev-parse HEAD
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_SHORT_HASH: git rev-parse --short HEAD
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_HASH_DATE git show --no-patch --no-notes --pretty=\'\%cd\'
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
+
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_WOLFSSL_ROOT "${WOLFSSL_ROOT}" "${TMP_RES}")
+
+ message(STATUS "************************************************************************************************")
+ message(STATUS "wolfssl component config complete!")
+ message(STATUS "************************************************************************************************")
+endif()
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/README.md b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/README.md
new file mode 100644
index 000000000..040c8c0ba
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/README.md
@@ -0,0 +1,9 @@
+# Component wolfSSL
+
+This `wolfssl` directory exists only for the stand-alone examples.
+
+The only files of interest are the [CMakeLists.txt](./CMakeLists.txt) that should point
+to the wolfSSL source code and the respective [include/user_settings.h](./include/user_settings.h).
+
+This directory is _not_ included in the publish to the Espressif Registry, as that
+mechanism copies the published source code to the local component directory as needed.
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/include/config.h b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/include/config.h
new file mode 100644
index 000000000..9d13eb284
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/include/config.h
@@ -0,0 +1,24 @@
+/* config.h - dummy
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+#endif
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/include/user_settings.h
new file mode 100644
index 000000000..ecc9ec9d8
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/components/wolfssl/include/user_settings.h
@@ -0,0 +1,503 @@
+/* user_settings.h
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+
+/* This user_settings.h is for Espressif ESP-IDF */
+#include
+/* ENABLE_MQTT_TLS is needed but may already be defined in CMake */
+#ifndef ENABLE_MQTT_TLS
+ #define ENABLE_MQTT_TLS
+#endif
+
+/* WOLFMQTT_USER_SETTINGS is needed may already be defined in CMake */
+#ifndef WOLFMQTT_USER_SETTINGS
+ #define WOLFMQTT_USER_SETTINGS
+#endif
+
+#undef WOLFSSL_ESPIDF
+#undef WOLFSSL_ESP32
+#undef WOLFSSL_ESPWROOM32SE
+#undef WOLFSSL_ESP32
+#undef WOLFSSL_ESP8266
+
+/* The Espressif sdkconfig will have chipset info.
+**
+** Possible values:
+**
+** CONFIG_IDF_TARGET_ESP32
+** CONFIG_IDF_TARGET_ESP32S2
+** CONFIG_IDF_TARGET_ESP32S3
+** CONFIG_IDF_TARGET_ESP32C3
+** CONFIG_IDF_TARGET_ESP32C6
+*/
+
+#undef WOLFSSL_ESPIDF
+#define WOLFSSL_ESPIDF
+
+/*
+ * choose ONE of these Espressif chips to define:
+ *
+ * WOLFSSL_ESP32
+ * WOLFSSL_ESPWROOM32SE
+ * WOLFSSL_ESP8266
+ */
+#undef WOLFSSL_ESPWROOM32SE
+#undef WOLFSSL_ESP8266
+#undef WOLFSSL_ESP32
+
+#define WOLFSSL_ESP32
+
+/* optionally turn off SHA512/224 SHA512/256 */
+/* #define WOLFSSL_NOSHA512_224 */
+/* #define WOLFSSL_NOSHA512_256 */
+
+/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */
+/* #define SINGLE_THREADED */
+
+/* When you don't want to use the old SHA */
+/* #define NO_SHA */
+/* #define NO_OLD_TLS */
+
+#define BENCH_EMBEDDED
+#define USE_CERT_BUFFERS_2048
+
+/* TLS 1.3 */
+#define WOLFSSL_TLS13
+#define HAVE_TLS_EXTENSIONS
+#define WC_RSA_PSS
+#define HAVE_HKDF
+#define HAVE_AEAD
+#define HAVE_SUPPORTED_CURVES
+
+#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB
+
+/* when you want to use SINGLE THREAD; ESP-IDF is freeRTOS */
+/* #define SINGLE_THREADED */
+
+#define NO_FILESYSTEM
+
+#define NO_OLD_TLS
+
+#define HAVE_AESGCM
+
+#define WOLFSSL_RIPEMD
+/* when you want to use SHA224 */
+/* #define WOLFSSL_SHA224 */
+
+#define NO_OLD_TLS
+#define WOLFSSL_SHA3
+
+/* when you want to use SHA384 */
+/* #define WOLFSSL_SHA384 */
+
+/* when you DO NOT want to use SHA256 */
+/* #define NO_SHA256 */
+
+#define WOLFSSL_SHA512
+#define HAVE_ECC
+#define HAVE_CURVE25519
+#define CURVE25519_SMALL
+#define HAVE_ED25519
+
+/* #define OPENSSL_EXTRA */
+
+/* when you want to use pkcs7 */
+/* #define HAVE_PKCS7 */
+
+#if defined(HAVE_PKCS7)
+ #define HAVE_AES_KEYWRAP
+ #define HAVE_X963_KDF
+ #define WOLFSSL_AES_DIRECT
+#endif
+
+/* when you want to use aes counter mode */
+/* #define WOLFSSL_AES_DIRECT */
+/* #define WOLFSSL_AES_COUNTER */
+
+/* esp32-wroom-32se specific definition */
+#if defined(WOLFSSL_ESPWROOM32SE)
+ #define WOLFSSL_ATECC508A
+ #define HAVE_PK_CALLBACKS
+ /* when you want to use a custom slot allocation for ATECC608A */
+ /* unless your configuration is unusual, you can use default */
+ /* implementation. */
+ /* #define CUSTOM_SLOT_ALLOCATION */
+#endif
+
+/* rsa primitive specific definition */
+#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
+ /* Define USE_FAST_MATH and SMALL_STACK */
+ #define ESP32_USE_RSA_PRIMITIVE
+
+ #if defined(CONFIG_IDF_TARGET_ESP32)
+
+ /* NOTE HW unreliable for small values! */
+ /* threshold for performance adjustment for HW primitive use */
+ /* X bits of G^X mod P greater than */
+ #undef ESP_RSA_EXPT_XBITS
+ #define ESP_RSA_EXPT_XBITS 32
+
+ /* X and Y of X * Y mod P greater than */
+ #undef ESP_RSA_MULM_BITS
+ #define ESP_RSA_MULM_BITS 16
+
+ #endif
+#endif
+
+#define RSA_LOW_MEM
+
+/* debug options */
+/* #define DEBUG_WOLFSSL */
+/* #define WOLFSSL_ESP32_CRYPT_DEBUG */
+/* #define WOLFSSL_ATECC508A_DEBUG */
+
+/* date/time */
+/* if it cannot adjust time in the device, */
+/* enable macro below */
+/* #define NO_ASN_TIME */
+/* #define XTIME time */
+
+/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
+#define ESP_RSA_TIMEOUT_CNT 0x249F00
+
+#define HASH_SIZE_LIMIT /* for test.c */
+
+/* USE_FAST_MATH is default */
+#define USE_FAST_MATH
+
+/***** Use SP_MATH *****/
+/* #undef USE_FAST_MATH */
+/* #define SP_MATH */
+/* #define WOLFSSL_SP_MATH_ALL */
+
+/***** Use Integer Heap Math *****/
+/* #undef USE_FAST_MATH */
+/* #define USE_INTEGER_HEAP_MATH */
+
+
+#define WOLFSSL_SMALL_STACK
+
+#define HAVE_VERSION_EXTENDED_INFO
+#define HAVE_WC_INTROSPECTION
+
+/* allows for all version info, even that suppressed with introspection */
+#define ALLOW_BINARY_MISMATCH_INTROSPECTION
+
+/* Default is HW enabled unless turned off.
+** Uncomment these lines to force SW instead of HW acceleration */
+
+#if defined(CONFIG_IDF_TARGET_ESP32)
+ /* wolfSSL HW Acceleration supported on ESP32. Uncomment to disable: */
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+
+ /* These are defined automatically in esp32-crypt.h, here for clarity: */
+ /* no SHA224 HW on ESP32 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224
+
+ /* TODO add compile-time warning for appropriate size: */
+ #undef ESP_RSA_MULM_BITS
+ #define ESP_RSA_MULM_BITS 16
+ /***** END CONFIG_IDF_TARGET_ESP32 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32S2)
+ /* wolfSSL HW Acceleration supported on ESP32-S2. Uncomment to disable: */
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
+ /* Note: There's no AES192 HW on the ESP32-S2; falls back to SW */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+ /***** END CONFIG_IDF_TARGET_ESP32S2 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32S3)
+ /* wolfSSL HW Acceleration supported on ESP32-S3. Uncomment to disable: */
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
+ /* Note: There's no AES192 HW on the ESP32-S3; falls back to SW */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+ /***** END CONFIG_IDF_TARGET_ESP32S3 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
+ defined(CONFIG_IDF_TARGET_ESP8684)
+ /* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
+ * single QFN 4x4 mm package. Out of released documentation, Technical
+ * Reference Manual as well as ESP-IDF Programming Guide is applicable
+ * to both ESP32-C2 and ESP8684.
+ *
+ * See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
+
+ /* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
+
+ /* These are defined automatically in esp32-crypt.h, here for clarity */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
+
+ /* There's no AES or RSA/Math accelerator on the ESP32-C2
+ * Automatically defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
+ /***** END CONFIG_IDF_TARGET_ESP32C2 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32C3)
+ /* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
+
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
+
+ /* These are defined automatically in esp32-crypt.h, here for clarity: */
+ /* no SHA384 HW on C3 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384
+ /* no SHA512 HW on C3 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512
+
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+ /***** END CONFIG_IDF_TARGET_ESP32C3 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32C6)
+ /* wolfSSL HW Acceleration supported on ESP32-C6. Uncomment to disable: */
+
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
+ /* These are defined automatically in esp32-crypt.h, here for clarity: */
+ /* no SHA384 HW on C6 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384
+ /* no SHA512 HW on C6 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512
+
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+ /***** END CONFIG_IDF_TARGET_ESP32C6 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32H2)
+ /* wolfSSL Hardware Acceleration not yet implemented */
+ #define NO_ESP32_CRYPT
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+ /***** END CONFIG_IDF_TARGET_ESP32H2 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP8266)
+ /* There's no hardware accleration on the ESP8266 */
+ #define NO_ESP32_CRYPT
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+ /***** END CONFIG_IDF_TARGET_ESP266 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP8684)
+ /* There's no Hardware Acceleration available on ESP8684 */
+ #define NO_ESP32_CRYPT
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+ /***** END CONFIG_IDF_TARGET_ESP8684 *****/
+
+#else
+ /* Anything else encountered, disable HW accleration */
+ #define NO_ESP32_CRYPT
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+#endif /* CONFIG_IDF_TARGET Check */
+
+/* Debug options:
+
+#define ESP_VERIFY_MEMBLOCK
+#define DEBUG_WOLFSSL
+#define DEBUG_WOLFSSL_VERBOSE
+#define DEBUG_WOLFSSL_SHA_MUTEX
+#define WOLFSSL_ESP32_CRYPT_DEBUG
+#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
+#define NO_RECOVER_SOFTWARE_CALC
+#define WOLFSSL_TEST_STRAY 1
+#define USE_ESP_DPORT_ACCESS_READ_BUFFER
+#define WOLFSSL_ESP32_HW_LOCK_DEBUG
+#define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
+#define ESP_DISABLE_HW_TASK_LOCK
+*/
+
+#define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
+#define WOLFSSL_HW_METRICS
+
+/* #define HASH_SIZE_LIMIT */ /* for test.c */
+
+/* #define NO_HW_MATH_TEST */ /* Optionall turn off HW math checks */
+
+/* Optionally include alternate HW test library: alt_hw_test.h */
+/* When enabling, the ./components/wolfssl/CMakeLists.txt file
+ * will need the name of the library in the idf_component_register
+ * for the PRIV_REQUIRES list. */
+/* #define INCLUDE_ALT_HW_TEST */
+
+/* optionally turn off individual math HW acceleration features */
+
+/* Turn off Large Number ESP32 HW Multiplication:
+** [Z = X * Y] in esp_mp_mul() */
+/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+
+/* Turn off Large Number ESP32 HW Modular Exponentiation:
+** [Z = X^Y mod M] in esp_mp_exptmod() */
+/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+
+/* Turn off Large Number ESP32 HW Modular Multiplication
+** [Z = X * Y mod M] in esp_mp_mulmod() */
+/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+
+
+#define WOLFSSL_PUBLIC_MP /* used by benchmark */
+#define USE_CERT_BUFFERS_2048
+
+/* when turning on ECC508 / ECC608 support
+#define WOLFSSL_ESPWROOM32SE
+#define HAVE_PK_CALLBACKS
+#define WOLFSSL_ATECC508A
+#define ATCA_WOLFSSL
+*/
+
+/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
+#define WOLFSSL_SM2
+#define WOLFSSL_SM3
+#define WOLFSSL_SM4
+*/
+
+/* this is for example code */
+#undef NO_MAIN_DRIVER /* sometimes defined in project cmake file */
+#define NO_MAIN_DRIVER
+
+#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4)
+ #include
+ #define CTX_CA_CERT root_sm2
+ #define CTX_CA_CERT_SIZE sizeof_root_sm2
+ #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM
+ #define CTX_SERVER_CERT server_sm2
+ #define CTX_SERVER_CERT_SIZE sizeof_server_sm2
+ #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_PEM
+ #define CTX_SERVER_KEY server_sm2_priv
+ #define CTX_SERVER_KEY_SIZE sizeof_server_sm2_priv
+ #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_PEM
+
+ #undef WOLFSSL_BASE16
+ #define WOLFSSL_BASE16
+#else
+ #define USE_CERT_BUFFERS_2048
+ #define USE_CERT_BUFFERS_256
+ #define CTX_CA_CERT ca_cert_der_2048
+ #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
+ #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
+ #define CTX_SERVER_CERT server_cert_der_2048
+ #define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_2048
+ #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1
+ #define CTX_SERVER_KEY server_key_der_2048
+ #define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
+ #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
+#endif
+
+/* VS include follows: */
+#ifndef _WOLFMQTT_VS_SETTINGS_
+#define _WOLFMQTT_VS_SETTINGS_
+
+/* Don't include this if using autoconf cross-compile */
+#if defined(HAVE_CONFIG_H)
+ #warning "Unexpected use of config.h"
+#else
+ /* TLS Support */
+ #undef ENABLE_MQTT_TLS
+ #define ENABLE_MQTT_TLS
+
+ /* MQTT-SN Support */
+ #undef WOLFMQTT_SN
+ #define WOLFMQTT_SN
+
+ /* MQTT v5.0 support */
+ #undef WOLFMQTT_V5
+ #define WOLFMQTT_V5
+
+ /* Enable property callback support */
+ #ifdef WOLFMQTT_V5
+ #undef WOLFMQTT_PROPERTY_CB
+ #define WOLFMQTT_PROPERTY_CB
+ #endif
+
+ /* Non-blocking support */
+ #undef WOLFMQTT_NONBLOCK
+ #define WOLFMQTT_NONBLOCK
+
+ /* Disable socket timeout code */
+ /*
+ #undef WOLFMQTT_NO_TIMEOUT
+ #define WOLFMQTT_NO_TIMEOUT
+ */
+
+ /* Disconnect callback support */
+ #undef WOLFMQTT_DISCONNECT_CB
+ #define WOLFMQTT_DISCONNECT_CB
+
+ /* Multi-threading */
+ #undef WOLFMQTT_MULTITHREAD
+ #define WOLFMQTT_MULTITHREAD
+
+ /* Debugging */
+ /*
+ #undef DEBUG_WOLFMQTT
+ #define DEBUG_WOLFMQTT
+
+ #undef WOLFMQTT_DEBUG_CLIENT
+ #define WOLFMQTT_DEBUG_CLIENT
+
+ #undef WOLFMQTT_DEBUG_SOCKET
+ #define WOLFMQTT_DEBUG_SOCKET
+
+ #undef WOLFMQTT_DEBUG_THREAD
+ #define WOLFMQTT_DEBUG_THREAD
+ */
+
+ /* Disable error strings */
+ /*
+ #undef WOLFMQTT_NO_ERROR_STRINGS
+ #define WOLFMQTT_NO_ERROR_STRINGS
+ */
+
+#endif /* !HAVE_CONFIG_H */
+
+#endif /* _WOLFMQTT_VS_SETTINGS_ */
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/CMakeLists.txt
new file mode 100644
index 000000000..9e357c553
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/CMakeLists.txt
@@ -0,0 +1,196 @@
+# wolfSSL wolfMQTT Espressif Example Project/main/CMakeLists.txt
+# v1.0
+#
+message(STATUS "main cmake found WOLFSSL_COMPONENT_NAME = ${WOLFSSL_COMPONENT_NAME}")
+
+# find the user name to search for possible "wolfssl-username"
+message(STATUS "USERNAME = $ENV{USERNAME}")
+if( "$ENV{USER}" STREQUAL "" ) # the bash user
+ if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user
+ message(STATUS "could not find USER or USERNAME")
+ else()
+ # the bash user is not blank, so we'll use it.
+ set(THIS_USER "$ENV{USERNAME}")
+ endif()
+else()
+ # the bash user is not blank, so we'll use it.
+ set(THIS_USER "$ENV{USER}")
+endif()
+message(STATUS "THIS_USER (main) = ${THIS_USER}")
+
+if(WIN32)
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
+ message("Detected Windows")
+endif()
+if(CMAKE_HOST_UNIX)
+ message("Detected UNIX")
+endif()
+if(APPLE)
+ message("Detected APPLE")
+endif()
+if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
+ message("Detected WSL")
+endif()
+if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
+ message("Detected Linux")
+endif()
+if(APPLE)
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
+ message("Detected Apple")
+endif()
+set (git_cmd "git")
+
+if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
+ #
+ # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
+ #
+ message(STATUS "")
+ message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
+ message(STATUS "")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
+endif()
+
+if( "$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com" )
+ # Currently the only staging namespace is the gojimmypi developer, but allow for override.
+ # See https://components-staging.espressif.com/components?q=namespace:gojimmypi
+ #
+ if( "$ENV{WOLFSSL_STAGING_NAMESPACE}" STREQUAL "" )
+ set(WOLFSSL_STAGING_NAMESPACE "gojimmypi")
+ else()
+ set(WOLFSSL_STAGING_NAMESPACE "$ENV{WOLFSSL_STAGING_NAMESPACE}")
+ endif()
+ message(STATUS "Using namespace: ${WOLFSSL_STAGING_NAMESPACE}")
+
+ if( ("${managed_components}" STREQUAL "") AND ("${component_manager_interface_version}" STREQUAL "") )
+ # We've found a staging component, but did not detect the component manager
+ if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../components/mywolfmqtt/CMakeLists.txt)
+ # This is typically during publish-time build test
+ message(STATUS "Set name mywolfmqtt (1)")
+ set(WOLFSSL_COMPONENT_NAME "mywolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "mywolfmqtt")
+ else()
+ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../managed_components/${WOLFSSL_STAGING_NAMESPACE}__mywolfmqtt/CMakeLists.txt")
+ # This is typically upon creating a project from managed component examples
+ message(STATUS "Set name mywolfmqtt (2)")
+ set(WOLFSSL_COMPONENT_NAME "mywolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "mywolfmqtt")
+ else()
+ message(STATUS "Set name wolfmqtt (1) CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}")
+ set(WOLFSSL_COMPONENT_NAME "wolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "wolfmqtt")
+ endif()
+ endif()
+ else()
+ message(STATUS "Set name mywolfmqtt (3)")
+ set(WOLFSSL_COMPONENT_NAME "mywolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "mywolfmqtt")
+ endif()
+else()
+ message(STATUS "Set name wolfmqtt (2)")
+ set(WOLFSSL_COMPONENT_NAME "wolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "wolfmqtt")
+endif()
+
+if(CMAKE_BUILD_EARLY_EXPANSION)
+ message(STATUS "wolfmqtt component CMAKE_BUILD_EARLY_EXPANSION:")
+ string(REPLACE "\\" "/" PROTOCOL_EXAMPLES "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common")
+ idf_component_register(
+ INCLUDE_DIRS
+ "include"
+ "${PROTOCOL_EXAMPLES}"
+ REQUIRES
+ "${WOLFMQTT_COMPONENT_NAME}"
+ nvs_flash
+ esp_event
+ esp_netif
+ esp_wifi
+ PRIV_REQUIRES
+ "${WOLFSSL_COMPONENT_NAME}"
+ )
+ message(STATUS "Early Expansion WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+else()
+ ## register_component()
+ message(STATUS "main WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+
+ string(REPLACE "\\" "/" PROTOCOL_EXAMPLES "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common/include")
+ idf_component_register(SRCS
+ main.c
+ wifi_connect.c
+ time_helper.c
+ ${WOLFMQTT_ROOT}/examples/mqttexample.c
+ ${WOLFMQTT_ROOT}/examples/mqttnet.c
+ ${WOLFMQTT_ROOT}/examples/mqttport.c
+ ${WOLFMQTT_ROOT}/examples/aws/awsiot.c
+ INCLUDE_DIRS
+ "."
+ "include"
+ "${WOLFMQTT_ROOT}/examples/aws/"
+ "${PROTOCOL_EXAMPLES}"
+ REQUIRES
+ "${WOLFMQTT_COMPONENT_NAME}"
+ "${WOLFSSL_COMPONENT_NAME}"
+ lwip
+ nvs_flash
+ esp_event
+ )
+endif()
+#
+
+#
+# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
+#
+# Save the THIS_VAR as a string in a macro called VAR_OUPUT
+#
+# VAR_OUPUT: the name of the macro to define
+# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
+# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
+#
+function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
+ # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
+ string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
+
+ # if we had a successful operation, save the THIS_VAR in VAR_OUPUT
+ if(${IS_VALID_VALUE})
+ # strip newline chars in THIS_VAR parameter and save in VAR_VALUE
+ string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
+
+ # we'll could percolate the value to the parent for possible later use
+ # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
+
+ # but we're only using it here in this function
+ set(${VAR_OUPUT} ${VAR_VALUE})
+
+ # we'll print what we found to the console
+ message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
+
+ # the interesting part is defining the VAR_OUPUT name a value to use in the app
+ add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
+ else()
+ # if we get here, check the execute_process command and parameters.
+ message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
+ set(${VAR_OUPUT} "Unknown")
+ endif()
+endfunction() # LIBWOLFSSL_SAVE_INFO
+
+if(NOT CMAKE_BUILD_EARLY_EXPANSION)
+ # LIBWOLFSSL_VERSION_GIT_HASH
+ execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_SHORT_HASH
+ execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_HASH_DATE
+ execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
+endif()
+
+message(STATUS "")
+
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/main.h b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/main.h
new file mode 100644
index 000000000..6f26ad70c
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/main.h
@@ -0,0 +1,29 @@
+/* template main.h
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+#ifndef _MAIN_H_
+#define _MAIN_H_
+
+#include
+#include
+#include
+#include
+
+#endif
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/time_helper.h b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/time_helper.h
new file mode 100644
index 000000000..a47f94001
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/time_helper.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+
+/* common Espressif time_helper v5.6.3.001 */
+
+#ifndef _TIME_HELPER_H
+#define _TIME_HELPER_H
+
+/* ESP-IDF uses a 64-bit signed integer to represent time_t starting from release v5.0
+ * See: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#year-2036-and-2038-overflow-issues
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* a function to show the current data and time */
+int esp_show_current_datetime();
+
+/* worst case, if GitHub time not available, used fixed time */
+int set_fixed_default_time(void);
+
+/* set time from string (e.g. GitHub commit time) */
+int set_time_from_string(char* time_buffer);
+
+/* set time from NTP servers,
+ * also initially calls set_fixed_default_time or set_time_from_string */
+int set_time(void);
+
+/* wait NTP_RETRY_COUNT seconds before giving up on NTP time */
+int set_time_wait_for_ntp(void);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* #ifndef _TIME_HELPER_H */
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/wifi_connect.h b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/wifi_connect.h
new file mode 100644
index 000000000..a0014d4c3
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/include/wifi_connect.h
@@ -0,0 +1,96 @@
+/* wifi_connect.h
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+#ifndef _WIFI_CONNECT_H_
+#define _WIFI_CONNECT_H_
+
+#include
+#include
+
+/* ESP lwip */
+#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
+
+#define TLS_SMP_SERVER_TASK_NAME "tls_sever_example"
+#define TLS_SMP_SERVER_TASK_WORDS 22240
+#define TLS_SMP_SERVER_TASK_PRIORITY 8
+
+#define TLS_SMP_WIFI_SSID CONFIG_WIFI_SSID
+#define TLS_SMP_WIFI_PASS CONFIG_WIFI_PASSWORD
+
+#define USE_WIFI_EXAMPLE
+#ifdef USE_WIFI_EXAMPLE
+ #include /* see project CMakeLists.txt */
+#endif
+
+/**
+ ******************************************************************************
+ ******************************************************************************
+ ** USER APPLICATION SETTINGS BEGIN
+ ******************************************************************************
+ ******************************************************************************
+ **/
+
+/* when using a private config with plain text passwords,
+ * file my_private_config.h should be excluded from git updates */
+/* #define USE_MY_PRIVATE_CONFIG */
+
+#ifdef USE_MY_PRIVATE_CONFIG
+ #if defined(WOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS)
+ #include "/workspace/my_private_config.h"
+ #elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_WSL)
+ #include "/mnt/c/workspace/my_private_config.h"
+ #elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_LINUX)
+ #include "~/workspace/my_private_config.h"
+ #elif defined(WOLFSSL_CMAKE_SYSTEM_NAME_APPLE)
+ #include "~/Documents/my_private_config.h"
+ #else
+ #warning "did not detect environment. using ~/my_private_config.h"
+ #include "~/my_private_config.h"
+ #endif
+#else
+
+ /*
+ ** The examples use WiFi configuration that you can set via project
+ ** configuration menu
+ **
+ ** If you'd rather not, just change the below entries to strings with
+ ** the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
+ */
+ #ifdef CONFIG_ESP_WIFI_SSID
+ #define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
+ #else
+ #define EXAMPLE_ESP_WIFI_SSID "MYSSID_WIFI_CONNECT"
+ #endif
+
+ #ifdef CONFIG_ESP_WIFI_PASSWORD
+ #define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
+ #else
+ #define EXAMPLE_ESP_WIFI_PASS "MYPASSWORD_WIFI_CONNECT"
+ #endif
+#endif
+
+/* ESP lwip */
+#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
+
+int wifi_init_sta(void);
+
+int wifi_show_ip(void);
+
+#endif /* _WIFI_CONNECT_H_ */
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/main.c b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/main.c
new file mode 100644
index 000000000..408532385
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/main.c
@@ -0,0 +1,147 @@
+/* main.c
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+#include "sdkconfig.h"
+#include "main.h"
+
+/* ESP specific */
+#include
+#include
+#include
+
+/* wolfSSL */
+#include /* includes wolfSSL user-settings.h */
+#include
+#ifndef WOLFSSL_ESPIDF
+ #warning "Problem with wolfSSL user_settings."
+ #warning "Check components/wolfssl/include"
+#endif
+
+/* this project */
+#include "wifi_connect.h"
+#include "time_helper.h"
+
+static const char* const TAG = "wolfmqtt main";
+
+void app_main(void)
+{
+ int ret = 0;
+ ESP_LOGI(TAG, "------------- wolfSSL wolfMQTT AWS IoT Example ---------");
+ ESP_LOGI(TAG, "--------------------------------------------------------");
+ ESP_LOGI(TAG, "--------------------------------------------------------");
+ ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------");
+ ESP_LOGI(TAG, "--------------------------------------------------------");
+ ESP_LOGI(TAG, "--------------------------------------------------------");
+#ifdef HAVE_VERSION_EXTENDED_INFO
+ esp_ShowExtendedSystemInfo();
+#endif
+
+ /* Set time for cert validation.
+ * Some lwIP APIs, including SNTP functions, are not thread safe. */
+ ret = set_time(); /* need to setup NTP before WiFi */
+
+ /* Optionally erase flash */
+ /* ESP_ERROR_CHECK(nvs_flash_erase()); */
+
+#ifdef FOUND_PROTOCOL_EXAMPLES_DIR
+ ESP_LOGI(TAG, "FOUND_PROTOCOL_EXAMPLES_DIR active, using example code.");
+ ESP_ERROR_CHECK(nvs_flash_init());
+
+ #if defined(CONFIG_IDF_TARGET_ESP32H2)
+ ESP_LOGE(TAG, "There's no WiFi on ESP32-H2.");
+ #else
+ #ifdef CONFIG_EXAMPLE_WIFI_SSID
+ if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
+ ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is myssid.");
+ ESP_LOGW(TAG, " Do you have a WiFi AP called myssid, or ");
+ ESP_LOGW(TAG, " did you forget the ESP-IDF configuration?");
+ }
+ #else
+ #define CONFIG_EXAMPLE_WIFI_SSID "myssid"
+ ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
+ #endif
+ ESP_ERROR_CHECK(esp_netif_init());
+ ESP_ERROR_CHECK(esp_event_loop_create_default());
+ ESP_ERROR_CHECK(example_connect());
+ #endif
+#else
+ ESP_ERROR_CHECK(nvs_flash_init());
+
+ /* Initialize NVS */
+ ret = nvs_flash_init();
+ if (ret == ESP_ERR_NVS_NO_FREE_PAGES ||
+ ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
+ ESP_ERROR_CHECK(nvs_flash_erase());
+ ret = nvs_flash_init();
+ }
+ ESP_ERROR_CHECK(ret);
+
+ #if defined(CONFIG_IDF_TARGET_ESP32H2)
+ ESP_LOGE(TAG, "There's no WiFi on ESP32-H2. ");
+ #else
+ /* Initialize WiFi */
+ ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
+ ret = wifi_init_sta();
+ while (ret != 0) {
+ ESP_LOGI(TAG, "Waiting...");
+ vTaskDelay(60000 / portTICK_PERIOD_MS);
+ ESP_LOGI(TAG, "Trying WiFi again...");
+ ret = wifi_init_sta();
+ }
+ #endif
+#endif
+
+ /* Once we are connected to the network, start & wait for NTP time */
+ ret = set_time_wait_for_ntp();
+
+ if (ret < -1) {
+ /* a value of -1 means there was no NTP server, so no need to wait */
+ ESP_LOGI(TAG, "Waiting 10 more seconds for NTP to complete." );
+ vTaskDelay(10000 / portTICK_PERIOD_MS); /* brute-force solution */
+ esp_show_current_datetime();
+ }
+
+ /* HWM is maximum amount of stack space that has been unused, in bytes
+ * not words (unlike vanilla freeRTOS). */
+ ESP_LOGI(TAG, "Initial Stack Used (before wolfSSL Server): %d bytes",
+ CONFIG_ESP_MAIN_TASK_STACK_SIZE
+ - (uxTaskGetStackHighWaterMark(NULL))
+ );
+ ESP_LOGI(TAG, "Starting awsiot_main...\n");
+
+ awsiot_main((int)NULL, (char**)NULL);
+ ESP_LOGI(TAG, "\n\nDone!"
+ "If running from idf.py monitor, press twice: Ctrl+]");
+
+ ESP_LOGV(TAG, "\n\nLoop...\n\n");
+ ESP_LOGI(TAG, "Stack used: %d", CONFIG_ESP_MAIN_TASK_STACK_SIZE
+ - uxTaskGetStackHighWaterMark(NULL));
+
+ while (1) {
+#if defined(SINGLE_THREADED)
+ ESP_LOGV(TAG, "\n\nSINGLE_THREADED end loop.\n\n");
+ while (1) {
+ vTaskDelay(1000);
+ }
+#else
+ vTaskDelay(60000);
+#endif
+ }
+}
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/time_helper.c b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/time_helper.c
new file mode 100644
index 000000000..0abf70c5a
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/time_helper.c
@@ -0,0 +1,360 @@
+/* time_helper.c
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+
+/* common Espressif time_helper v5.6.3.002 */
+#include "sdkconfig.h"
+#include "time_helper.h"
+
+#include
+#include
+
+#if defined(ESP_IDF_VERSION_MAJOR) && defined(ESP_IDF_VERSION_MINOR)
+ #if (ESP_IDF_VERSION_MAJOR == 5) && (ESP_IDF_VERSION_MINOR >= 1)
+ #define HAS_ESP_NETIF_SNTP 1
+ #include
+ #include
+ // #include
+ #else
+ #include
+ #include
+ #endif
+#else
+ /* TODO Consider pre IDF v5? */
+#endif
+
+/* ESP-IDF uses a 64-bit signed integer to represent time_t starting from release v5.0
+ * See: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#year-2036-and-2038-overflow-issues
+ */
+const static char* TAG = "time_helper";
+
+/* see https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html */
+#ifndef TIME_ZONE
+/*
+ * PST represents Pacific Standard Time.
+ * +8 specifies the offset from UTC (Coordinated Universal Time), indicating
+ * that Pacific Time is UTC-8 during standard time.
+ * PDT represents Pacific Daylight Time.
+ * M3.2.0 indicates that Daylight Saving Time (DST) starts on the
+ * second (2) Sunday (0) of March (3).
+ * M11.1.0 indicates that DST ends on the first (1) Sunday (0) of November (11)
+ */
+ #define TIME_ZONE "PST+8PDT,M3.2.0,M11.1.0"
+#endif /* not defined: TIME_ZONE, so we are setting our own */
+
+#define NTP_RETRY_COUNT 10
+
+/* NELEMS(x) number of elements
+ * To determine the number of elements in the array, we can divide the total
+ * size of the array by the size of the array element.
+ * See https://stackoverflow.com/questions/37538/how-do-i-determine-the-size-of-my-array-in-c
+ **/
+#define NELEMS(x) ( (int)(sizeof(x) / sizeof((x)[0])) )
+
+/* See also CONFIG_LWIP_SNTP_MAX_SERVERS in sdkconfig */
+#define NTP_SERVER_LIST ( (char*[]) { \
+ "pool.ntp.org", \
+ "time.nist.gov", \
+ "utcnist.colorado.edu" \
+ } \
+ )
+/* #define NTP_SERVER_COUNT using NELEMS:
+ *
+ * (int)(sizeof(NTP_SERVER_LIST) / sizeof(NTP_SERVER_LIST[0]))
+ */
+#define NTP_SERVER_COUNT NELEMS(NTP_SERVER_LIST)
+
+#ifndef CONFIG_LWIP_SNTP_MAX_SERVERS
+ /* We should find max value in sdkconfig, if not set it to our count:*/
+ #define CONFIG_LWIP_SNTP_MAX_SERVERS NTP_SERVER_COUNT
+#endif
+
+char* ntpServerList[NTP_SERVER_COUNT] = NTP_SERVER_LIST;
+
+/* our NTP server list is global info */
+extern char* ntpServerList[NTP_SERVER_COUNT];
+
+/* Show the current date and time */
+int esp_show_current_datetime()
+{
+ time_t now;
+ char strftime_buf[64];
+ struct tm timeinfo;
+
+ time(&now);
+ setenv("TZ", TIME_ZONE, 1);
+ tzset();
+
+ localtime_r(&now, &timeinfo);
+ strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
+ ESP_LOGI(TAG, "The current date/time is: %s", strftime_buf);
+ return 0;
+}
+
+/* the worst-case scenario is a hard-coded date/time */
+int set_fixed_default_time(void)
+{
+ /* ideally, we'd like to set time from network,
+ * but let's set a default time, just in case */
+ struct tm timeinfo = {
+ .tm_year = 2023 - 1900,
+ .tm_mon = 10,
+ .tm_mday = 02,
+ .tm_hour = 13,
+ .tm_min = 01,
+ .tm_sec = 05
+ };
+ struct timeval now;
+ time_t interim_time;
+ int ret = -1;
+
+ /* set interim static time */
+ interim_time = mktime(&timeinfo);
+
+ ESP_LOGI(TAG, "Adjusting time from fixed value");
+ now = (struct timeval){ .tv_sec = interim_time };
+ ret = settimeofday(&now, NULL);
+
+ return ret;
+}
+
+/* set_time_from_string(s)
+ *
+ * returns 0 = success if able to set the time from the provided string
+ * error for any other value, typically -1 */
+int set_time_from_string(char* time_buffer)
+{
+ /* expecting github default formatting: 'Thu Aug 31 12:41:45 2023 -0700' */
+ const char *format = "%3s %3s %d %d:%d:%d %d %s";
+ struct tm this_timeinfo;
+ struct timeval now;
+ time_t interim_time;
+ char offset[10]; /* expecting trailing offset and single quote, not used */
+ char day_str[4];
+ char month_str[4];
+ int day, year, hour, minute, second;
+ int quote_offset = 0;
+ int ret = 0;
+
+ time(&interim_time);
+ /* expecting the string to be encapsulated in single quotes */
+ if (*time_buffer == 0x27) {
+ quote_offset = 1;
+ }
+
+ ret = sscanf(time_buffer + quote_offset,
+ format,
+ day_str, month_str,
+ &day, &hour, &minute, &second, &year,
+ offset);
+
+
+ if (ret == 8) {
+ /* we found a match for all componets */
+
+ const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+
+ /* Ensure day_str and month_str are not too long */
+ ret = ESP_FAIL; /* assume failure until proven otherwise */
+ this_timeinfo.tm_mon = 0;
+ if (strlen(day_str) <= 3 && strlen(month_str) <= 3) {
+ for (int i = 0; i < 12; i++) {
+ if (strcmp(month_str, months[i]) == 0) {
+ this_timeinfo.tm_mon = i;
+ ret = ESP_OK;
+ break;
+ }
+ }
+ if (ret == ESP_OK) {
+ this_timeinfo.tm_mday = day;
+ this_timeinfo.tm_hour = hour;
+ this_timeinfo.tm_min = minute;
+ this_timeinfo.tm_sec = second;
+ this_timeinfo.tm_year = year - 1900; /* years since 1900 */
+
+ interim_time = mktime(&this_timeinfo);
+ now = (struct timeval){ .tv_sec = interim_time };
+ ret = settimeofday(&now, NULL);
+ }
+ else {
+ ESP_LOGE(TAG, "Bad month value: %s", month_str);
+ }
+
+ if (ret == ESP_OK) {
+ ESP_LOGI(TAG, "Time updated to %s", time_buffer);
+ }
+ else {
+ ESP_LOGE(TAG, "Failed to set system time with strig: %s",
+ time_buffer);
+ }
+ }
+ else {
+ ESP_LOGE(TAG, "Invalid day (%s) or month (%s) string length.",
+ day_str, month_str);
+ ret = ESP_FAIL;
+ }
+ }
+ else {
+ ESP_LOGE(TAG, "Failed to convert \"%s\" to a tm date.", time_buffer);
+ ESP_LOGI(TAG, "Trying fixed date that was hard-coded.");
+ set_fixed_default_time();
+ ret = ESP_FAIL;
+ }
+ return ret;
+}
+
+/* set time; returns 0 if succecssfully configured with NTP */
+int set_time(void)
+{
+#ifndef NTP_SERVER_COUNT
+ ESP_LOGW(TAG, "Warning: no sntp server names defined. "
+ "Setting to empty list");
+ #define NTP_SERVER_COUNT 0
+ #warning "NTP not properly configured"
+#endif /* not defined: NTP_SERVER_COUNT */
+
+#ifdef HAS_ESP_NETIF_SNTP
+ #if CONFIG_LWIP_SNTP_MAX_SERVERS > 1
+ esp_sntp_config_t config = ESP_NETIF_SNTP_DEFAULT_CONFIG_MULTIPLE(
+ NTP_SERVER_COUNT,
+ ESP_SNTP_SERVER_LIST(ntpServerList[0])
+ );
+ #else
+ esp_sntp_config_t config = ESP_NETIF_SNTP_DEFAULT_CONFIG(ntpServerList[0]);
+ #endif /* CONFIG_LWIP_SNTP_MAX_SERVERS > 1 */
+#endif /* HAS_ESP_NETIF_SNTP */
+
+ int ret = 0;
+ int i = 0; /* counter for time servers */
+
+ ESP_LOGI(TAG, "Setting the time. Startup time:");
+ esp_show_current_datetime();
+
+#ifdef LIBWOLFSSL_VERSION_GIT_HASH_DATE
+ /* initialy set a default approximate time from recent git commit */
+ ESP_LOGI(TAG, "Found git hash date, attempting to set system date.");
+ set_time_from_string(LIBWOLFSSL_VERSION_GIT_HASH_DATE);
+ esp_show_current_datetime();
+
+ ret = -4;
+#else
+ /* otherwise set a fixed time that was hard coded */
+ set_fixed_default_time();
+ ret = -3;
+#endif
+
+#ifdef CONFIG_SNTP_TIME_SYNC_METHOD_SMOOTH
+ config.smooth_sync = true;
+#endif
+
+ if (NTP_SERVER_COUNT) {
+ /* next, let's setup NTP time servers
+ *
+ * see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#sntp-time-synchronization
+ *
+ * WARNING: do not set operating mode while SNTP client is running!
+ */
+ /* TODO Consider esp_sntp_setoperatingmode(SNTP_OPMODE_POLL); */
+ sntp_setoperatingmode(SNTP_OPMODE_POLL);
+ if (NTP_SERVER_COUNT > CONFIG_LWIP_SNTP_MAX_SERVERS) {
+ ESP_LOGW(TAG, "WARNING: %d NTP Servers defined, but "
+ "CONFIG_LWIP_SNTP_MAX_SERVERS = %d",
+ NTP_SERVER_COUNT,CONFIG_LWIP_SNTP_MAX_SERVERS);
+ }
+ ESP_LOGI(TAG, "sntp_setservername:");
+ for (i = 0; i < CONFIG_LWIP_SNTP_MAX_SERVERS; i++) {
+ const char* thisServer = ntpServerList[i];
+ if (strncmp(thisServer, "\x00", 1) == 0) {
+ /* just in case we run out of NTP servers */
+ break;
+ }
+ ESP_LOGI(TAG, "%s", thisServer);
+ sntp_setservername(i, thisServer);
+ }
+ #ifdef HAS_ESP_NETIF_SNTP
+ ret = esp_netif_sntp_init(&config);
+ #else
+ ESP_LOGW(TAG,"Warning: Consider upgrading ESP-IDF to take advantage "
+ "of updated SNTP libraries");
+ #endif
+ if (ret == ESP_OK) {
+ ESP_LOGV(TAG, "Successfully called esp_netif_sntp_init");
+ }
+ else {
+ ESP_LOGE(TAG, "ERROR: esp_netif_sntp_init return = %d", ret);
+ }
+
+ sntp_init();
+ switch (ret) {
+ case ESP_ERR_INVALID_STATE:
+ break;
+ default:
+ break;
+ }
+ ESP_LOGI(TAG, "sntp_init done.");
+ }
+ else {
+ ESP_LOGW(TAG, "No sntp time servers found.");
+ ret = -1;
+ }
+ return ret;
+}
+
+/* wait for NTP to actually set the time */
+int set_time_wait_for_ntp(void)
+{
+ int ret = 0;
+#ifdef HAS_ESP_NETIF_SNTP
+ int ntp_retry = 0;
+ const int ntp_retry_count = NTP_RETRY_COUNT;
+
+ ret = esp_netif_sntp_start();
+
+ ret = esp_netif_sntp_sync_wait(500 / portTICK_PERIOD_MS);
+#endif /* HAS_ESP_NETIF_SNTP */
+ esp_show_current_datetime();
+
+#ifdef HAS_ESP_NETIF_SNTP
+ while (ret == ESP_ERR_TIMEOUT && (ntp_retry++ < ntp_retry_count)) {
+ ret = esp_netif_sntp_sync_wait(1000 / portTICK_PERIOD_MS);
+ ESP_LOGI(TAG, "Waiting for NTP to sync time... (%d/%d)",
+ ntp_retry,
+ ntp_retry_count);
+ esp_show_current_datetime();
+ }
+#endif /* HAS_ESP_NETIF_SNTP */
+
+#ifdef TIME_ZONE
+ setenv("TZ", TIME_ZONE, 1);
+ tzset();
+#endif
+
+ if (ret == ESP_OK) {
+ ESP_LOGI(TAG, "Successfuly set time via NTP servers.");
+ }
+ else {
+ ESP_LOGW(TAG, "Warning: Failed to set time with NTP: "
+ "result = 0x%0x: %s",
+ ret, esp_err_to_name(ret));
+ }
+ return ret;
+}
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/wifi_connect.c b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/wifi_connect.c
new file mode 100644
index 000000000..384a86274
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/main/wifi_connect.c
@@ -0,0 +1,274 @@
+/* wifi_connect.c
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+ #include "wifi_connect.h"
+
+#include
+#include
+#include
+#include
+#include
+
+/* wolfSSL */
+#include
+#include
+#include
+#ifndef WOLFSSL_ESPIDF
+ #warning "Problem with wolfSSL user_settings."
+ #warning "Check components/wolfssl/include"
+#endif
+
+#if ESP_IDF_VERSION_MAJOR >= 5
+#elif ESP_IDF_VERSION_MAJOR >= 4
+ #include "protocol_examples_common.h"
+#else
+ const static int CONNECTED_BIT = BIT0;
+ static EventGroupHandle_t wifi_event_group;
+#endif
+
+#if defined(ESP_IDF_VERSION_MAJOR) && defined(ESP_IDF_VERSION_MINOR)
+ #if ESP_IDF_VERSION_MAJOR >= 4
+ /* likely using examples, see wifi_connect.h */
+ #else
+ /* TODO - still supporting pre V4 ? */
+ const static int CONNECTED_BIT = BIT0;
+ static EventGroupHandle_t wifi_event_group;
+ #endif
+ #if (ESP_IDF_VERSION_MAJOR == 5)
+ #define HAS_WPA3_FEATURES
+ #else
+ #undef HAS_WPA3_FEATURES
+ #endif
+#else
+ /* TODO Consider pre IDF v5? */
+#endif
+
+/* breadcrumb prefix for logging */
+const static char *TAG = "wifi_connect";
+
+#if ESP_IDF_VERSION_MAJOR < 4
+/* event handler for wifi events */
+static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
+{
+ switch (event->event_id)
+ {
+ case SYSTEM_EVENT_STA_START:
+ esp_wifi_connect();
+ break;
+ case SYSTEM_EVENT_STA_GOT_IP:
+ #if ESP_IDF_VERSION_MAJOR >= 4
+ ESP_LOGI(TAG, "got ip:" IPSTR "\n",
+ IP2STR(&event->event_info.got_ip.ip_info.ip));
+ #else
+ ESP_LOGI(TAG, "got ip:%s",
+ ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip));
+ #endif
+ /* see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos_idf.html */
+ xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
+ break;
+ case SYSTEM_EVENT_STA_DISCONNECTED:
+ esp_wifi_connect();
+ xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
+ break;
+ default:
+ break;
+ }
+ return ESP_OK;
+}
+#else
+
+#ifdef CONFIG_ESP_MAXIMUM_RETRY
+ #define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
+#else
+ #define CONFIG_ESP_MAXIMUM_RETRY 5
+#endif
+
+#if CONFIG_ESP_WIFI_AUTH_OPEN
+#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_OPEN
+#elif CONFIG_ESP_WIFI_AUTH_WEP
+#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WEP
+#elif CONFIG_ESP_WIFI_AUTH_WPA_PSK
+#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA_PSK
+#elif CONFIG_ESP_WIFI_AUTH_WPA2_PSK
+#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA2_PSK
+#elif CONFIG_ESP_WIFI_AUTH_WPA_WPA2_PSK
+#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA_WPA2_PSK
+#elif CONFIG_ESP_WIFI_AUTH_WPA3_PSK
+#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA3_PSK
+#elif CONFIG_ESP_WIFI_AUTH_WPA2_WPA3_PSK
+#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WPA2_WPA3_PSK
+#elif CONFIG_ESP_WIFI_AUTH_WAPI_PSK
+#define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD WIFI_AUTH_WAPI_PSK
+#endif
+
+#ifndef ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD
+ #define CONFIG_ESP_WIFI_AUTH_WPA2_PSK 1
+ #define ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD CONFIG_ESP_WIFI_AUTH_WPA2_PSK
+#endif
+
+/* FreeRTOS event group to signal when we are connected*/
+static EventGroupHandle_t s_wifi_event_group;
+
+/* The event group allows multiple bits for each event, but we only care about two events:
+ * - we are connected to the AP with an IP
+ * - we failed to connect after the maximum amount of retries */
+#define WIFI_CONNECTED_BIT BIT0
+#define WIFI_FAIL_BIT BIT1
+
+
+static int s_retry_num = 0;
+ip_event_got_ip_t* event;
+
+static void event_handler(void* arg,
+ esp_event_base_t event_base,
+ int32_t event_id,
+ void* event_data)
+{
+ if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
+ esp_wifi_connect();
+ }
+ else if (event_base == WIFI_EVENT &&
+ event_id == WIFI_EVENT_STA_DISCONNECTED) {
+ if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY) {
+ esp_wifi_connect();
+ s_retry_num++;
+ ESP_LOGI(TAG, "retry to connect to the AP");
+ }
+ else {
+ xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
+ }
+ ESP_LOGI(TAG, "connect to the AP fail");
+ }
+ else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
+ event = (ip_event_got_ip_t*) event_data;
+ wifi_show_ip();
+ s_retry_num = 0;
+ xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
+ }
+}
+
+int wifi_init_sta(void)
+{
+ int ret = ESP_OK;
+
+ s_wifi_event_group = xEventGroupCreate();
+
+ ESP_ERROR_CHECK(esp_netif_init());
+
+ ESP_ERROR_CHECK(esp_event_loop_create_default());
+ esp_netif_create_default_wifi_sta();
+
+ wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
+ ESP_ERROR_CHECK(esp_wifi_init(&cfg));
+
+ esp_event_handler_instance_t instance_any_id;
+ esp_event_handler_instance_t instance_got_ip;
+ ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
+ ESP_EVENT_ANY_ID,
+ &event_handler,
+ NULL,
+ &instance_any_id));
+ ESP_ERROR_CHECK(esp_event_handler_instance_register(IP_EVENT,
+ IP_EVENT_STA_GOT_IP,
+ &event_handler,
+ NULL,
+ &instance_got_ip));
+
+ wifi_config_t wifi_config = {
+ .sta = {
+ .ssid = EXAMPLE_ESP_WIFI_SSID,
+ .password = EXAMPLE_ESP_WIFI_PASS,
+ /* Authmode threshold resets to WPA2 as default if password matches
+ * WPA2 standards (pasword len => 8). If you want to connect the
+ * device to deprecated WEP/WPA networks, Please set the threshold
+ * value WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK and set the password with
+ * length and format matching to WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK
+ * standards. */
+ .threshold.authmode = ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD,
+ #ifdef HAS_WPA3_FEATURES
+ .sae_pwe_h2e = WPA3_SAE_PWE_BOTH,
+ #endif
+ },
+ };
+ ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
+ ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
+
+#ifdef CONFIG_EXAMPLE_WIFI_SSID
+ if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
+ ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is \"myssid\".");
+ ESP_LOGW(TAG, " Do you have a WiFi AP called \"myssid\", ");
+ ESP_LOGW(TAG, " or did you forget the ESP-IDF configuration?");
+ }
+#else
+ ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
+#endif
+
+ ESP_ERROR_CHECK(esp_wifi_start() );
+
+ ESP_LOGI(TAG, "wifi_init_sta finished.");
+
+ /* Waiting until either the connection is established (WIFI_CONNECTED_BIT)
+ * or connection failed for the maximum number of re-tries (WIFI_FAIL_BIT).
+ * The bits are set by event_handler() (see above) */
+ EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
+ WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
+ pdFALSE,
+ pdFALSE,
+ portMAX_DELAY);
+
+ /* xEventGroupWaitBits() returns the bits before the call returned,
+ * hence we can test which event actually happened. */
+#if defined(SHOW_SSID_AND_PASSWORD)
+ ESP_LOGW(TAG, "Undefine SHOW_SSID_AND_PASSWORD to not show SSID/password");
+ if (bits & WIFI_CONNECTED_BIT) {
+ ESP_LOGI(TAG, "connected to ap SSID:%s password:%s",
+ EXAMPLE_ESP_WIFI_SSID,
+ EXAMPLE_ESP_WIFI_PASS);
+ }
+ else if (bits & WIFI_FAIL_BIT) {
+ ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s",
+ EXAMPLE_ESP_WIFI_SSID,
+ EXAMPLE_ESP_WIFI_PASS);
+ }
+ else {
+ ESP_LOGE(TAG, "UNEXPECTED EVENT");
+ }
+#else
+ if (bits & WIFI_CONNECTED_BIT) {
+ ESP_LOGI(TAG, "Connected to AP");
+ }
+ else if (bits & WIFI_FAIL_BIT) {
+ ESP_LOGI(TAG, "Failed to connect to AP");
+ ret = -1;
+ }
+ else {
+ ESP_LOGE(TAG, "AP UNEXPECTED EVENT");
+ ret = -2;
+ }
+#endif
+ return ret;
+}
+
+int wifi_show_ip(void)
+{
+ // TODO Causes panic: ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
+ return ESP_OK;
+}
+#endif
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/partitions_singleapp_large.csv b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/partitions_singleapp_large.csv
new file mode 100644
index 000000000..a9c373bec
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/partitions_singleapp_large.csv
@@ -0,0 +1,31 @@
+# to view: idf.py partition-table
+#
+# ESP-IDF Partition Table
+# Name, Type, SubType, Offset, Size, Flags
+nvs, data, nvs, 0x9000, 24K,
+phy_init,data, phy, 0xf000, 4K,
+factory, app, factory, 0x10000, 1500K,
+
+
+# For other settings, see:
+# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#creating-custom-tables
+#
+# Here is the summary printed for the "Single factory app, no OTA" configuration:
+#
+# # ESP-IDF Partition Table
+# # Name, Type, SubType, Offset, Size, Flags
+# nvs, data, nvs, 0x9000, 0x6000,
+# phy_init, data, phy, 0xf000, 0x1000,
+# factory, app, factory, 0x10000, 1M,
+#
+#
+# Here is the summary printed for the "Factory app, two OTA definitions" configuration:
+#
+# # ESP-IDF Partition Table
+# # Name, Type, SubType, Offset, Size, Flags
+# nvs, data, nvs, 0x9000, 0x4000,
+# otadata, data, ota, 0xd000, 0x2000,
+# phy_init, data, phy, 0xf000, 0x1000,
+# factory, app, factory, 0x10000, 1M,
+# ota_0, app, ota_0, 0x110000, 1M,
+# ota_1, app, ota_1, 0x210000, 1M,
diff --git a/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/sdkconfig.defaults
new file mode 100644
index 000000000..5cda514a9
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/AWS_IoT_MQTT/sdkconfig.defaults
@@ -0,0 +1,38 @@
+# This file was generated using idf.py save-defconfig. It can be edited manually.
+# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
+
+CONFIG_FREERTOS_HZ=1000
+CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
+
+#
+# Default main stack size
+#
+# This is typically way bigger than needed for stack size. See user_settings.h
+#
+CONFIG_ESP_MAIN_TASK_STACK_SIZE=55500
+
+# Legacy stack size for older ESP-IDF versions
+CONFIG_MAIN_TASK_STACK_SIZE=55500
+
+#
+# Compiler options
+#
+CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
+CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
+CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
+CONFIG_COMPILER_HIDE_PATHS_MACROS=y
+CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y
+CONFIG_COMPILER_STACK_CHECK=y
+
+#
+# Partition Table
+#
+# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
+CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
+# CONFIG_PARTITION_TABLE_TWO_OTA is not set
+# CONFIG_PARTITION_TABLE_CUSTOM is not set
+CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
+CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv"
+CONFIG_PARTITION_TABLE_OFFSET=0x8000
+CONFIG_PARTITION_TABLE_MD5=y
+# end of Partition Table
diff --git a/IDE/Espressif/ESP-IDF/examples/README.md b/IDE/Espressif/ESP-IDF/examples/README.md
new file mode 100644
index 000000000..465a7ae68
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/README.md
@@ -0,0 +1,9 @@
+# IDE: Espressif ESP-IDF Examples
+
+These are the core [examples](./README.md) for wolMQTT:
+
+- [template](./wolfmqtt_template/README.md)
+
+- [AWS IoT MQTT](./AWS_IoT_MQTT/README.md)
+
+For details on wolfMQTT [see the wolfMQTT Manual](https://www.wolfssl.com/documentation/manuals/wolfmqtt/wolfMQTT-Manual.pdf).
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/CMakeLists.txt
new file mode 100644
index 000000000..e35e82e10
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/CMakeLists.txt
@@ -0,0 +1,117 @@
+# wolfSSL Espressif Example Project CMakeLists.txt
+# v1.0
+#
+# The following lines of boilerplate have to be in your project's
+# CMakeLists in this exact order for cmake to work correctly
+cmake_minimum_required(VERSION 3.16)
+
+# enable wolfssl user_settings.h project-wide
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
+set(WOLFSSL_USER_SETTINGS ON)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFMQTT_USER_SETTINGS")
+set(WOLFMQTT_USER_SETTINGS ON)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_AWSIOT_EXAMPLE")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_MQTT_TLS")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFMQTT_EXTERN_CERT")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_MAIN_DRIVER")
+
+
+
+# The wolfSSL CMake file should be able to find the source code.
+# Otherwise, assign an environment variable or set it here:
+#
+# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
+# set(WOLFMQTT_ROOT "~/workspace/wolfmqtt-other-source")
+
+# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find
+# USE_MY_PRIVATE_CONFIG path for my_private_config.h
+#
+# Expected path varies:
+#
+# WSL: /mnt/c/workspace
+# Linux: ~/workspace
+# Windows: C:\workspace
+#
+if(WIN32)
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
+ message("Detected Windows")
+endif()
+if(CMAKE_HOST_UNIX)
+ message("Detected UNIX")
+endif()
+if(APPLE)
+ message("Detected APPLE")
+endif()
+if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
+ message("Detected WSL")
+endif()
+if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
+ message("Detected Linux")
+endif()
+if(APPLE)
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
+ message("Detected Apple")
+endif()
+# End optional WOLFSSL_CMAKE_SYSTEM_NAME
+
+# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
+set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+
+if (EXISTS "${PROTOCOL_EXAMPLES_DIR}")
+ message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
+ set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR")
+else()
+ message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
+endif()
+
+# Check that there are not conflicting wolfSSL components
+# The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl
+# The local component wolfSSL directory will be in ./components/wolfssl
+if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" )
+ # These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake'
+ # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL)
+ # add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL)
+ # So we'll error out and let the user decide how to proceed:
+ message(WARNING "\nFound wolfSSL components in\n"
+ "./managed_components/wolfssl__wolfssl\n"
+ "and\n"
+ "./components/wolfssl\n"
+ "in project directory: \n"
+ "${CMAKE_HOME_DIRECTORY}")
+ message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n"
+ "If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove "
+ "or rename the idf_component.yml file typically found in ./main/")
+else()
+ message(STATUS "No conflicting wolfSSL components found.")
+endif()
+
+
+# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
+set (PROTOCOL_EXAMPLES_DIR $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+
+if (EXISTS "${PROTOCOL_EXAMPLES_DIR}")
+ message("Found PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
+ set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFOUND_PROTOCOL_EXAMPLES_DIR")
+else()
+ message("NOT FOUND: PROTOCOL_EXAMPLES_DIR=${PROTOCOL_EXAMPLES_DIR}")
+endif()
+
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+
+#set(COMPONENTS
+ #main
+ #wolfssl
+ #wolfmqtt
+#) # set components
+
+project(wolfmqtt_template)
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/README.md b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/README.md
new file mode 100644
index 000000000..c9ae92340
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/README.md
@@ -0,0 +1,70 @@
+# wolfSSL Template Project
+
+This is an example minimally viable wolfSSL + wolfMQTT template to get started with your own project.
+
+For details on wolfMQTT [see the wolfMQTT Manual](https://www.wolfssl.com/documentation/manuals/wolfmqtt/wolfMQTT-Manual.pdf).
+
+### Prerequisites
+
+It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) has been installed.
+
+### Files Included
+
+- [main.c](./main/main.c) with a simple call to an Espressif library (`ESP_LOGI`) and a call to a wolfSSL library (`esp_ShowExtendedSystemInfo`) .
+
+- See [components/wolfssl/include](./components/wolfssl/include/user_settings.h) directory to edit the wolfSSL `user_settings.h`.
+
+- Edit [main/CMakeLists.txt](./main/CMakeLists.txt) to add/remove source files.
+
+- The [components/wolfssl/CMakeLists.txt](./components/wolfssl/CMakeLists.txt) typically does not need to be changed.
+
+- Optional [VisualGDB Project](./VisualGDB/wolfssl_template_IDF_v5.1_ESP32.vgdbproj) for Visual Studio using ESP32 and ESP-IDF v5.1.
+
+- Edit the project [CMakeLists.txt](./CMakeLists.txt) to optionally point this project's wolfSSL component source code at a different directory:
+
+```
+set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
+```
+
+
+## Getting Started with ESP Registry Managed Components:
+
+The quickest way to get started is with wolfMQTT Managed Components.
+
+Coming soon. See [Staging Site](https://components-staging.espressif.com/components/gojimmypi/mywolfmqtt).
+
+## Getting Started with ESP-IDF local examples:
+
+Here's an example using the command-line [idf.py](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-py.html):
+
+Edit your `WRK_IDF_PATH`to point to your ESP-IDF install directory.
+
+```
+WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.1
+
+echo "Run export.sh from ${WRK_IDF_PATH}"
+. ${WRK_IDF_PATH}/export.sh
+
+# build the example:
+idf.py build
+
+# flash the code onto the serial device at /dev/ttyS19
+idf.py flash -p /dev/ttyS19 -b 115200
+
+# build, flash, and view UART output with one command:
+idf.py flash -p /dev/ttyS19 -b 115200 monitor
+```
+
+Press `Ctrl+]` to exit `idf.py monitor`. See [additional monitor keyboard commands](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html).
+
+## Other Examples:
+
+For examples, see:
+
+- [wolfSSL template](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/template/README.md)
+- [Benchmark](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md)
+- [TLS Client](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md)
+- [TLS Server](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md)
+- [Test](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples/wolfssl_test)
+- [wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32)
+- [wolfssh-examples](https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif)
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/VisualGDB/wolfmqtt_template_IDF_v5.1_ESP32.sln b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/VisualGDB/wolfmqtt_template_IDF_v5.1_ESP32.sln
new file mode 100644
index 000000000..d13d984fd
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/VisualGDB/wolfmqtt_template_IDF_v5.1_ESP32.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.8.34330.188
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "wolfmqtt_template_IDF_v5.1_ESP32", "wolfmqtt_template_IDF_v5.1_ESP32.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|VisualGDB = Debug|VisualGDB
+ Release|VisualGDB = Release|VisualGDB
+ Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
+ Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
+ {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1B6430EF-5A8B-471A-9AD4-3C37EFA3F3A6}
+ EndGlobalSection
+EndGlobal
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/VisualGDB/wolfmqtt_template_IDF_v5.1_ESP32.vgdbproj b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/VisualGDB/wolfmqtt_template_IDF_v5.1_ESP32.vgdbproj
new file mode 100644
index 000000000..9edbb41e2
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/VisualGDB/wolfmqtt_template_IDF_v5.1_ESP32.vgdbproj
@@ -0,0 +1,269 @@
+
+
+
+
+
+ Unknown
+
+ true
+
+ 7bbd1486-d457-4e49-92ba-0cfc9d80849e
+ true
+ true
+ SourceDirs
+
+
+
+
+
+ com.visualgdb.xtensa-esp32-elf
+
+ 12.2.0
+ 12.1
+ 1
+
+
+ ..
+ DEBUG
+ build/$(PlatformName)/$(ConfigurationName)
+
+ false
+ $(ToolchainNinja)
+ $(BuildDir)
+
+
+
+ false
+ $(SYSPROGS_CMAKE_PATH)
+
+
+ true
+ false
+ false
+ Ninja
+ false
+ RemoveBuildDirectory
+ false
+
+
+ true
+ true
+ true
+ false
+ true
+ false
+ true
+ HideOuterProjectTargets
+ true
+ false
+ true
+
+
+ true
+ eadcc9ab-72b3-4b51-a838-593e5d80ddf7
+
+ Upper
+ HeaderDirectoryAndSubdirectories
+ true
+
+
+ release/v5.1
+ esp-idf/v5.1
+ ESPIDF
+
+ COM9
+ false
+ false
+ ESP32
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default
+
+
+
+ COM9
+
+ 115200
+ 8
+ None
+ One
+ None
+
+
+ 0
+ false
+ false
+ false
+ ASCII
+
+
+ 255
+ 0
+ 0
+ 0
+
+
+ 255
+ 169
+ 169
+ 169
+
+
+ 255
+ 211
+ 211
+ 211
+
+
+ 255
+ 144
+ 238
+ 144
+
+
+ 255
+ 169
+ 169
+ 169
+
+
+
+ 16
+ true
+ true
+ true
+ true
+ 0
+
+ LF
+ false
+ false
+ false
+
+
+
+ true
+
+
+
+
+ Unknown
+
+ true
+ true
+ true
+
+
+
+ false
+
+
+
+
+ Debug
+
+
+
+ Release
+
+
+
+
+
+
+
+
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+ false
+
+ false
+ false
+ false
+ false
+ false
+ false
+ true
+ false
+ None
+ false
+ false
+ app_main
+ true
+ false
+ false
+ true
+ 0
+ false
+ 0
+ true
+ false
+
+
+ openocd
+
+ -f interface/ftdi/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg
+
+
+
+ false
+
+ 131072
+ Enabled
+
+ set remotetimeout 60
+ target remote :$$SYS:GDB_PORT$$
+ mon gdb_breakpoint_override hard
+ mon reset halt
+ load
+
+ false
+ 0
+ 0
+ false
+
+ 5000
+ 1
+ true
+
+ size2MB
+ freq40M
+ DIO
+
+ true
+
+
+ true
+ Disabled
+ 0
+ false
+ false
+ true
+ false
+ false
+
+ _estack
+ 0
+ false
+
+ true
+
+
\ No newline at end of file
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/CMakeLists.txt
new file mode 100644
index 000000000..81fed19e8
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/CMakeLists.txt
@@ -0,0 +1,308 @@
+#
+# Copyright (C) 2006-2023 wolfSSL Inc. All rights reserved.
+#
+# This file is part of wolfMQTT.
+#
+# Contact licensing@wolfssl.com with any questions or comments.
+#
+# https://www.wolfssl.com
+#/
+
+#
+# This is the CMakeLists.txt for the Espressif ESP-IDF wolfMQTT component
+#
+cmake_minimum_required(VERSION 3.5)
+
+# Attention!
+#
+# When editing component CMake files, consider the following :
+#
+# NO Managed Components: Normal stand-alone app, "as cloned" from github.
+# There's no notion of staging names (e.g. mywolfmqtt) regardless of environment settings.
+# All of the component source is local. See settings such s WOLFSSL_ROOT=[your path]
+#
+# Partially Managed Components. This one is tricky. When publishing a component with examples,
+# those examples will have a chicken-and-egg problem: the required component is not yet published.
+# Adding to the complexity is the notion of staging components, that are purposely prefixed with
+# "my" (e.g. mywolfmqtt) to distinguish from production, live components (e.g. wolfmqtt)
+#
+# Partially Managed Component Examples are typically only encountered by the component publisher
+# and only at publish time, such as when performing the pre-publish build check.
+#
+# A partially managed component may also be manually created, when adding a managed component to
+# and existing project. For example:
+#
+# idf.py add-dependency "wolfssl/wolfssh^1.4.15-stable"
+#
+# Fully Managed Components. This is the typical example as created from the Component Registry:
+# For example:
+#
+# idf.py create-project-from-example "wolfssl/wolfssh^1.4.15-stable:wolfssh_server"
+#
+# In all cases, keep in mind that components other than wolfssl will depend on the wolfssl component.
+#
+
+# Component naming is only adjusted when using Managed Components, and only when using staging site.
+if( "$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com" )
+ # TODO: Is checking these two variables really the best way to detect an active Component Manager?
+ message(STATUS "component_manager_interface_version = ${component_manager_interface_version}")
+ message(STATUS "managed_components = ${managed_components}")
+ if( ("${managed_components}" STREQUAL "") AND ("${component_manager_interface_version}" STREQUAL "") )
+ # We've found a staging component, but did not detect the component manager
+ set(WOLFSSL_COMPONENT_NAME "wolfssl")
+ else()
+ set(WOLFSSL_COMPONENT_NAME "mywolfssl")
+ endif()
+else()
+ set(WOLFSSL_COMPONENT_NAME "wolfssl")
+endif()
+
+# COMPONENT_NAME = wolfmqtt
+# The component name is the directory name. "No feature to change this".
+# See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685
+
+# set the root of wolfMQTT in top-level project CMakelists.txt:
+# set(WOLFMQTT_ROOT "C:/some path/with/spaces")
+# set(WOLFMQTT_ROOT "c:/workspace/wolfmqtt-[username]")
+# set(WOLFMQTT_ROOT "/mnt/c/some path/with/spaces")
+# or use this logic to assign value from Environment Variable WOLFMQTT_ROOT,
+# or assume this is an example 7 subdirectories below:
+
+# We are typically in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
+# The root of wolfSSL is 7 directories up from here:
+
+# function: IS_WOLFMQTT_SOURCE
+# parameter: DIRECTORY_PARAMETER - the directory to test
+# output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfmqtt directory, otherwise blank.
+function(IS_WOLFMQTT_SOURCE DIRECTORY_PARAMETER RESULT)
+ if (EXISTS "${DIRECTORY_PARAMETER}/wolfmqtt/mqtt_client.h")
+ if (EXISTS "${DIRECTORY_PARAMETER}/wolfmqtt")
+ message(STATUS "1")
+ endif()
+ if (EXISTS "${DIRECTORY_PARAMETER}")
+ message(STATUS "2")
+ endif()
+ if (EXISTS "${DIRECTORY_PARAMETER}/src")
+ message(STATUS "3")
+ endif()
+ set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE)
+ else()
+ set(${RESULT} "" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# function: FIND_WOLFMQTT_DIRECTORY
+# parameter: OUTPUT_FOUND_WOLFMQTT_DIRECTORY contains root of source code, otherwise blank
+#
+function(FIND_WOLFMQTT_DIRECTORY OUTPUT_FOUND_WOLFMQTT_DIRECTORY)
+ message(STATUS "Starting FIND_WOLFMQTT_DIRECTORY")
+ set(CURRENT_SEARCH_DIR "$ENV{WOLFMQTT_ROOT}")
+ if( "${CURRENT_SEARCH_DIR}" STREQUAL "" )
+ message(STATUS "The WOLFMQTT_ROOT environment variable is not set. Searching...")
+ else()
+ get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFMQTT_ROOT}" ABSOLUTE)
+ IS_WOLFMQTT_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFMQTT)
+ if("${FOUND_WOLFMQTT}")
+ message(STATUS "Found WOLFMQTT_ROOT via Environment Variable:")
+ else()
+ message(FATAL_ERROR "WOLFMQTT_ROOT Environment Variable defined, but path not found:")
+ message(STATUS "$ENV{WOLFMQTT_ROOT}")
+ endif()
+ endif()
+
+ # we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfmqtt
+ message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
+ get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
+ message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
+
+ # loop through all the parents, looking for wolfmqtt
+ while(NOT CURRENT_SEARCH_DIR STREQUAL "/" AND NOT CURRENT_SEARCH_DIR STREQUAL "" )
+ string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
+ # wolfmqtt may simply be in a parent directory, such as for local examples in wolfmqtt repo
+ IS_WOLFMQTT_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFMQTT)
+ if( FOUND_WOLFMQTT )
+ message(STATUS "Found wolfmqtt in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ set(${OUTPUT_FOUND_WOLFMQTT_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
+ return()
+ endif()
+
+ if( THIS_USER )
+ # Check for "wolfmqtt-[username]" subdirectory as we recurse up the directory tree
+ set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfmqtt-${THIS_USER})
+ message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
+
+ #if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
+ IS_WOLFMQTT_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFMQTT )
+ if ( FOUND_WOLFMQTT )
+ message(STATUS "Found wolfmqtt in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
+ set(${OUTPUT_FOUND_WOLFMQTT_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
+ return()
+ endif()
+ endif()
+
+ # Next check for no user suffix "wolfmqtt" subdirectory as we recurse up the directory tree
+ set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfmqtt)
+ # if(EXISTS ${CURRENT_SEARCH_DIR} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR} AND EXISTS "${CURRENT_SEARCH_DIR}/wolfcrypt/src")
+ IS_WOLFMQTT_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFMQTT )
+ if ( FOUND_WOLFMQTT )
+ message(STATUS "Found wolfmqtt in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ set(${OUTPUT_FOUND_WOLFMQTT_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
+ return()
+ endif()
+
+ # Move up one directory level
+ set(PRIOR_SEARCH_DIR "${CURRENT_SEARCH_DIR}")
+ get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
+ message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
+ # when the search directory is empty, we'll give up
+ set(CURRENT_SEARCH_DIR "")
+ endif()
+ endwhile()
+
+ # If not found, set the output variable to empty before exiting
+ set(${OUTPUT_FOUND_WOLFMQTT_DIRECTORY} "" PARENT_SCOPE)
+endfunction()
+
+# These flags apply only to compiling this component independently.
+# be sure to include this like in the root CMakeFiles.txt
+# for proper application-wide use of WOLFSSL_USER_SETTINGS:
+#
+# add_compile_definitions("WOLFSSL_USER_SETTINGS")
+# add_compile_definitions("WOLFMQTT_USER_SETTINGS")
+#
+# if using ESP-IDF prior to 4.4, see:
+# https://github.com/wolfSSL/wolfssl/issues/5727
+if (CONFIG_DEBUG_WOLFMQTT)
+ message(STATUS "Config DEBUG_WOLFMQTT is enabled for components/wolfmqtt")
+endif()
+
+if (WOLFSSL_USER_SETTINGS)
+ message(STATUS "Component wolfmqtt: Found predefined WOLFSSL_USER_SETTINGS")
+else()
+ # wolfSSL settings should have occurred in project makefiles
+ #message(WARNING "Component wolfmqtt: Setting WOLFSSL_USER_SETTINGS \
+ #(should have been a project-wide setting)")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWOLFSSL_USER_SETTINGS")
+endif()
+
+if (WOLFMQTT_USER_SETTINGS)
+ message(STATUS "Component wolfmqtt: Found predefined WOLFMQTT_USER_SETTINGS")
+else()
+ # wolfSSL settings should have occurred in project makefiles. See
+ message(WARNING "Component wolfmqtt: Setting WOLFMQTT_USER_SETTINGS
+ (should have been a project-wide setting)")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFMQTT_USER_SETTINGS")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWOLFMQTT_USER_SETTINGS")
+endif()
+
+# Pick up the KConfig value and assign to cmake variable as appropriate
+if(CONFIG_USE_WOLFMQTT_TLS)
+ if (CONFIG_DEBUG_WOLFMQTT)
+ message(STATUS "Config USE_WOLFMQTT_TLS is enabled for components/wolfmqtt")
+ endif()
+ set(MQTT_TLS_DEFINE "ENABLE_MQTT_TLS")
+ add_compile_definitions("${MQTT_TLS_DEFINE}")
+else()
+ if (CONFIG_DEBUG_WOLFMQTT)
+ message(STATUS "Config USE_WOLFMQTT_TLS is NOT enabled for components/wolfmqtt")
+ endif()
+ set(MQTT_TLS_DEFINE "")
+endif()
+
+message(STATUS "wolfmqtt CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
+
+set(CMAKE_CURRENT_SOURCE_DIR ".")
+set(WOLFMQTT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
+set(INCLUDE_PATH ${WOLFMQTT_ROOT})
+
+
+
+set(COMPONENT_REQUIRES lwip ${WOLFSSL_COMPONENT_NAME})
+
+
+# list(REMOVE_ITEM ASM_FILES ".*\\.(asm|S)")
+
+message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
+message(STATUS "WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+message(STATUS "ASM_FILES = ${ASM_FILES}")
+
+
+if(CMAKE_BUILD_EARLY_EXPANSION)
+ message(STATUS "wolfmqtt component CMAKE_BUILD_EARLY_EXPANSION:")
+ idf_component_register(
+ REQUIRES "wolfssl" # "${COMPONENT_REQUIRES}"
+ )
+else()
+ FIND_WOLFMQTT_DIRECTORY(WOLFMQTT_ROOT)
+
+ set(WOLFMQTT_ROOT "${WOLFMQTT_ROOT}" CACHE STRING "WOLFMQTT_ROOT")
+ if(WOLFMQTT_ROOT)
+ message(STATUS "Found wolfmqtt directory at: ${WOLFMQTT_ROOT}")
+ else()
+ message(STATUS "wolfmqtt directory not found.")
+ # Abort. We need wolfmqtt _somewhere_.
+ message(FATAL_ERROR "Could not find wolfmqtt in ${WOLFMQTT_ROOT}.\n"
+ "Try setting WOLFMQTT_ROOT environment variable or git clone.")
+ endif()
+
+ # Do not include example directories here.
+ # CMake will otherwise not see the example code at all, or see it as a duplicate.
+ set(COMPONENT_SRCDIRS "${WOLFMQTT_ROOT}/src"
+ # "${WOLFMQTT_ROOT}/examples"
+ # "${WOLFMQTT_ROOT}/examples/aws"
+ )
+
+
+ if(EXISTS "${WOLFMQTT_ROOT}")
+ message(STATUS "Confirmed exists: WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+ else()
+ message(STATUS "ERROR: Result WOLFMQTT_ROOT does not exist: ${WOLFMQTT_ROOT}")
+ endif()
+
+ if(EXISTS "${WOLFMQTT_ROOT}/src")
+ message(STATUS "Confirmed exists: WOLFMQTT_ROOT/src = ${WOLFMQTT_ROOT}/src")
+ else()
+ message(STATUS "ERROR: Result WOLFMQTT_ROOT does not exist: ${WOLFMQTT_ROOT}/src")
+ endif()
+
+ if(EXISTS "${COMPONENT_SRCDIRS}")
+ message(STATUS "Confirmed exists: COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
+ else()
+ message(STATUS "ERROR: Result COMPONENT_SRCDIRS does not exist: ${COMPONENT_SRCDIRS}")
+ endif()
+
+ message(STATUS "WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+ set(COMPONENT_ADD_INCLUDEDIRS
+ "."
+ "./include"
+ "${WOLFMQTT_ROOT}"
+ "${WOLFMQTT_ROOT}/examples"
+ "${WOLFMQTT_ROOT}/wolfmqtt"
+ "${WOLFMQTT_ROOT}/examples/aws"
+ )
+ # list(REMOVE_ITEM ASM_FILES ".*\\.(asm|S)")
+
+ message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}")
+ message(STATUS "ASM_FILES = ${ASM_FILES}")
+ set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}")
+ set(COMPONENT_REQUIRES lwip ${WOLFSSL_COMPONENT_NAME})
+ idf_component_register(
+ SRC_DIRS "${COMPONENT_SRCDIRS}"
+ INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}"
+ REQUIRES "${COMPONENT_REQUIRES}"
+ EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
+ PRIV_REQUIRES "${WOLFSSL_COMPONENT_NAME}" # this will typically only be needed for wolfSSL benchmark
+ )
+endif()
+
+# check to see if there's both a local copy and EDP-IDF copy of the wolfmqtt components
+if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfmqtt/" AND EXISTS "$ENV{IDF_PATH}/components/wolfmqtt/" )
+ message(STATUS "")
+ message(WARNING "WARNING: Found components/wolfmqtt in both local project and IDF_PATH")
+ message(STATUS "")
+endif()
+# end multiple component check
+
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/Kconfig b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/Kconfig
new file mode 100644
index 000000000..3e642e36c
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/Kconfig
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2006-2022 wolfSSL Inc. All rights reserved.
+#
+# This file is part of wolfSSL.
+#
+# Contact licensing@wolfssl.com with any questions or comments.
+#
+# https://www.wolfssl.com
+#/
+#
+# Kconfig for wolfssl
+#
+#
+# see project CMakeLists.txt file to enable wolfMQTT with USE_MQTT_LIBRARY
+
+menu "wolfMQTT"
+
+ config USE_WOLFMQTT
+ bool "Use wolfMQTT (requires wolfSSL)"
+ default y
+
+ config USE_WOLFMQTT_TLS
+ bool "Use TLS for wolfMQTT (requires wolfSSL)"
+ default y
+
+ config DEBUG_WOLFMQTT
+ bool "Enable debug messages for wolfMQTT"
+ default y
+
+ config VERBOSE_WOLFMQTT_CMAKE
+ bool "Enable verbose messages for wolfMQTT in CMake"
+ default y
+
+endmenu # wolfMQTT
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/README.md b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/README.md
new file mode 100644
index 000000000..934ecff4e
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/README.md
@@ -0,0 +1,62 @@
+# wolfMQTT for Espressif ESP-IDF
+
+[wolfMQTT](https://www.wolfMQTT.com) provides commercial-grade, world-class encryption libraries to secure connections
+from tiny embedded devices to the largest cloud and super computing platforms.
+
+Makers and students can use these libraries free of charge, as long as they abide by abide by the terms of GPLV2 licensing.
+
+Commercial customers are invited to contact wolfSSL for licensing options.
+Visit [wolfSSL.com/Espressif/](https://www.wolfSSL.com/Espressif/) to learn
+more about Espressif-specific development efforts for wolfSSL, wolfMQTT, wolfSSH, and more.
+
+## Getting Started
+
+The easiest way to get started is by using the Espressif Managed Component Registry
+at
+
+The latest experimental development version can be found at the staging site:
+[gojimmypi/mywolfmqtt](https://components-staging.espressif.com/components/gojimmypi/mywolfmqtt/versions/1.0.14-test?language=en).
+
+```
+#!/bin/bash
+
+. ~/esp/esp-idf/export.sh
+
+# Needed for Staging site:
+export IDF_COMPONENT_REGISTRY_URL=https://components-staging.espressif.com
+
+idf.py create-project-from-example "gojimmypi/mywolfmqtt^1.0.14-test:AWS_IoT_MQTT"
+
+cd AWS_IoT_MQTT
+
+idf.py -p /dev/ttyS9 -b 921600 flash monitor -b 115200
+
+```
+
+## Copy Installation Option
+
+If you wish to _copy_ all the files to the local project component directory,
+run `install_wolfMQTT.cmd` from this directory in Windows, Mac or Linux:
+
+
+
+#### Linux
+```
+./install_wolfMQTT.cmd
+```
+
+#### Mac
+```
+./install_wolfMQTT.cmd
+```
+
+#### Windows
+```
+.\install_wolfMQTT.cmd
+```
+
+#### WSL
+```
+./install_wolfMQTT.cmd
+```
+
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/component.mk
new file mode 100644
index 000000000..fdfa650d8
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/component.mk
@@ -0,0 +1,41 @@
+# component.mk
+#
+# Copyright (C) 2006-2022 wolfSSL Inc.
+#
+# This file is part of wolfMQTT.
+#
+# wolfMQTT is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# wolfMQTT is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+#
+#
+# This file is for legacy build systems only
+
+CFLAGS += -DWOLFSSL_USER_SETTINGS
+CFLAGS += -DWOLFMQTT_USER_SETTINGS
+
+COMPONENT_ADD_INCLUDEDIRS := . ./include
+
+COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/freertos/include/freertos"
+# COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/soc/esp32s3/include/soc"
+
+COMPONENT_SRCDIRS := src ../wolfssl/wolfcrypt/src
+COMPONENT_SRCDIRS += ../wolfssl/wolfcrypt/src/port/Espressif
+COMPONENT_SRCDIRS += ../wolfssl/wolfcrypt/src/port/atmel
+
+CFLAGS +=-DWOLFSSL_USER_SETTINGS
+
+COMPONENT_OBJEXCLUDE := ../wolfssl/wolfcrypt/src/aes_asm.o
+COMPONENT_OBJEXCLUDE += ../wolfssl/wolfcrypt/src/evp.o
+COMPONENT_OBJEXCLUDE += ../wolfssl/wolfcrypt/src/misc.o
+COMPONENT_OBJEXCLUDE += src/bio.o
\ No newline at end of file
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/include/README.md b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/include/README.md
new file mode 100644
index 000000000..7834a91ed
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfmqtt/include/README.md
@@ -0,0 +1,7 @@
+# wolfMQTT README
+
+This directory exists to appease the ESP-IDF component manager.
+
+The wolfSSL `user_settings.h` does NOT belong in this directory.
+
+For details on wolfMQTT [see the wolfMQTT Manual](https://www.wolfssl.com/documentation/manuals/wolfmqtt/wolfMQTT-Manual.pdf).
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/CMakeLists.txt
new file mode 100644
index 000000000..5e230091c
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/CMakeLists.txt
@@ -0,0 +1,544 @@
+#
+# Copyright (C) 2006-2023 wolfSSL Inc.
+#
+# This file is part of wolfSSL.
+#
+# wolfSSL is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# wolfSSL is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+#
+# cmake for wolfssl Espressif projects
+#
+# Version 5.6.0.011 for detect test/benchmark
+#
+# See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html
+#
+
+cmake_minimum_required(VERSION 3.16)
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
+set(CMAKE_CURRENT_SOURCE_DIR ".")
+set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
+set(WOLFSSL_ROOT "$ENV{WOLFSSL_ROOT}" )
+
+# find the user name to search for possible "wolfssl-username"
+message(STATUS "USERNAME = $ENV{USERNAME}")
+if( "$ENV{USER}" STREQUAL "" ) # the bash user
+ if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user
+ message(STATUS "could not find USER or USERNAME")
+ else()
+ # the bash user is not blank, so we'll use it.
+ set(THIS_USER "$ENV{USERNAME}")
+ endif()
+else()
+ # the bash user is not blank, so we'll use it.
+ set(THIS_USER "$ENV{USER}")
+endif()
+message(STATUS "THIS_USER = ${THIS_USER}")
+
+
+# COMPONENT_NAME = wolfssl
+# The component name is the directory name. "No feature to change this".
+# See https://github.com/espressif/esp-idf/issues/8978#issuecomment-1129892685
+
+# set the root of wolfSSL in top-level project CMakelists.txt:
+# set(WOLFSSL_ROOT "C:/some path/with/spaces")
+# set(WOLFSSL_ROOT "c:/workspace/wolfssl-[username]")
+# set(WOLFSSL_ROOT "/mnt/c/some path/with/spaces")
+# or use this logic to assign value from Environment Variable WOLFSSL_ROOT,
+# or assume this is an example 7 subdirectories below:
+
+# We are typically in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl
+# The root of wolfSSL is 7 directories up from here:
+
+# function: IS_WOLFSSL_SOURCE
+# parameter: DIRECTORY_PARAMETER - the directory to test
+# output: RESULT = contains contents of DIRECTORY_PARAMETER for wolfssl directory, otherwise blank.
+function(IS_WOLFSSL_SOURCE DIRECTORY_PARAMETER RESULT)
+ if (EXISTS "${DIRECTORY_PARAMETER}/wolfcrypt/src")
+ set(${RESULT} "${DIRECTORY_PARAMETER}" PARENT_SCOPE)
+ else()
+ set(${RESULT} "" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# function: FIND_WOLFSSL_DIRECTORY
+# parameter: OUTPUT_FOUND_WOLFSSL_DIRECTORY contains root of source code, otherwise blank
+#
+function(FIND_WOLFSSL_DIRECTORY OUTPUT_FOUND_WOLFSSL_DIRECTORY)
+ message(STATUS "Starting FIND_WOLFSSL_DIRECTORY")
+ set(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}")
+ if( "${CURRENT_SEARCH_DIR}" STREQUAL "" )
+ message(STATUS "The WOLFSSL_ROOT environment variable is not set. Searching...")
+ else()
+ get_filename_component(CURRENT_SEARCH_DIR "$ENV{WOLFSSL_ROOT}" ABSOLUTE)
+ IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
+ if("${FOUND_WOLFSSL}")
+ message(STATUS "Found WOLFSSL_ROOT via Environment Variable:")
+ else()
+ message(FATAL_ERROR "WOLFSSL_ROOT Environment Variable defined, but path not found:")
+ message(STATUS "$ENV{WOLFSSL_ROOT}")
+ endif()
+ endif()
+
+ # we'll start in the CMAKE_CURRENT_SOURCE_DIR, typically [something]/projectname/components/wolfssl
+ message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
+ get_filename_component(CURRENT_SEARCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
+ message(STATUS "CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
+
+ # loop through all the parents, looking for wolfssl
+ while(NOT CURRENT_SEARCH_DIR STREQUAL "/" AND NOT CURRENT_SEARCH_DIR STREQUAL "" )
+ string(LENGTH ${CURRENT_SEARCH_DIR} CURRENT_SEARCH_DIR_LENGTH)
+ # wolfSSL may simply be in a parent directory, such as for local examples in wolfssl repo
+ IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR}" FOUND_WOLFSSL)
+ if( FOUND_WOLFSSL )
+ message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
+ return()
+ endif()
+
+ if( THIS_USER )
+ # Check for "wolfssl-[username]" subdirectory as we recurse up the directory tree
+ set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl-${THIS_USER})
+ message(STATUS "Looking in ${CURRENT_SEARCH_DIR}")
+
+ #if(EXISTS ${CURRENT_SEARCH_DIR_ALT} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR_ALT} AND EXISTS "${CURRENT_SEARCH_DIR_ALT}/wolfcrypt/src")
+ IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
+ if ( FOUND_WOLFSSL )
+ message(STATUS "Found wolfssl in user-suffix CURRENT_SEARCH_DIR_ALT = ${CURRENT_SEARCH_DIR_ALT}")
+ set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR_ALT} PARENT_SCOPE)
+ return()
+ endif()
+ endif()
+
+ # Next check for no user suffix "wolfssl" subdirectory as we recurse up the directory tree
+ set(CURRENT_SEARCH_DIR_ALT ${CURRENT_SEARCH_DIR}/wolfssl)
+ # if(EXISTS ${CURRENT_SEARCH_DIR} AND IS_DIRECTORY ${CURRENT_SEARCH_DIR} AND EXISTS "${CURRENT_SEARCH_DIR}/wolfcrypt/src")
+ IS_WOLFSSL_SOURCE("${CURRENT_SEARCH_DIR_ALT}" FOUND_WOLFSSL )
+ if ( FOUND_WOLFSSL )
+ message(STATUS "Found wolfssl in CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} ${CURRENT_SEARCH_DIR} PARENT_SCOPE)
+ return()
+ endif()
+
+ # Move up one directory level
+ set(PRIOR_SEARCH_DIR "${CURRENT_SEARCH_DIR}")
+ get_filename_component(CURRENT_SEARCH_DIR "${CURRENT_SEARCH_DIR}" DIRECTORY)
+ message(STATUS "Next CURRENT_SEARCH_DIR = ${CURRENT_SEARCH_DIR}")
+ if( "${PRIOR_SEARCH_DIR}" STREQUAL "${CURRENT_SEARCH_DIR}" )
+ # when the search directory is empty, we'll give up
+ set(CURRENT_SEARCH_DIR "")
+ endif()
+ endwhile()
+
+ # If not found, set the output variable to empty before exiting
+ set(${OUTPUT_FOUND_WOLFSSL_DIRECTORY} "" PARENT_SCOPE)
+endfunction()
+
+
+# Example usage:
+
+
+
+
+if(CMAKE_BUILD_EARLY_EXPANSION)
+ message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
+ idf_component_register(
+ REQUIRES "${COMPONENT_REQUIRES}"
+ PRIV_REQUIRES # esp_hw_support
+ esp_timer
+ driver # this will typically only be needed for wolfSSL benchmark
+ )
+
+else()
+ # not CMAKE_BUILD_EARLY_EXPANSION
+ message(STATUS "************************************************************************************************")
+ message(STATUS "wolfssl component config:")
+ message(STATUS "************************************************************************************************")
+
+ # search for wolfSSL
+ FIND_WOLFSSL_DIRECTORY(WOLFSSL_ROOT)
+ if(WOLFSSL_ROOT)
+ message(STATUS "NEW Found wolfssl directory at: ${WOLFSSL_ROOT}")
+ else()
+ message(STATUS "NEW wolfssl directory not found.")
+ # Abort. We need wolfssl _somewhere_.
+ message(FATAL_ERROR "Could not find wolfssl in ${WOLFSSL_ROOT}.\n"
+ "Try setting WOLFSSL_ROOT environment variable or git clone.")
+ endif()
+
+ set(INCLUDE_PATH ${WOLFSSL_ROOT})
+
+ set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/src/")
+
+ if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_benchmark" )
+ set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/benchmark")
+ endif()
+
+ if( ${CMAKE_PROJECT_NAME} STREQUAL "wolfssl_test" )
+ set(WOLFSSL_EXTRA_PROJECT_DIR "${WOLFSSL_ROOT}/wolfcrypt/test")
+ endif()
+
+ set(COMPONENT_SRCDIRS "\"${WOLFSSL_ROOT}/src/\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel\""
+ "\"${WOLFSSL_EXTRA_PROJECT_DIR}\""
+ ) # COMPONENT_SRCDIRS
+
+ message(STATUS "This COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
+
+ set(WOLFSSL_PROJECT_DIR "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
+ add_definitions(-DWOLFSSL_USER_SETTINGS_DIR="${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
+
+
+ # Espressif may take several passes through this makefile. Check to see if we found IDF
+ string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF)
+
+ # get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa
+ file(GLOB EXCLUDE_ASM *.S)
+ file(GLOB EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S")
+
+ message(STATUS "IDF_PATH = $ENV{IDF_PATH}")
+ message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}")
+ message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}")
+
+ #
+ # Check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components.
+ #
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
+ #
+ # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
+ #
+ message(STATUS "")
+ message(STATUS "**************************************************************************************")
+ message(STATUS "")
+ message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH")
+ message(STATUS "")
+ message(STATUS "To proceed: ")
+ message(STATUS "")
+ message(STATUS "Remove either the local project component: ${WOLFSSL_PROJECT_DIR} ")
+ message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ")
+ message(STATUS "")
+ message(STATUS "")
+ message(STATUS "**************************************************************************************")
+ message(STATUS "")
+
+ message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.")
+ # Abort CMake after fatal error.
+
+ # Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition:
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
+
+ else()
+ if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
+ #
+ # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup.
+ #
+ message(STATUS "")
+ message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}")
+ message(STATUS "")
+ else()
+ #
+ # wolfSSL is not an ESP-IDF component.
+ # We need to now determine if it is local and if so if it is part of the wolfSSL repo,
+ # or if wolfSSL is simply installed as a local component.
+ #
+
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}" )
+ #
+ # wolfSSL found in local project.
+ #
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}/wolfcrypt/" )
+ message(STATUS "")
+ message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
+ message(STATUS "")
+ #
+ # Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components.
+ #
+ # We won't do anything else here, as it will be assumed the original install completed successfully.
+ #
+ else() # full wolfSSL not installed in local project
+ #
+ # This is the developer repo mode. wolfSSL will be assumed to be not installed to ESP-IDF nor local project
+ # In this configuration, we are likely running a wolfSSL example found directly in the repo.
+ #
+ message(STATUS "")
+ message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = ${CMAKE_HOME_DIRECTORY}")
+ message(STATUS "")
+
+ message(STATUS "************************************************************************************************")
+ # When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories.
+ # However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed.
+ #
+ # first check if there's a [root]/include/user_settings.h
+ if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" )
+ message(FATAL_ERROR "Found stray wolfSSL user_settings.h in "
+ "${WOLFSSL_ROOT}/include/user_settings.h "
+ " (please move it to ${WOLFSSL_PROJECT_DIR}/include/user_settings.h )")
+ # Abort CMake after fatal error.
+ else()
+ # we won't overwrite an existing user settings file, just note that we already have one:
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/user_settings.h" )
+ message(STATUS "Using existing wolfSSL user_settings.h in "
+ "${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
+ else()
+ message(STATUS "Installing wolfSSL user_settings.h to "
+ "${WOLFSSL_PROJECT_DIR}/include/user_settings.h")
+ file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h"
+ DESTINATION "${CMAKE_HOME_DIRECTORY}/wolfssl/include/")
+ endif()
+ endif() # user_settings.h
+
+ # next check if there's a [root]/include/config.h
+ if( EXISTS "${WOLFSSL_ROOT}/include/config.h" )
+ message(STATUS "******************************************************************************")
+ message(STATUS "******************************************************************************")
+ message(STATUS "Found stray wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h" )
+ message(STATUS " Please move it to ${WOLFSSL_PROJECT_DIR}/include/config.h" )
+ message(STATUS "******************************************************************************")
+ message(STATUS "******************************************************************************")
+ else()
+ # we won't overwrite an existing user settings file, just note that we already have one:
+ if( EXISTS "${WOLFSSL_PROJECT_DIR}/include/config.h" )
+ message(STATUS "Using existing wolfSSL config.h ${WOLFSSL_PROJECT_DIR}/include/config.h")
+ else()
+ message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_PROJECT_DIR}/include/config.h")
+ file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_PROJECT_DIR}/include/")
+ file(RENAME "${WOLFSSL_PROJECT_DIR}/include/dummy_config_h" "${WOLFSSL_PROJECT_DIR}/include/config.h")
+ endif() # Project config.h
+ endif() # WOLFSSL_ROOT config.h
+ message(STATUS "************************************************************************************************")
+ message(STATUS "")
+ endif()
+
+ else()
+ # we did not find a ./components/wolfssl/include/ directory from this pass of cmake.
+ if($WOLFSSL_FOUND_IDF)
+ message(STATUS "")
+ message(STATUS "WARNING: wolfSSL not found.")
+ message(STATUS "")
+ else()
+ # probably needs to be re-parsed by Espressif
+ message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}")
+ endif() # else we have not found ESP-IDF yet
+ endif() # else not a local wolfSSL component
+
+ endif() #else not an ESP-IDF component
+ endif() # else not local copy and EDP-IDF wolfSSL
+
+
+ # RTOS_IDF_PATH is typically:
+ # "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos"
+ # depending on the environment, we may need to swap backslashes with forward slashes
+ string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos")
+
+ string(REPLACE "\\" "/" WOLFSSL_ROOT ${WOLFSSL_ROOT})
+
+ if(IS_DIRECTORY "${RTOS_IDF_PATH}")
+ message(STATUS "Found current RTOS path: ${RTOS_IDF_PATH}")
+ else()
+ # ESP-IDF prior version 4.4x has a different RTOS directory structure
+ string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos")
+ if(IS_DIRECTORY "${RTOS_IDF_PATH}")
+ message(STATUS "Found legacy RTOS path: ${RTOS_IDF_PATH}")
+ else()
+ message(STATUS "Could not find RTOS path")
+ endif()
+ endif()
+
+ # wolfSSL-specific include directories
+ set(COMPONENT_ADD_INCLUDEDIRS
+ "./include" # this is the location of local project wolfssl user_settings.h
+ "\"${WOLFSSL_ROOT}/\""
+ "\"${WOLFSSL_ROOT}/wolfssl/\""
+ "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\""
+ "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/port/Espressif\""
+ "\"${RTOS_IDF_PATH}/\""
+ )
+
+ # Optionally include cryptoauthlib if present
+ if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
+ list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")
+ endif()
+
+ list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/\"")
+ list(APPEND COMPONENT_ADD_INCLUDEDIRS "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt/\"")
+
+
+ # Some files are known to be included elsewhere, or not used for Espressif
+ set(COMPONENT_SRCEXCLUDE
+ "\"${WOLFSSL_ROOT}/src/bio.c\""
+ "\"${WOLFSSL_ROOT}/src/conf.c\""
+ "\"${WOLFSSL_ROOT}/src/misc.c\""
+ "\"${WOLFSSL_ROOT}/src/pk.c\""
+ "\"${WOLFSSL_ROOT}/src/ssl_asn1.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/ssl_bn.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/ssl_certman.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/ssl_crypto.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/ssl_misc.c\"" # included by ssl.c
+ "\"${WOLFSSL_ROOT}/src/x509.c\""
+ "\"${WOLFSSL_ROOT}/src/x509_str.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/evp.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/misc.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm32.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_arm64.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_armthumb.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c32.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_c64.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_cortexm.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64.c\""
+ "\"${WOLFSSL_ROOT}/wolfcrypt/src/sp_sm2_x86_64_asm.S\""
+ "\"${EXCLUDE_ASM}\""
+ )
+
+ spaces2list(COMPONENT_REQUIRES)
+
+ separate_arguments(COMPONENT_SRCDIRS NATIVE_COMMAND "${COMPONENT_SRCDIRS}")
+ separate_arguments(COMPONENT_SRCEXCLUDE NATIVE_COMMAND "${COMPONENT_SRCEXCLUDE}")
+ separate_arguments(COMPONENT_ADD_INCLUDEDIRS NATIVE_COMMAND "${COMPONENT_ADD_INCLUDEDIRS}")
+
+ #
+ # See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#example-component-requirements
+ #
+ message(STATUS "COMPONENT_SRCDIRS = ${COMPONENT_SRCDIRS}")
+ message(STATUS "COMPONENT_ADD_INCLUDEDIRS = ${COMPONENT_ADD_INCLUDEDIRS}")
+ message(STATUS "COMPONENT_REQUIRES = ${COMPONENT_REQUIRES}")
+ message(STATUS "COMPONENT_SRCEXCLUDE = ${COMPONENT_SRCEXCLUDE}")
+
+ #
+ # see https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/build-system.html?highlight=space%20path
+ #
+ set(EXTRA_COMPONENT_DIRS "${COMPONENT_SRCDIRS}")
+ idf_component_register(
+ SRC_DIRS "${COMPONENT_SRCDIRS}"
+ INCLUDE_DIRS "${COMPONENT_ADD_INCLUDEDIRS}"
+ REQUIRES "${COMPONENT_REQUIRES}"
+ EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
+ PRIV_REQUIRES esp_timer driver # this will typically only be needed for wolfSSL benchmark
+ )
+ # some optional diagnostics
+ if (1)
+ get_cmake_property(_variableNames VARIABLES)
+ list (SORT _variableNames)
+ message(STATUS "")
+ message(STATUS "ALL VARIABLES BEGIN")
+ message(STATUS "")
+ foreach (_variableName ${_variableNames})
+ if ( ("${_variableName}" STREQUAL "bootloader_binary_files")
+ OR ("${_variableName}" STREQUAL "Component paths")
+ OR ("${_variableName}" STREQUAL "component_targets")
+ OR ("${_variableName}" STREQUAL "__COMPONENT_TARGETS")
+ OR ("${_variableName}" STREQUAL "CONFIGS_LIST")
+ OR ("${_variableName}" STREQUAL "__CONFIG_VARIABLES")
+ OR ("${_variableName}" STREQUAL "val")
+ OR ("${_variableName}" MATCHES "^__idf_")
+ )
+ # Truncate the displayed value:
+ string(SUBSTRING "${${_variableName}}" 0 70 truncatedValue)
+ message(STATUS "${_variableName} = ${truncatedValue} ... (truncated)")
+ else()
+ message(STATUS "${_variableName}=${${_variableName}}")
+ endif()
+ endforeach()
+ message(STATUS "")
+ message(STATUS "ALL VARIABLES END")
+ message(STATUS "")
+ endif()
+
+ # target_sources(wolfssl PRIVATE "\"${WOLFSSL_ROOT}/wolfssl/\"" "\"${WOLFSSL_ROOT}/wolfssl/wolfcrypt\"")
+
+endif() # CMAKE_BUILD_EARLY_EXPANSION
+
+
+
+# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components
+if( EXISTS "${WOLFSSL_PROJECT_DIR}" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
+ message(STATUS "")
+ message(STATUS "")
+ message(STATUS "********************************************************************")
+ message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
+ message(STATUS "********************************************************************")
+ message(STATUS "")
+endif()
+# end multiple component check
+
+
+#
+# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
+#
+# Save the THIS_VAR as a string in a macro called VAR_OUPUT
+#
+# VAR_OUPUT: the name of the macro to define
+# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
+# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
+#
+function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
+ # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
+ string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
+
+ # if we had a successful operation, save the THIS_VAR in VAR_OUPUT
+ if(${IS_VALID_VALUE})
+ # strip newline chars in THIS_VAR parameter and save in VAR_VALUE
+ string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
+
+ # we'll could percolate the value to the parent for possible later use
+ # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
+
+ # but we're only using it here in this function
+ set(${VAR_OUPUT} ${VAR_VALUE})
+
+ # we'll print what we found to the console
+ message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
+
+ # the interesting part is defining the VAR_OUPUT name a value to use in the app
+ add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
+ else()
+ # if we get here, check the execute_process command and parameters.
+ message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
+ set(${VAR_OUPUT} "Unknown")
+ endif()
+endfunction() # LIBWOLFSSL_SAVE_INFO
+
+# create some programmatic #define values that will be used by ShowExtendedSystemInfo().
+# see wolfcrypt\src\port\Espressif\esp32_utl.c
+if(NOT CMAKE_BUILD_EARLY_EXPANSION)
+ set (git_cmd "git")
+ message(STATUS "Adding macro definitions:")
+
+ # LIBWOLFSSL_VERSION_GIT_ORIGIN: git config --get remote.origin.url
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "config" "--get" "remote.origin.url" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_ORIGIN "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_BRANCH: git rev-parse --abbrev-ref HEAD
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--abbrev-ref" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_BRANCH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_HASH: git rev-parse HEAD
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_SHORT_HASH: git rev-parse --short HEAD
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_HASH_DATE git show --no-patch --no-notes --pretty=\'\%cd\'
+ execute_process(WORKING_DIRECTORY ${WOLFSSL_ROOT} COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
+
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_WOLFSSL_ROOT "${WOLFSSL_ROOT}" "${TMP_RES}")
+
+ message(STATUS "************************************************************************************************")
+ message(STATUS "wolfssl component config complete!")
+ message(STATUS "************************************************************************************************")
+endif()
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/README.md b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/README.md
new file mode 100644
index 000000000..040c8c0ba
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/README.md
@@ -0,0 +1,9 @@
+# Component wolfSSL
+
+This `wolfssl` directory exists only for the stand-alone examples.
+
+The only files of interest are the [CMakeLists.txt](./CMakeLists.txt) that should point
+to the wolfSSL source code and the respective [include/user_settings.h](./include/user_settings.h).
+
+This directory is _not_ included in the publish to the Espressif Registry, as that
+mechanism copies the published source code to the local component directory as needed.
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/include/config.h b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/include/config.h
new file mode 100644
index 000000000..9d13eb284
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/include/config.h
@@ -0,0 +1,24 @@
+/* config.h - dummy
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+#endif
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/include/user_settings.h
new file mode 100644
index 000000000..ecc9ec9d8
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/components/wolfssl/include/user_settings.h
@@ -0,0 +1,503 @@
+/* user_settings.h
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+
+/* This user_settings.h is for Espressif ESP-IDF */
+#include
+/* ENABLE_MQTT_TLS is needed but may already be defined in CMake */
+#ifndef ENABLE_MQTT_TLS
+ #define ENABLE_MQTT_TLS
+#endif
+
+/* WOLFMQTT_USER_SETTINGS is needed may already be defined in CMake */
+#ifndef WOLFMQTT_USER_SETTINGS
+ #define WOLFMQTT_USER_SETTINGS
+#endif
+
+#undef WOLFSSL_ESPIDF
+#undef WOLFSSL_ESP32
+#undef WOLFSSL_ESPWROOM32SE
+#undef WOLFSSL_ESP32
+#undef WOLFSSL_ESP8266
+
+/* The Espressif sdkconfig will have chipset info.
+**
+** Possible values:
+**
+** CONFIG_IDF_TARGET_ESP32
+** CONFIG_IDF_TARGET_ESP32S2
+** CONFIG_IDF_TARGET_ESP32S3
+** CONFIG_IDF_TARGET_ESP32C3
+** CONFIG_IDF_TARGET_ESP32C6
+*/
+
+#undef WOLFSSL_ESPIDF
+#define WOLFSSL_ESPIDF
+
+/*
+ * choose ONE of these Espressif chips to define:
+ *
+ * WOLFSSL_ESP32
+ * WOLFSSL_ESPWROOM32SE
+ * WOLFSSL_ESP8266
+ */
+#undef WOLFSSL_ESPWROOM32SE
+#undef WOLFSSL_ESP8266
+#undef WOLFSSL_ESP32
+
+#define WOLFSSL_ESP32
+
+/* optionally turn off SHA512/224 SHA512/256 */
+/* #define WOLFSSL_NOSHA512_224 */
+/* #define WOLFSSL_NOSHA512_256 */
+
+/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */
+/* #define SINGLE_THREADED */
+
+/* When you don't want to use the old SHA */
+/* #define NO_SHA */
+/* #define NO_OLD_TLS */
+
+#define BENCH_EMBEDDED
+#define USE_CERT_BUFFERS_2048
+
+/* TLS 1.3 */
+#define WOLFSSL_TLS13
+#define HAVE_TLS_EXTENSIONS
+#define WC_RSA_PSS
+#define HAVE_HKDF
+#define HAVE_AEAD
+#define HAVE_SUPPORTED_CURVES
+
+#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB
+
+/* when you want to use SINGLE THREAD; ESP-IDF is freeRTOS */
+/* #define SINGLE_THREADED */
+
+#define NO_FILESYSTEM
+
+#define NO_OLD_TLS
+
+#define HAVE_AESGCM
+
+#define WOLFSSL_RIPEMD
+/* when you want to use SHA224 */
+/* #define WOLFSSL_SHA224 */
+
+#define NO_OLD_TLS
+#define WOLFSSL_SHA3
+
+/* when you want to use SHA384 */
+/* #define WOLFSSL_SHA384 */
+
+/* when you DO NOT want to use SHA256 */
+/* #define NO_SHA256 */
+
+#define WOLFSSL_SHA512
+#define HAVE_ECC
+#define HAVE_CURVE25519
+#define CURVE25519_SMALL
+#define HAVE_ED25519
+
+/* #define OPENSSL_EXTRA */
+
+/* when you want to use pkcs7 */
+/* #define HAVE_PKCS7 */
+
+#if defined(HAVE_PKCS7)
+ #define HAVE_AES_KEYWRAP
+ #define HAVE_X963_KDF
+ #define WOLFSSL_AES_DIRECT
+#endif
+
+/* when you want to use aes counter mode */
+/* #define WOLFSSL_AES_DIRECT */
+/* #define WOLFSSL_AES_COUNTER */
+
+/* esp32-wroom-32se specific definition */
+#if defined(WOLFSSL_ESPWROOM32SE)
+ #define WOLFSSL_ATECC508A
+ #define HAVE_PK_CALLBACKS
+ /* when you want to use a custom slot allocation for ATECC608A */
+ /* unless your configuration is unusual, you can use default */
+ /* implementation. */
+ /* #define CUSTOM_SLOT_ALLOCATION */
+#endif
+
+/* rsa primitive specific definition */
+#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
+ /* Define USE_FAST_MATH and SMALL_STACK */
+ #define ESP32_USE_RSA_PRIMITIVE
+
+ #if defined(CONFIG_IDF_TARGET_ESP32)
+
+ /* NOTE HW unreliable for small values! */
+ /* threshold for performance adjustment for HW primitive use */
+ /* X bits of G^X mod P greater than */
+ #undef ESP_RSA_EXPT_XBITS
+ #define ESP_RSA_EXPT_XBITS 32
+
+ /* X and Y of X * Y mod P greater than */
+ #undef ESP_RSA_MULM_BITS
+ #define ESP_RSA_MULM_BITS 16
+
+ #endif
+#endif
+
+#define RSA_LOW_MEM
+
+/* debug options */
+/* #define DEBUG_WOLFSSL */
+/* #define WOLFSSL_ESP32_CRYPT_DEBUG */
+/* #define WOLFSSL_ATECC508A_DEBUG */
+
+/* date/time */
+/* if it cannot adjust time in the device, */
+/* enable macro below */
+/* #define NO_ASN_TIME */
+/* #define XTIME time */
+
+/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
+#define ESP_RSA_TIMEOUT_CNT 0x249F00
+
+#define HASH_SIZE_LIMIT /* for test.c */
+
+/* USE_FAST_MATH is default */
+#define USE_FAST_MATH
+
+/***** Use SP_MATH *****/
+/* #undef USE_FAST_MATH */
+/* #define SP_MATH */
+/* #define WOLFSSL_SP_MATH_ALL */
+
+/***** Use Integer Heap Math *****/
+/* #undef USE_FAST_MATH */
+/* #define USE_INTEGER_HEAP_MATH */
+
+
+#define WOLFSSL_SMALL_STACK
+
+#define HAVE_VERSION_EXTENDED_INFO
+#define HAVE_WC_INTROSPECTION
+
+/* allows for all version info, even that suppressed with introspection */
+#define ALLOW_BINARY_MISMATCH_INTROSPECTION
+
+/* Default is HW enabled unless turned off.
+** Uncomment these lines to force SW instead of HW acceleration */
+
+#if defined(CONFIG_IDF_TARGET_ESP32)
+ /* wolfSSL HW Acceleration supported on ESP32. Uncomment to disable: */
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+
+ /* These are defined automatically in esp32-crypt.h, here for clarity: */
+ /* no SHA224 HW on ESP32 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224
+
+ /* TODO add compile-time warning for appropriate size: */
+ #undef ESP_RSA_MULM_BITS
+ #define ESP_RSA_MULM_BITS 16
+ /***** END CONFIG_IDF_TARGET_ESP32 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32S2)
+ /* wolfSSL HW Acceleration supported on ESP32-S2. Uncomment to disable: */
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
+ /* Note: There's no AES192 HW on the ESP32-S2; falls back to SW */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+ /***** END CONFIG_IDF_TARGET_ESP32S2 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32S3)
+ /* wolfSSL HW Acceleration supported on ESP32-S3. Uncomment to disable: */
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
+ /* Note: There's no AES192 HW on the ESP32-S3; falls back to SW */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+ /***** END CONFIG_IDF_TARGET_ESP32S3 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
+ defined(CONFIG_IDF_TARGET_ESP8684)
+ /* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
+ * single QFN 4x4 mm package. Out of released documentation, Technical
+ * Reference Manual as well as ESP-IDF Programming Guide is applicable
+ * to both ESP32-C2 and ESP8684.
+ *
+ * See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
+
+ /* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
+
+ /* These are defined automatically in esp32-crypt.h, here for clarity */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
+
+ /* There's no AES or RSA/Math accelerator on the ESP32-C2
+ * Automatically defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
+ /***** END CONFIG_IDF_TARGET_ESP32C2 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32C3)
+ /* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
+
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
+
+ /* These are defined automatically in esp32-crypt.h, here for clarity: */
+ /* no SHA384 HW on C3 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384
+ /* no SHA512 HW on C3 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512
+
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+ /***** END CONFIG_IDF_TARGET_ESP32C3 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32C6)
+ /* wolfSSL HW Acceleration supported on ESP32-C6. Uncomment to disable: */
+
+ /* #define NO_ESP32_CRYPT */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
+ /* These are defined automatically in esp32-crypt.h, here for clarity: */
+ /* no SHA384 HW on C6 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384
+ /* no SHA512 HW on C6 */
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512
+
+ /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+ /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+ /***** END CONFIG_IDF_TARGET_ESP32C6 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP32H2)
+ /* wolfSSL Hardware Acceleration not yet implemented */
+ #define NO_ESP32_CRYPT
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+ /***** END CONFIG_IDF_TARGET_ESP32H2 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP8266)
+ /* There's no hardware accleration on the ESP8266 */
+ #define NO_ESP32_CRYPT
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+ /***** END CONFIG_IDF_TARGET_ESP266 *****/
+
+#elif defined(CONFIG_IDF_TARGET_ESP8684)
+ /* There's no Hardware Acceleration available on ESP8684 */
+ #define NO_ESP32_CRYPT
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+ /***** END CONFIG_IDF_TARGET_ESP8684 *****/
+
+#else
+ /* Anything else encountered, disable HW accleration */
+ #define NO_ESP32_CRYPT
+ #define NO_WOLFSSL_ESP32_CRYPT_HASH
+ #define NO_WOLFSSL_ESP32_CRYPT_AES
+ #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
+#endif /* CONFIG_IDF_TARGET Check */
+
+/* Debug options:
+
+#define ESP_VERIFY_MEMBLOCK
+#define DEBUG_WOLFSSL
+#define DEBUG_WOLFSSL_VERBOSE
+#define DEBUG_WOLFSSL_SHA_MUTEX
+#define WOLFSSL_ESP32_CRYPT_DEBUG
+#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
+#define NO_RECOVER_SOFTWARE_CALC
+#define WOLFSSL_TEST_STRAY 1
+#define USE_ESP_DPORT_ACCESS_READ_BUFFER
+#define WOLFSSL_ESP32_HW_LOCK_DEBUG
+#define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
+#define ESP_DISABLE_HW_TASK_LOCK
+*/
+
+#define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
+#define WOLFSSL_HW_METRICS
+
+/* #define HASH_SIZE_LIMIT */ /* for test.c */
+
+/* #define NO_HW_MATH_TEST */ /* Optionall turn off HW math checks */
+
+/* Optionally include alternate HW test library: alt_hw_test.h */
+/* When enabling, the ./components/wolfssl/CMakeLists.txt file
+ * will need the name of the library in the idf_component_register
+ * for the PRIV_REQUIRES list. */
+/* #define INCLUDE_ALT_HW_TEST */
+
+/* optionally turn off individual math HW acceleration features */
+
+/* Turn off Large Number ESP32 HW Multiplication:
+** [Z = X * Y] in esp_mp_mul() */
+/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
+
+/* Turn off Large Number ESP32 HW Modular Exponentiation:
+** [Z = X^Y mod M] in esp_mp_exptmod() */
+/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
+
+/* Turn off Large Number ESP32 HW Modular Multiplication
+** [Z = X * Y mod M] in esp_mp_mulmod() */
+/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
+
+
+#define WOLFSSL_PUBLIC_MP /* used by benchmark */
+#define USE_CERT_BUFFERS_2048
+
+/* when turning on ECC508 / ECC608 support
+#define WOLFSSL_ESPWROOM32SE
+#define HAVE_PK_CALLBACKS
+#define WOLFSSL_ATECC508A
+#define ATCA_WOLFSSL
+*/
+
+/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
+#define WOLFSSL_SM2
+#define WOLFSSL_SM3
+#define WOLFSSL_SM4
+*/
+
+/* this is for example code */
+#undef NO_MAIN_DRIVER /* sometimes defined in project cmake file */
+#define NO_MAIN_DRIVER
+
+#if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4)
+ #include
+ #define CTX_CA_CERT root_sm2
+ #define CTX_CA_CERT_SIZE sizeof_root_sm2
+ #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM
+ #define CTX_SERVER_CERT server_sm2
+ #define CTX_SERVER_CERT_SIZE sizeof_server_sm2
+ #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_PEM
+ #define CTX_SERVER_KEY server_sm2_priv
+ #define CTX_SERVER_KEY_SIZE sizeof_server_sm2_priv
+ #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_PEM
+
+ #undef WOLFSSL_BASE16
+ #define WOLFSSL_BASE16
+#else
+ #define USE_CERT_BUFFERS_2048
+ #define USE_CERT_BUFFERS_256
+ #define CTX_CA_CERT ca_cert_der_2048
+ #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
+ #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
+ #define CTX_SERVER_CERT server_cert_der_2048
+ #define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_2048
+ #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1
+ #define CTX_SERVER_KEY server_key_der_2048
+ #define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
+ #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
+#endif
+
+/* VS include follows: */
+#ifndef _WOLFMQTT_VS_SETTINGS_
+#define _WOLFMQTT_VS_SETTINGS_
+
+/* Don't include this if using autoconf cross-compile */
+#if defined(HAVE_CONFIG_H)
+ #warning "Unexpected use of config.h"
+#else
+ /* TLS Support */
+ #undef ENABLE_MQTT_TLS
+ #define ENABLE_MQTT_TLS
+
+ /* MQTT-SN Support */
+ #undef WOLFMQTT_SN
+ #define WOLFMQTT_SN
+
+ /* MQTT v5.0 support */
+ #undef WOLFMQTT_V5
+ #define WOLFMQTT_V5
+
+ /* Enable property callback support */
+ #ifdef WOLFMQTT_V5
+ #undef WOLFMQTT_PROPERTY_CB
+ #define WOLFMQTT_PROPERTY_CB
+ #endif
+
+ /* Non-blocking support */
+ #undef WOLFMQTT_NONBLOCK
+ #define WOLFMQTT_NONBLOCK
+
+ /* Disable socket timeout code */
+ /*
+ #undef WOLFMQTT_NO_TIMEOUT
+ #define WOLFMQTT_NO_TIMEOUT
+ */
+
+ /* Disconnect callback support */
+ #undef WOLFMQTT_DISCONNECT_CB
+ #define WOLFMQTT_DISCONNECT_CB
+
+ /* Multi-threading */
+ #undef WOLFMQTT_MULTITHREAD
+ #define WOLFMQTT_MULTITHREAD
+
+ /* Debugging */
+ /*
+ #undef DEBUG_WOLFMQTT
+ #define DEBUG_WOLFMQTT
+
+ #undef WOLFMQTT_DEBUG_CLIENT
+ #define WOLFMQTT_DEBUG_CLIENT
+
+ #undef WOLFMQTT_DEBUG_SOCKET
+ #define WOLFMQTT_DEBUG_SOCKET
+
+ #undef WOLFMQTT_DEBUG_THREAD
+ #define WOLFMQTT_DEBUG_THREAD
+ */
+
+ /* Disable error strings */
+ /*
+ #undef WOLFMQTT_NO_ERROR_STRINGS
+ #define WOLFMQTT_NO_ERROR_STRINGS
+ */
+
+#endif /* !HAVE_CONFIG_H */
+
+#endif /* _WOLFMQTT_VS_SETTINGS_ */
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/CMakeLists.txt
new file mode 100644
index 000000000..96fe4426d
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/CMakeLists.txt
@@ -0,0 +1,188 @@
+# wolfSSL wolfMQTT Espressif Example Project/main/CMakeLists.txt
+# v1.0
+#
+message(STATUS "main cmake found WOLFSSL_COMPONENT_NAME = ${WOLFSSL_COMPONENT_NAME}")
+
+# find the user name to search for possible "wolfssl-username"
+message(STATUS "USERNAME = $ENV{USERNAME}")
+if( "$ENV{USER}" STREQUAL "" ) # the bash user
+ if( "$ENV{USERNAME}" STREQUAL "" ) # the Windows user
+ message(STATUS "could not find USER or USERNAME")
+ else()
+ # the bash user is not blank, so we'll use it.
+ set(THIS_USER "$ENV{USERNAME}")
+ endif()
+else()
+ # the bash user is not blank, so we'll use it.
+ set(THIS_USER "$ENV{USER}")
+endif()
+message(STATUS "THIS_USER (main) = ${THIS_USER}")
+
+if(WIN32)
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
+ message("Detected Windows")
+endif()
+if(CMAKE_HOST_UNIX)
+ message("Detected UNIX")
+endif()
+if(APPLE)
+ message("Detected APPLE")
+endif()
+if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
+ message("Detected WSL")
+endif()
+if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
+ message("Detected Linux")
+endif()
+if(APPLE)
+ # Windows-specific configuration here
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
+ message("Detected Apple")
+endif()
+set (git_cmd "git")
+
+if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" )
+ #
+ # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user
+ #
+ message(STATUS "")
+ message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH")
+ message(STATUS "")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING")
+endif()
+
+if( "$ENV{IDF_COMPONENT_REGISTRY_URL}" STREQUAL "https://components-staging.espressif.com" )
+ # Currently the only staging namespace is the gojimmypi developer, but allow for override.
+ # See https://components-staging.espressif.com/components?q=namespace:gojimmypi
+ #
+ if( "$ENV{WOLFSSL_STAGING_NAMESPACE}" STREQUAL "" )
+ set(WOLFSSL_STAGING_NAMESPACE "gojimmypi")
+ else()
+ set(WOLFSSL_STAGING_NAMESPACE "$ENV{WOLFSSL_STAGING_NAMESPACE}")
+ endif()
+ message(STATUS "Using namespace: ${WOLFSSL_STAGING_NAMESPACE}")
+
+ if( ("${managed_components}" STREQUAL "") AND ("${component_manager_interface_version}" STREQUAL "") )
+ # We've found a staging component, but did not detect the component manager
+ if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../components/mywolfmqtt/CMakeLists.txt)
+ # This is typically during publish-time build test
+ message(STATUS "Set name mywolfmqtt (1)")
+ set(WOLFSSL_COMPONENT_NAME "mywolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "mywolfmqtt")
+ else()
+ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../managed_components/${WOLFSSL_STAGING_NAMESPACE}__mywolfmqtt/CMakeLists.txt")
+ # This is typically upon creating a project from managed component examples
+ message(STATUS "Set name mywolfmqtt (2)")
+ set(WOLFSSL_COMPONENT_NAME "mywolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "mywolfmqtt")
+ else()
+ message(STATUS "Set name wolfmqtt (1) CMAKE_CURRENT_LIST_DIR = ${CMAKE_CURRENT_LIST_DIR}")
+ set(WOLFSSL_COMPONENT_NAME "wolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "wolfmqtt")
+ endif()
+ endif()
+ else()
+ message(STATUS "Set name mywolfmqtt (3)")
+ set(WOLFSSL_COMPONENT_NAME "mywolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "mywolfmqtt")
+ endif()
+else()
+ message(STATUS "Set name wolfmqtt (2)")
+ set(WOLFSSL_COMPONENT_NAME "wolfssl")
+ set(WOLFMQTT_COMPONENT_NAME "wolfmqtt")
+endif()
+
+if(CMAKE_BUILD_EARLY_EXPANSION)
+ message(STATUS "wolfmqtt component CMAKE_BUILD_EARLY_EXPANSION:")
+ string(REPLACE "\\" "/" PROTOCOL_EXAMPLES "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common")
+ idf_component_register(
+ INCLUDE_DIRS
+ "include"
+ "${PROTOCOL_EXAMPLES}"
+ REQUIRES
+ "${WOLFMQTT_COMPONENT_NAME}"
+ nvs_flash
+ esp_event
+ esp_netif
+ esp_wifi
+ PRIV_REQUIRES
+ "${WOLFSSL_COMPONENT_NAME}"
+ )
+ message(STATUS "Early Expansion WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+else()
+ ## register_component()
+ message(STATUS "main WOLFMQTT_ROOT = ${WOLFMQTT_ROOT}")
+
+ string(REPLACE "\\" "/" PROTOCOL_EXAMPLES "$ENV{IDF_PATH}/examples/common_components/protocol_examples_common/include")
+ idf_component_register(SRCS
+ main.c
+ INCLUDE_DIRS
+ "."
+ "include"
+ REQUIRES
+ "${WOLFMQTT_COMPONENT_NAME}"
+ "${WOLFSSL_COMPONENT_NAME}"
+ lwip
+ nvs_flash
+ esp_event
+ )
+endif()
+#
+
+#
+# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT)
+#
+# Save the THIS_VAR as a string in a macro called VAR_OUPUT
+#
+# VAR_OUPUT: the name of the macro to define
+# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process()
+# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful.
+#
+function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT )
+ # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true.
+ string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE)
+
+ # if we had a successful operation, save the THIS_VAR in VAR_OUPUT
+ if(${IS_VALID_VALUE})
+ # strip newline chars in THIS_VAR parameter and save in VAR_VALUE
+ string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR})
+
+ # we'll could percolate the value to the parent for possible later use
+ # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE)
+
+ # but we're only using it here in this function
+ set(${VAR_OUPUT} ${VAR_VALUE})
+
+ # we'll print what we found to the console
+ message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}")
+
+ # the interesting part is defining the VAR_OUPUT name a value to use in the app
+ add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\")
+ else()
+ # if we get here, check the execute_process command and parameters.
+ message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT")
+ set(${VAR_OUPUT} "Unknown")
+ endif()
+endfunction() # LIBWOLFSSL_SAVE_INFO
+
+if(NOT CMAKE_BUILD_EARLY_EXPANSION)
+ # LIBWOLFSSL_VERSION_GIT_HASH
+ execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_SHORT_HASH
+ execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}")
+
+ # LIBWOLFSSL_VERSION_GIT_HASH_DATE
+ execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES )
+ LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}")
+endif()
+
+message(STATUS "")
+
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/include/main.h b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/include/main.h
new file mode 100644
index 000000000..94c3b5eba
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/include/main.h
@@ -0,0 +1,24 @@
+/* template main.h
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+#ifndef _MAIN_H_
+#define _MAIN_H_
+
+#endif
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/main.c b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/main.c
new file mode 100644
index 000000000..5142d0c60
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/main/main.c
@@ -0,0 +1,80 @@
+/* main.c
+ *
+ * Copyright (C) 2006-2023 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
+
+/* Espressif */
+#include
+
+/* wolfSSL */
+#include "user_settings.h" /* always include wolfSSL user_settings.h first */
+#include
+#include
+
+/* wolfMQTT */
+#include
+
+/* project */
+#include "main.h"
+
+static const char* const TAG = "My Project";
+
+void app_main(void)
+{
+ ESP_LOGI(TAG, "------------ wolfSSL wolfMQTT template Example ---------");
+ ESP_LOGI(TAG, "--------------------------------------------------------");
+ ESP_LOGI(TAG, "--------------------------------------------------------");
+ ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------");
+ ESP_LOGI(TAG, "--------------------------------------------------------");
+ ESP_LOGI(TAG, "--------------------------------------------------------");
+
+ ESP_LOGI(TAG, "Hello wolfSSL!");
+
+#ifdef HAVE_VERSION_EXTENDED_INFO
+ esp_ShowExtendedSystemInfo();
+#endif
+
+#ifdef INCLUDE_uxTaskGetStackHighWaterMark
+ ESP_LOGI(TAG, "Stack HWM: %d", uxTaskGetStackHighWaterMark(NULL));
+
+ ESP_LOGI(TAG, "Stack used: %d", CONFIG_ESP_MAIN_TASK_STACK_SIZE
+ - (uxTaskGetStackHighWaterMark(NULL)));
+#endif
+
+/* the simplest check of the wolfSSL library presence: */
+#ifdef LIBWOLFSSL_VERSION_STRING
+ ESP_LOGI(TAG, "");
+ ESP_LOGI(TAG, "Found wolfSSL Version %s\n", LIBWOLFSSL_VERSION_STRING);
+#else
+ ESP_LOGW(TAG, "Warning: Could not find wolfSSL Version");
+#endif
+
+/* the simplest check of the wolfMQTT library presence: */
+#ifdef LIBWOLFMQTT_VERSION_STRING
+ ESP_LOGI(TAG, "");
+ ESP_LOGI(TAG, "Found wolfMQTT Version %s\n", LIBWOLFMQTT_VERSION_STRING);
+#else
+ ESP_LOGW(TAG, "Warning: Could not find wolfMQTT Version");
+#endif
+
+ ESP_LOGI(TAG, "\n\nDone!\n\n"
+ "If running from idf.py monitor, press twice: Ctrl+]\n\n"
+ "WOLFSSL_COMPLETE\n" /* exit keyword for wolfssl_monitor.py */
+ );
+} /* app_main */
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/partitions_singleapp_large.csv b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/partitions_singleapp_large.csv
new file mode 100644
index 000000000..a9c373bec
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/partitions_singleapp_large.csv
@@ -0,0 +1,31 @@
+# to view: idf.py partition-table
+#
+# ESP-IDF Partition Table
+# Name, Type, SubType, Offset, Size, Flags
+nvs, data, nvs, 0x9000, 24K,
+phy_init,data, phy, 0xf000, 4K,
+factory, app, factory, 0x10000, 1500K,
+
+
+# For other settings, see:
+# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#creating-custom-tables
+#
+# Here is the summary printed for the "Single factory app, no OTA" configuration:
+#
+# # ESP-IDF Partition Table
+# # Name, Type, SubType, Offset, Size, Flags
+# nvs, data, nvs, 0x9000, 0x6000,
+# phy_init, data, phy, 0xf000, 0x1000,
+# factory, app, factory, 0x10000, 1M,
+#
+#
+# Here is the summary printed for the "Factory app, two OTA definitions" configuration:
+#
+# # ESP-IDF Partition Table
+# # Name, Type, SubType, Offset, Size, Flags
+# nvs, data, nvs, 0x9000, 0x4000,
+# otadata, data, ota, 0xd000, 0x2000,
+# phy_init, data, phy, 0xf000, 0x1000,
+# factory, app, factory, 0x10000, 1M,
+# ota_0, app, ota_0, 0x110000, 1M,
+# ota_1, app, ota_1, 0x210000, 1M,
diff --git a/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/sdkconfig.defaults
new file mode 100644
index 000000000..2842aa34e
--- /dev/null
+++ b/IDE/Espressif/ESP-IDF/examples/wolfmqtt_template/sdkconfig.defaults
@@ -0,0 +1,23 @@
+CONFIG_FREERTOS_HZ=1000
+CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
+
+#
+# Default main stack size
+#
+# This is typically way bigger than needed for stack size. See user_settings.h
+#
+CONFIG_ESP_MAIN_TASK_STACK_SIZE=10500
+
+# Legacy stack size for older ESP-IDF versions
+CONFIG_MAIN_TASK_STACK_SIZE=10500
+
+#
+# Compiler options
+#
+CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
+CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
+CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
+CONFIG_COMPILER_HIDE_PATHS_MACROS=y
+CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y
+CONFIG_COMPILER_STACK_CHECK=y
+
diff --git a/IDE/Espressif/README.md b/IDE/Espressif/README.md
new file mode 100644
index 000000000..15169e6a7
--- /dev/null
+++ b/IDE/Espressif/README.md
@@ -0,0 +1,18 @@
+# IDE: Espressif
+
+Here are the libraries and features related to Espressif and the wolfMQTT product.
+
+For details on wolfMQTT [see the wolfMQTT Manual](https://www.wolfssl.com/documentation/manuals/wolfmqtt/wolfMQTT-Manual.pdf).
+
+## Component Manager
+
+[These files](./component-manager/README.md) are used internally by wolfSSL to publish components to the [Espressif ESP Registry](https://components.espressif.com/).
+
+The publishing process is documented in the [INSTALL.md](./component-manager/INSTALL.md) file.
+
+See additional [documentation](https://docs.espressif.com/projects/idf-component-manager/en/latest/guides/packaging_components.html).
+
+## ESP-IDF
+
+[These files](./ESP-IDF/README.md) are related to using the [Espressif ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html)
+for wolfSSL [wolfMQTT examples on the ESP32](./ESP-IDF/examples/README.md).