diff --git a/IDE/Espressif/ESP-IDF/README.md b/IDE/Espressif/ESP-IDF/README.md index 0e8bfdd03..37efc5a70 100644 --- a/IDE/Espressif/ESP-IDF/README.md +++ b/IDE/Espressif/ESP-IDF/README.md @@ -4,7 +4,7 @@ Including the following examples: -* Simple [tls_client](./examples/wolfssl_client/)/[server](./examples/wolfssl_server/) +* Simple [TLS client](./examples/wolfssl_client/)/[server](./examples/wolfssl_server/) * Cryptographic [test](./examples/wolfssl_test/) * Cryptographic [benchmark](./examples/wolfssl_benchmark/) @@ -13,21 +13,16 @@ Including the following examples: ## Requirements 1. [ESP-IDF development framework](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/) - Note: This expects to use Linux version. - ## Setup for Linux 1. Run `setup.sh` at _/path/to_`/wolfssl/IDE/Espressif/ESP-IDF/` to deploy files into ESP-IDF tree - For Windows : Run `setup_win.bat` at `.\IDE\Espressif\ESP-IDF\` - 2. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/` - 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) - 4. Uncomment out `#define WOLFSSL_ESPIDF` in _/path/to/esp_`/esp-idf/components/wolfssl/wolfssl/wolfcrypt/settings.h` - Uncomment out `#define WOLFSSL_ESPWROOM32` in _/path/to/esp_`/esp-idf/components/wolfssl/wolfssl/wolfcrypt/settings.h` - - for example the default: - `~/esp/esp-idf/components/wolfssl/wolfssl/wolfcrypt/settings.h` +## Setup for Windows + 1. Run ESP-IDF Command Prompt (cmd.exe) or Run ESP-IDF PowerShell Environment + 2. Run `setup_win.bat` at `.\IDE\Espressif\ESP-IDF\` + 3. Find Wolfssl files at _/path/to/esp_`/esp-idf/components/wolfssl/` + 4. 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) ## Configuration 1. The `user_settings.h` can be found in _/path/to/esp_`/esp-idf/components/wolfssl/include/user_settings.h` @@ -39,6 +34,6 @@ Including the following examples: For question please email [support@wolfssl.com] Note: This is tested with : - - OS: Ubuntu 18.04.1 LTS and Microsoft Windows 10 Pro 10.0.19041 and well as WSL Ubuntu - - ESP-IDF: v4.4-dev-4031-gef98a363e3-dirty and v4.0.1-dirty - - Module : ESP32-WROOM-32 \ No newline at end of file + - OS: Ubuntu 20.04.3 LTS and Microsoft Windows 10 Pro 10.0.19041 and well as WSL Ubuntu + - ESP-IDF: ESP-IDF v4.3.2 + - Module : ESP32-WROOM-32 diff --git a/IDE/Espressif/ESP-IDF/README_32se.md b/IDE/Espressif/ESP-IDF/README_32se.md index 2204c0b9c..cb5171fcc 100644 --- a/IDE/Espressif/ESP-IDF/README_32se.md +++ b/IDE/Espressif/ESP-IDF/README_32se.md @@ -4,7 +4,7 @@ Including the following examples: -* simple `tls_client`/`tls_server` +* simple `TLS client`/`server` * crypt benchmark The `user_settings.h` file enables some of the hardened settings. @@ -15,11 +15,11 @@ Including the following examples: 2. Microchip CryptoAuthentication Library: https://github.com/MicrochipTech/cryptoauthlib ## Setup -1. wolfSSL under ESP-IDF. Please see [README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md) -2. CryptoAuthentication Library under ESP-IDF. Please see [README.md](https://github.com/miyazakh/cryptoauthlib_esp_idf/blob/master/README.md) -3. Uncomment out `#define WOLFSSL_ESPWROOM32SE` in `/path/to/wolfssl/wolfssl/wolfcrypt/settings.h` - * **Note:** Need to enable `WOLFSSL_ESPIDF` +1. Comment out `#define WOLFSSL_ESPWROOM32` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h`\ + Uncomment out `#define WOLFSSL_ESPWROOM32SE` in `/path/to/wolfssl/IDE/Espressif/ESP-IDF/user_settings.h` * **Note:** crypt test will fail if enabled `WOLFSSL_ESPWROOM32SE` +3. wolfSSL under ESP-IDF. Please see [README.md](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/README.md) +4. CryptoAuthentication Library under ESP-IDF. Please see [README.md](https://github.com/miyazakh/cryptoauthlib_esp_idf/blob/master/README.md) ## Configuration 1. The `user_settings.h` can be found in `/path/to/esp-idf/components/wolfssl/include/user_settings.h` diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c index a79ab29e2..04a0f2d38 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c @@ -102,8 +102,13 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event) 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 /* http://esp32.info/docs/esp_idf/html/dd/d08/group__xEventGroupSetBits.html */ xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); break; @@ -123,7 +128,8 @@ void app_main(void) ESP_ERROR_CHECK(nvs_flash_init()); ESP_LOGI(TAG, "Initialize wifi"); -#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1 +#if (ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1) || \ + (ESP_IDF_VERSION_MAJOR > 5) esp_netif_init(); #else tcpip_adapter_init(); diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/Kconfig.projbuild b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/Kconfig.projbuild deleted file mode 100644 index 176d8fb33..000000000 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/Kconfig.projbuild +++ /dev/null @@ -1,15 +0,0 @@ -menu "Example Configuration" - -config WIFI_SSID - string "WiFi SSID" - default "myssid" - help - SSID (network name) for the example to connect to. - -config WIFI_PASSWORD - string "WiFi Password" - default "mypassword" - help - WiFi password (WPA or WPA2) for the example to use. - -endmenu diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c index 5048e9f6e..714f43517 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c @@ -126,7 +126,8 @@ void app_main(void) ESP_LOGI(TAG, "Initialize wifi"); /* TCP/IP adapter initialization */ -#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1 +#if (ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1) || \ + (ESP_IDF_VERSION_MAJOR > 5) esp_netif_init(); #else tcpip_adapter_init(); diff --git a/IDE/Espressif/ESP-IDF/user_settings.h b/IDE/Espressif/ESP-IDF/user_settings.h index 2e6252322..37a9c282f 100644 --- a/IDE/Espressif/ESP-IDF/user_settings.h +++ b/IDE/Espressif/ESP-IDF/user_settings.h @@ -18,6 +18,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#undef WOLFSSL_ESPIDF +#define WOLFSSL_ESPIDF +#define WOLFSSL_ESPWROOM32 +/* Uncomment next line if using Espressif ESP32-WROOM-32SE */ +/* comment the above line #define WOLFSSL_ESPWROOM32 */ +/* #define WOLFSSL_ESPWROOM32SE */ #define BENCH_EMBEDDED #define USE_CERT_BUFFERS_2048 diff --git a/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h b/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h index 827a415d4..05fda0257 100644 --- a/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h +++ b/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h @@ -37,7 +37,9 @@ #include #include "soc/dport_reg.h" #include "soc/hwcrypto_reg.h" +#if ESP_IDF_VERSION_MAJOR < 5 #include "soc/cpu.h" +#endif #if ESP_IDF_VERSION_MAJOR >= 5 #include "esp_private/periph_ctrl.h"