Skip to content

Commit a13f48a

Browse files
author
gojimmypi
committed
Update Espressif Examples
1 parent db6a2cc commit a13f48a

97 files changed

Lines changed: 9475 additions & 1522 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

IDE/Espressif/ESP-IDF/README.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# ESP-IDF Port
22

33
These Espressif examples have been created and tested with the latest stable release branch of
4-
[ESP-IDF V5.2](https://docs.espressif.com/projects/esp-idf/en/release-v5.2/esp32/get-started/index.html).
4+
ESP-IDF v5.2, v5.3 and the master branch
5+
56
The prior version 4.4 ESP-IDF is still supported, however version 5.2 or greater is recommended.
6-
Espressif has [a list of all ESP-IDF versions](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/versions.html).
7+
Espressif has [a list of all ESP-IDF versions](Espressifversions.html).
78

8-
See the latest [Espressif Migration Guides](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/index.html).
9+
See the latest Espressif Migration Guides.
910

1011
## Examples
1112

@@ -34,7 +35,7 @@ looks for the wolfSSL `user_settings.h` in the project as described below.
3435
### File: `sdkconfig.h`
3536

3637
The Espressif `sdkconfig.h`, generated automatically from your `sdkconfig`
37-
file at [build](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html)
38+
file at [build](Espressif api-guides/build-system.html)
3839
time, should be included before any other files.
3940

4041
### File: `user_settings.h`
@@ -101,7 +102,7 @@ of your source code, particularly before the `#include <wolfssl/wolfcrypt/settin
101102

102103
## Requirements
103104

104-
1. [ESP-IDF development framework](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/)
105+
1. [ESP-IDF development framework](https://github.com/espressif/esp-idf)
105106

106107
## wolfSSL as an Espressif component
107108

@@ -113,7 +114,7 @@ There are various methods available for using wolfSSL as a component:
113114

114115
## Espressif Managed Components
115116

116-
Visit https://components.espressif.com/components/wolfssl/wolfssl and see the instructions. Typically:
117+
Visit https://www.wolfssl.com/wolfssl-now-available-in-espressif-component-registry/ and see the instructions. Typically:
117118

118119
```
119120
idf.py add-dependency "wolfssl/wolfssl^5.6.0-stable"
@@ -144,6 +145,14 @@ This is an alternate method for installation. It is recommended to use the new `
144145
2. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/`
145146
3. Find [Example Programs](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF/examples) under _/path/to/esp_`/esp-idf/examples/protocols/wolfssl_xxx` (where xxx is the project name)
146147

148+
149+
```
150+
WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.2
151+
. $WRK_IDF_PATH/export.sh
152+
153+
./setup.sh
154+
```
155+
147156
## Setup for Windows
148157

149158
This is an alternate method for installation. It is recommended to use the new `CMakeLists.txt` to point to wolfSSL source code.
@@ -188,8 +197,8 @@ C:\SysGCC\esp32\esp-idf>git clone -b v5.0.2 --recursive https://github.com/espre
188197
- Microsoft Windows 10 Pro 10.0.19041 / Windows 11 Pro 22H2 22621.2715
189198
- Visual Studio 2022 17.7.6 with VisualGDB 5.6R9 (build 4777)
190199
- WSL 1 Ubuntu 22.04.3 LTS
191-
- ESP-IDF: ESP-IDF v5.1
192-
- SoC Module : all those supported in ESP-IDF v5.1
200+
- ESP-IDF: ESP-IDF v5.2
201+
- SoC Module : all those supported in ESP-IDF v5.2
193202

194203
## JTAG Debugging Notes
195204

@@ -226,3 +235,15 @@ ftdi layout_signal nSRST -data 0x0020
226235
reset_config srst_push_pull trst_push_pull
227236
228237
```
238+
239+
## Windows long paths
240+
241+
Check "Long Paths Enabled" in Windows registry.
242+
243+
Please set registry HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled to 1.
244+
245+
The operation requires Administrator privileges. Command:
246+
247+
```powershell
248+
powershell -Command "&{ Start-Process -FilePath reg 'ADD HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f' -Verb runAs}"
249+
```

IDE/Espressif/ESP-IDF/README_32se.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Including the following examples:
1010
The `user_settings.h` file enables some of the hardened settings.
1111

1212
## Requirements
13-
1. ESP-IDF development framework: https://docs.espressif.com/projects/esp-idf/en/latest/get-started/
13+
1. ESP-IDF development framework: https://github.com/espressif/esp-idf
1414

1515
2. Microchip CryptoAuthentication Library: https://github.com/MicrochipTech/cryptoauthlib
1616

IDE/Espressif/ESP-IDF/examples/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ wolfSSL to be installed.
7878
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)
7979
and [wolfSSH](https://github.com/wolfSSL/wolfssh/tree/master/ide/Espressif#setup-for-linux).
8080

81-
The [Espressif Managed Component for wolfSSL](https://components.espressif.com/components/wolfssl/wolfssl)
81+
The [Espressif Managed Component for wolfSSL](https://www.wolfssl.com/wolfssl-now-available-in-espressif-component-registry/)
8282
also installs source code locally, instead of pointing to a source repository.
8383

8484
## VisualGDB
@@ -114,7 +114,4 @@ It may be helpful to also delete the `sdkconfig` file. (Save a backup if you've
114114

115115
- esp32.com: [GPIO6,GPIO7,GPIO8,and GPIO9 changed for ESP32-WROOM-32E](https://esp32.com/viewtopic.php?t=29058)
116116

117-
See also [this ESP-FAQ Handbook](https://docs.espressif.com/projects/esp-faq/en/latest/esp-faq-en-master.pdf).
118-
119-
120-
117+
See also the `ESP-FAQ Handbook`.

IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# wolfSSL Espressif Example Project CMakeLists.txt
2-
# v1.2
2+
# v1.3
33
#
44
# The following lines of boilerplate have to be in your project's
55
# CMakeLists in this exact order for cmake to work correctly
66
cmake_minimum_required(VERSION 3.16)
77

88
# Optional no watchdog typically used for test & benchmark
9-
# add_compile_options(-DWOLFSSL_ESP_NO_WATCHDOG=1)
9+
add_compile_options(-DWOLFSSL_ESP_NO_WATCHDOG=1)
1010

1111
# The wolfSSL CMake file should be able to find the source code.
1212
# Otherwise, assign an environment variable or set it here:
@@ -71,6 +71,10 @@ else()
7171
message(STATUS "No conflicting wolfSSL components found.")
7272
endif()
7373

74+
# Ensure the this wolfSSL component directory is included
75+
set(WOLFSSL_PATH "${CMAKE_HOME_DIRECTORY}/components/wolfssl")
76+
list(APPEND EXTRA_COMPONENT_DIRS ${WOLFSSL_PATH})
77+
7478
# Not only is a project-level "set(COMPONENTS" not needed here, this will cause
7579
# an unintuitive error about Unknown CMake command "esptool_py_flash_project_args".
7680
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

IDE/Espressif/ESP-IDF/examples/template/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ For general information on [wolfSSL examples for Espressif](../README.md), see t
77

88
### Prerequisites
99

10-
It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) has been installed.
10+
It is assumed the [ESP-IDF environment](Espressifget-started/) has been installed.
1111

1212
### Files Included
1313

@@ -19,7 +19,7 @@ It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp-
1919

2020
- The [components/wolfssl/CMakeLists.txt](./components/wolfssl/CMakeLists.txt) typically does not need to be changed.
2121

22-
- Optional [VisualGDB Project](./VisualGDB/wolfssl_template_IDF_v5.1_ESP32.vgdbproj) for Visual Studio using ESP32 and ESP-IDF v5.1.
22+
- Optional [VisualGDB Project](./VisualGDB/README.md) for Visual Studio using ESP32 and ESP-IDF v5.2. See also [template](../template/VisualGDB/README.md) for other devices.
2323

2424
- Edit the project [CMakeLists.txt](./CMakeLists.txt) to optionally point this project's wolfSSL component source code at a different directory:
2525

@@ -30,12 +30,12 @@ set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
3030

3131
## Getting Started:
3232

33-
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).
33+
Here's an example using the command-line [idf.py](Espressifapi-guides/tools/idf-py.html).
3434

3535
Edit your `WRK_IDF_PATH`to point to your ESP-IDF install directory.
3636

3737
```
38-
WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.1
38+
WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.2
3939
4040
echo "Run export.sh from ${WRK_IDF_PATH}"
4141
. ${WRK_IDF_PATH}/export.sh
@@ -53,7 +53,7 @@ idf.py flash -p /dev/ttyS19 -b 115200
5353
idf.py flash -p /dev/ttyS19 -b 115200 monitor
5454
```
5555

56-
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).
56+
Press `Ctrl+]` to exit `idf.py monitor`. See [additional monitor keyboard commands](Espressifapi-guides/tools/idf-monitor.html).
5757

5858
## Other Examples:
5959

IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/CMakeLists.txt

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ cmake_minimum_required(VERSION 3.16)
2828

2929
set(VERBOSE_COMPONENT_MESSAGES 1)
3030

31+
# Optional requires include:
32+
# set(THIS_ESP_TLS "esp-tls")
33+
set(THIS_ESP_TLS "")
3134

3235
# function: IS_ESP_IDF_COMPONENT
3336
# output: RESULT = 1 (true) if this component is located in the ESP-IDF components
@@ -153,7 +156,7 @@ if( ("${CMAKE_PROJECT_NAME}" STREQUAL "wolfssl_benchmark") OR ("${CMAKE_PROJECT_
153156
message(STATUS "Not including lwip for ${CMAKE_PROJECT_NAME}")
154157
else()
155158
# benchmark and test do not need wifi, everything else probably does:
156-
set(COMPONENT_REQUIRES lwip) # we typically don't need lwip directly in wolfssl component
159+
set(COMPONENT_REQUIRES lwip "${THIS_ESP_TLS}") # we typically don't need lwip directly in wolfssl component
157160
endif()
158161

159162
# find the user name to search for possible "wolfssl-username"
@@ -404,22 +407,28 @@ endif()
404407

405408
if ( ("${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266") OR ("${IDF_TARGET}" STREQUAL "esp8266") )
406409
# There's no esp_timer, no driver components for the ESP8266
407-
message(STATUS "Early expansion EXCLUDES esp_timer: ${THIS_INCLUDE_TIMER}")
408-
message(STATUS "Early expansion EXCLUDES driver: ${THIS_INCLUDE_DRIVER}")
410+
message(STATUS "Early expansion EXCLUDES esp_timer for esp8266: ${THIS_INCLUDE_TIMER}")
411+
message(STATUS "Early expansion EXCLUDES driver for esp8266: ${THIS_INCLUDE_DRIVER}")
409412
set(THIS_INCLUDE_TIMER "")
410413
set(THIS_INCLUDE_DRIVER "")
414+
set(THIS_ESP_TLS "")
411415
else()
412416
message(STATUS "Early expansion includes esp_timer: ${THIS_INCLUDE_TIMER}")
413417
message(STATUS "Early expansion includes driver: ${THIS_INCLUDE_DRIVER}")
414418
set(THIS_INCLUDE_TIMER "esp_timer")
415419
set(THIS_INCLUDE_DRIVER "driver")
420+
set(THIS_ESP_TLS "esp-tls")
421+
# Let the app know that we've included the esp-tls component requirement.
422+
# This is critical for use the the esp-tls component. See wolfssl esp_crt_bundle.c file.
423+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_REQUIRED_ESP_TLS=1")
416424
endif()
417425

418426
if(CMAKE_BUILD_EARLY_EXPANSION)
419427
message(STATUS "wolfssl component CMAKE_BUILD_EARLY_EXPANSION:")
420428
idf_component_register(
421429
REQUIRES "${COMPONENT_REQUIRES}"
422430
PRIV_REQUIRES # esp_hw_support
431+
"${THIS_ESP_TLS}"
423432
"${THIS_INCLUDE_TIMER}"
424433
"${THIS_INCLUDE_DRIVER}" # this will typically only be needed for wolfSSL benchmark
425434
)
@@ -757,6 +766,7 @@ else()
757766
REQUIRES "${COMPONENT_REQUIRES}"
758767
EXCLUDE_SRCS "${COMPONENT_SRCEXCLUDE}"
759768
PRIV_REQUIRES
769+
"${THIS_ESP_TLS}"
760770
"${THIS_INCLUDE_TIMER}"
761771
"${THIS_INCLUDE_DRIVER}" # this will typically only be needed for wolfSSL benchmark
762772
)
@@ -768,7 +778,10 @@ else()
768778
endif()
769779

770780
# function(WOLFSSL_INIT_CERT_BUNDLE)
771-
if(CONFIG_WOLFSSL_CERTIFICATE_BUNDLE AND NOT CONFIG_WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_NONE)
781+
if( CONFIG_WOLFSSL_CERTIFICATE_BUNDLE
782+
AND NOT CONFIG_WOLFSSL_CERTIFICATE_BUNDLE_DEFAULT_NONE
783+
AND NOT ("${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266")
784+
)
772785
if (CMAKE_BUILD_EARLY_EXPANSION)
773786
message(ERROR "Bundle Cert initialization must occur during CMAKE_BUILD_EARLY_EXPANSION")
774787
endif()
@@ -1001,10 +1014,13 @@ if(WOLFSSL_ROOT)
10011014
set(ENV{PIO_WOLFSSL_ROOT} "${WOLFSSL_ROOT}")
10021015
message(STATUS "PIO_WOLFSSL_ROOT = $ENV{PIO_WOLFSSL_ROOT}")
10031016
message(STATUS "PLATFORMIO_BUILD_DIR = $ENV{PLATFORMIO_BUILD_DIR}")
1004-
file(WRITE "tada.txt" "${WOLFSSL_ROOT}\n")
10051017
# See esp-tls Kconfig; menu "ESP-TLS", ESP_TLS_LIBRARY_CHOOSE
10061018
if(CONFIG_ESP_TLS_USING_WOLFSSL)
1007-
message(STATUS "wolfSSL will be used for ESP-TLS")
1019+
if ( ("${CONFIG_TARGET_PLATFORM}" STREQUAL "esp8266") OR ("${IDF_TARGET}" STREQUAL "esp8266") )
1020+
message(STATUS "This version of wolfSSL is not supported on the ESP8266 esp-tls at this time. Check ESP-TLS config")
1021+
else()
1022+
message(STATUS "wolfSSL will be used for ESP-TLS")
1023+
endif()
10081024
else()
10091025
message(STATUS "WARNING: wolfSSL NOT selected for ESP-TLS. Features and performance will be limited.")
10101026
endif()

IDE/Espressif/ESP-IDF/examples/template/components/wolfssl/Kconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,24 @@ menu "wolfSSL"
382382
Hardware acceleration enabled by default.
383383
Select this option to force disable: NO_HW_RSA_PRI_EXPTMOD
384384

385+
config ESP_WOLFSSL_DEBUG_ESP_HW_MULTI_RSAMAX_BITS
386+
bool "Enable debugging of RSA Multiplication operand length"
387+
default n
388+
help
389+
Prints an esp log warning to the default console UART when one of the
390+
multiplication operands exceeds the maximum size supported by hardware,
391+
requiring fallback to software. This can be helpful to pick key sizes
392+
when performance is critical. See also metrics for counting instances.
393+
394+
config ESP_WOLFSSL_DEBUG_ESP_HW_MOD_RSAMAX_BITS
395+
bool "Enable debugging of RSA Modular operand length"
396+
default n
397+
help
398+
Prints an esp log warning to the default console UART when one of the
399+
modular math operands exceeds the maximum size supported by hardware,
400+
requiring fallback to software. This can be helpful to pick key sizes
401+
when performance is critical. See also metrics for counting instances.
402+
385403
endmenu # wolfSSL Hardware Acceleration
386404
# -----------------------------------------------------------------------------------------------------------------
387405

@@ -410,6 +428,13 @@ menu "wolfSSL"
410428
default n
411429
help
412430
Enable debugging messages for wolfSSL. See user_settings.h for additional debug options.
431+
432+
config ESP_WOLFSSL_TEST_LOOP
433+
bool "Run test apps in a loop until failure"
434+
default y
435+
help
436+
Enable a loop wrapper for benchmark, http_client, and wolfssl test apps.
437+
413438
endmenu # wolfSSL Debug Options
414439
# -----------------------------------------------------------------------------------------------------------------
415440

0 commit comments

Comments
 (0)