forked from wolfSSL/wolfssl
Merge pull request #3294 from miyazakh/espidf_win
Add setup script for ESP-IDF windows
This commit is contained in:
@@ -16,8 +16,9 @@ Including the following examples:
|
|||||||
|
|
||||||
Note: This expects to use Linux version.
|
Note: This expects to use Linux version.
|
||||||
|
|
||||||
## Setup
|
## Setup for Linux
|
||||||
1. Run *setup.sh* to deploy files into ESP-IDF tree
|
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-idf/components/wolfssl/
|
2. Find Wolfssl files at /path/to/esp-idf/components/wolfssl/
|
||||||
3. Find Example programs under /path/to/esp-idf/examples/protocols/wolfssl_xxx
|
3. Find Example programs under /path/to/esp-idf/examples/protocols/wolfssl_xxx
|
||||||
4. Uncomment out #define WOLFSSL_ESPIDF in /path/to/wolfssl/wolfssl/wolfcrypt/settings.h
|
4. Uncomment out #define WOLFSSL_ESPIDF in /path/to/wolfssl/wolfssl/wolfcrypt/settings.h
|
||||||
@@ -32,4 +33,8 @@ Including the following examples:
|
|||||||
## Support
|
## Support
|
||||||
For question please email [support@wolfssl.com]
|
For question please email [support@wolfssl.com]
|
||||||
|
|
||||||
Note: This is tested with "Ubuntu 18.04.1 LTS" and ESP32-WROOM-32.
|
Note: This is tested with :
|
||||||
|
- OS: Ubuntu 18.04.1 LTS and Microsoft Windows 10 Pro 10.0.19041
|
||||||
|
- ESP-IDF: v4.1 and v4.0.1
|
||||||
|
- Module : ESP32-WROOM-32
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
CONFIG_BENCH_ARGV="-lng 0"
|
CONFIG_BENCH_ARGV="-lng 0"
|
||||||
CONFIG_MAIN_TASK_STACK_SIZE=7000
|
CONFIG_MAIN_TASK_STACK_SIZE=7500
|
||||||
CONFIG_FREERTOS_HZ=1000
|
CONFIG_FREERTOS_HZ=1000
|
||||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=
|
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=
|
||||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#include "esp_idf_version.h"
|
#include "esp_idf_version.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#else
|
#else
|
||||||
#include "esp_event_loop.h"
|
#include "esp_event_loop.h"
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
#include "lwip/netdb.h"
|
#include "lwip/netdb.h"
|
||||||
#include "lwip/apps/sntp.h"
|
#include "lwip/apps/sntp.h"
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include "protocol_examples_common.h"
|
#include "protocol_examples_common.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -53,7 +53,8 @@ static void set_time()
|
|||||||
char strftime_buf[64];
|
char strftime_buf[64];
|
||||||
/* please update the time if seeing unknown failure. */
|
/* please update the time if seeing unknown failure. */
|
||||||
/* this could cause TLS communication failure due to time expiration */
|
/* this could cause TLS communication failure due to time expiration */
|
||||||
utctime.tv_sec = 1567125910; /* dummy time: Fri Aug 30 09:45:00 2019 */
|
/* incleasing 31536000 seconds is close to spend 356 days. */
|
||||||
|
utctime.tv_sec = 1598661910; /* dummy time: Fri Aug 29 09:45:00 2020 */
|
||||||
utctime.tv_usec = 0;
|
utctime.tv_usec = 0;
|
||||||
tz.tz_minuteswest = 0;
|
tz.tz_minuteswest = 0;
|
||||||
tz.tz_dsttime = 0;
|
tz.tz_dsttime = 0;
|
||||||
@@ -122,11 +123,14 @@ void app_main(void)
|
|||||||
ESP_ERROR_CHECK(nvs_flash_init());
|
ESP_ERROR_CHECK(nvs_flash_init());
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Initialize wifi");
|
ESP_LOGI(TAG, "Initialize wifi");
|
||||||
/* TCP/IP adapter initialization */
|
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
||||||
|
esp_netif_init();
|
||||||
|
#else
|
||||||
tcpip_adapter_init();
|
tcpip_adapter_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
(void) wifi_event_handler;
|
(void) wifi_event_handler;
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#include "esp_idf_version.h"
|
#include "esp_idf_version.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#else
|
#else
|
||||||
#include "esp_event_loop.h"
|
#include "esp_event_loop.h"
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
#include "lwip/netdb.h"
|
#include "lwip/netdb.h"
|
||||||
#include "lwip/apps/sntp.h"
|
#include "lwip/apps/sntp.h"
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include "protocol_examples_common.h"
|
#include "protocol_examples_common.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -50,7 +50,8 @@ static void set_time()
|
|||||||
char strftime_buf[64];
|
char strftime_buf[64];
|
||||||
/* please update the time if seeing unknown failure. */
|
/* please update the time if seeing unknown failure. */
|
||||||
/* this could cause TLS communication failure due to time expiration */
|
/* this could cause TLS communication failure due to time expiration */
|
||||||
utctime.tv_sec = 1567125910; /* dummy time: Fri Aug 30 09:45:00 2019 */
|
/* incleasing 31536000 seconds is close to spend 356 days. */
|
||||||
|
utctime.tv_sec = 1598661910; /* dummy time: Fri Aug 29 09:45:00 2020 */
|
||||||
utctime.tv_usec = 0;
|
utctime.tv_usec = 0;
|
||||||
tz.tz_minuteswest = 0;
|
tz.tz_minuteswest = 0;
|
||||||
tz.tz_dsttime = 0;
|
tz.tz_dsttime = 0;
|
||||||
@@ -98,7 +99,7 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
|||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
break;
|
break;
|
||||||
case SYSTEM_EVENT_STA_GOT_IP:
|
case SYSTEM_EVENT_STA_GOT_IP:
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
ESP_LOGI(TAG, "got ip:" IPSTR "\n",
|
ESP_LOGI(TAG, "got ip:" IPSTR "\n",
|
||||||
IP2STR(&event->event_info.got_ip.ip_info.ip));
|
IP2STR(&event->event_info.got_ip.ip_info.ip));
|
||||||
#else
|
#else
|
||||||
@@ -131,7 +132,7 @@ void app_main(void)
|
|||||||
tcpip_adapter_init();
|
tcpip_adapter_init();
|
||||||
#endif
|
#endif
|
||||||
/* */
|
/* */
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
(void) wifi_event_handler;
|
(void) wifi_event_handler;
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
CONFIG_MAIN_TASK_STACK_SIZE=9000
|
CONFIG_MAIN_TASK_STACK_SIZE=10000
|
||||||
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=
|
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=
|
||||||
|
73
IDE/Espressif/ESP-IDF/setup_win.bat
Normal file
73
IDE/Espressif/ESP-IDF/setup_win.bat
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
@echo off
|
||||||
|
REM Expect the script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
|
||||||
|
|
||||||
|
if NOT EXIST "setup.sh" (
|
||||||
|
echo "Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
|
||||||
|
goto exit
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%IDF_PATH%" == "" (
|
||||||
|
echo "Please launch the script from ESP-IDF command prompt."
|
||||||
|
goto exit
|
||||||
|
)
|
||||||
|
|
||||||
|
set SCRIPTDIR=%CD%
|
||||||
|
set BASEDIR=%SCRIPTDIR%\..\..\..\
|
||||||
|
set WOLFSSL_ESPIDFDIR=%BASEDIR%\IDE\Espressif\ESP-IDF
|
||||||
|
set WOLFSSLLIB_TRG_DIR=%IDF_PATH%\components\wolfssl
|
||||||
|
set WOLFSSLEXP_TRG_DIR=%IDF_PATH%\examples\protocols
|
||||||
|
|
||||||
|
echo Copy files into $IDF_PATH%
|
||||||
|
rem Remove/Create directories
|
||||||
|
rmdir /S/Q %WOLFSSLLIB_TRG_DIR%
|
||||||
|
mkdir %WOLFSSLLIB_TRG_DIR%
|
||||||
|
mkdir %WOLFSSLLIB_TRG_DIR%\src
|
||||||
|
mkdir %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
|
||||||
|
mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl
|
||||||
|
mkdir %WOLFSSLLIB_TRG_DIR%\test
|
||||||
|
mkdir %WOLFSSLLIB_TRG_DIR%\include
|
||||||
|
|
||||||
|
rem copying ... files in src/ into $WOLFSSLLIB_TRG_DIR%/src
|
||||||
|
xcopy /Y/Q %BASEDIR%\src\*.c %WOLFSSLLIB_TRG_DIR%\src\
|
||||||
|
xcopy /Y/Q %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
|
||||||
|
xcopy /Y/Q %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
|
||||||
|
xcopy /E/Y/Q %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\
|
||||||
|
xcopy /E/Y/Q %BASEDIR%\wolfcrypt\test\ %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
|
||||||
|
xcopy /E/Y/Q %BASEDIR%\wolfcrypt\benchmark\ %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
|
||||||
|
xcopy /Y/Q %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\
|
||||||
|
xcopy /E/Y/Q %BASEDIR%\wolfssl\wolfcrypt\ %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
|
||||||
|
|
||||||
|
rem user_settings.h
|
||||||
|
xcopy /F/Q %WOLFSSL_ESPIDFDIR%\user_settings.h %WOLFSSLLIB_TRG_DIR%\include\
|
||||||
|
echo F |xcopy /F/Q %WOLFSSL_ESPIDFDIR%\dummy_config_h %WOLFSSLLIB_TRG_DIR%\include\config.h
|
||||||
|
|
||||||
|
rem unit test app
|
||||||
|
xcopy /E/Y/Q %WOLFSSL_ESPIDFDIR%\test %WOLFSSLLIB_TRG_DIR%\test\
|
||||||
|
xcopy /F/Q %WOLFSSL_ESPIDFDIR%\libs\CMakeLists.txt %WOLFSSLLIB_TRG_DIR%\
|
||||||
|
xcopy /F/Q %WOLFSSL_ESPIDFDIR%\libs\component.mk %WOLFSSLLIB_TRG_DIR%\
|
||||||
|
|
||||||
|
rem Benchmark program
|
||||||
|
rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
|
||||||
|
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
|
||||||
|
xcopy /F/Q %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
|
||||||
|
xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
|
||||||
|
|
||||||
|
rem Crypt Test program
|
||||||
|
rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_test\
|
||||||
|
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
|
||||||
|
xcopy /F/Q %BASEDIR%\wolfcrypt\test\test.c %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
|
||||||
|
xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_test %WOLFSSLEXP_TRG_DIR%\wolfssl_test\
|
||||||
|
|
||||||
|
rem TLS Client program
|
||||||
|
rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
|
||||||
|
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\main\
|
||||||
|
xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_client %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
|
||||||
|
|
||||||
|
rem TLS Server program
|
||||||
|
rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
|
||||||
|
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\main\
|
||||||
|
xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_server %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
|
||||||
|
|
||||||
|
:exit
|
||||||
|
echo completed
|
||||||
|
|
@@ -1,3 +1,5 @@
|
|||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_MAIN_DRIVER -DWOLFSSL_USER_SETTINGS")
|
||||||
|
|
||||||
set(COMPONENT_SRCDIRS ".")
|
set(COMPONENT_SRCDIRS ".")
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ The test contains of wolfSSL unit-test app on Unity.
|
|||||||
When you want to run the app
|
When you want to run the app
|
||||||
1. Copy *test.c* file at /path/to/esp-idf/components/wolfssl/wolfcrypt/test/ folder to the wolfssl/test folder
|
1. Copy *test.c* file at /path/to/esp-idf/components/wolfssl/wolfcrypt/test/ folder to the wolfssl/test folder
|
||||||
2. Go to /esp-idf/tools/unit-test-app/ folder
|
2. Go to /esp-idf/tools/unit-test-app/ folder
|
||||||
3. "make menuconfig" to configure unit test app.
|
3. "idf.py menuconfig" to configure unit test app.
|
||||||
4. "make TEST_COMPONENTS=wolfssl" to build wolfssl unit test app.
|
4. "idf.py -T wolfssl build" to build wolfssl unit test app.
|
||||||
|
|
||||||
See [https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/unit-tests.html] for more information about unit test app.
|
See [https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/unit-tests.html] for more information about unit test app.
|
||||||
|
@@ -36,3 +36,4 @@ include IDE/XilinxSDK/include.am
|
|||||||
|
|
||||||
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif IDE/zephyr
|
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif IDE/zephyr
|
||||||
EXTRA_DIST+= IDE/OPENSTM32/README.md
|
EXTRA_DIST+= IDE/OPENSTM32/README.md
|
||||||
|
EXTRA_DIST+= IDE/Espressif/ESP-IDF/setup_win.bat
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
#include "soc/hwcrypto_reg.h"
|
#include "soc/hwcrypto_reg.h"
|
||||||
#include "soc/cpu.h"
|
#include "soc/cpu.h"
|
||||||
#include "driver/periph_ctrl.h"
|
#include "driver/periph_ctrl.h"
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include <esp32/rom/ets_sys.h>
|
#include <esp32/rom/ets_sys.h>
|
||||||
#else
|
#else
|
||||||
#include <rom/ets_sys.h>
|
#include <rom/ets_sys.h>
|
||||||
@@ -55,7 +55,7 @@ int esp_CryptHwMutexUnLock(wolfSSL_Mutex* mutex);
|
|||||||
|
|
||||||
#ifndef NO_AES
|
#ifndef NO_AES
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include "esp32/rom/aes.h"
|
#include "esp32/rom/aes.h"
|
||||||
#else
|
#else
|
||||||
#include "rom/aes.h"
|
#include "rom/aes.h"
|
||||||
@@ -89,7 +89,7 @@ uint64_t wc_esp32elapsedTime();
|
|||||||
|
|
||||||
/* RAW hash function APIs are not implemented with esp32 hardware acceleration*/
|
/* RAW hash function APIs are not implemented with esp32 hardware acceleration*/
|
||||||
#define WOLFSSL_NO_HASH_RAW
|
#define WOLFSSL_NO_HASH_RAW
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include "esp32/rom/sha.h"
|
#include "esp32/rom/sha.h"
|
||||||
#else
|
#else
|
||||||
#include "rom/sha.h"
|
#include "rom/sha.h"
|
||||||
|
Reference in New Issue
Block a user