Browse Source

fix build failures

update README to follow the latest ESP-IDF
Hideki Miyazaki 2 years ago
parent
commit
a25c338007

+ 2 - 3
IDE/Espressif/ESP-IDF/README.md

@@ -40,6 +40,5 @@ Including the following examples:
 
  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.1 and v4.0.1  
-   - Module : ESP32-WROOM-32
-
+   - ESP-IDF: v4.4-dev-4031-gef98a363e3-dirty and v4.0.1-dirty 
+   - Module : ESP32-WROOM-32

+ 25 - 0
IDE/Espressif/ESP-IDF/dummy_test_paths.h

@@ -0,0 +1,25 @@
+/* wolfcrypt/test/test_paths.h
+ *
+ * Copyright (C) 2006-2021 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 NO_FILESYSTEM
+    #define CERT_PREFIX "@abs_top_srcdir@/"
+    #define CERT_WRITE_TEMP_DIR "@abs_top_builddir@/"
+#endif /* NO_FILESYSTEM */

+ 4 - 4
IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md

@@ -1,8 +1,8 @@
-#wolfSSL Example
+# wolfSSL Benchmark Example
 
 The Example contains of wolfSSL benchmark program.
 
-1. "make menuconfig" to configure the program.  
+1. `idf.py menuconfig` to configure the program.  
     1-1. Example Configuration ->
 
     BENCH_ARG : argument that you want to use. Default is "-lng 0"  
@@ -10,7 +10,7 @@ The Example contains of wolfSSL benchmark program.
 
 When you want to run the benchmark program
 
-1. "make flash" to compile and load the firmware
-2. "make monitor" to see the message
+1. `idf.py -p <PORT> flash` to compile and load the firmware
+2. `idf.py monitor` to see the message
 
 See the README.md file in the upper level 'examples' directory for more information about examples.

+ 1 - 0
IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c

@@ -23,6 +23,7 @@
 #include <string.h>
 
 #include <wolfssl/wolfcrypt/settings.h>
+#include <wolfssl/wolfcrypt/types.h>
 #include <wolfcrypt/benchmark/benchmark.h>
 
 #include "sdkconfig.h"

+ 11 - 6
IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md

@@ -2,21 +2,26 @@
 
 The Example contains of wolfSSL tls client demo.
 
-1. "make menuconfig" to config the project  
-    1-1. Example Configuration ->
+1. `idf.py menuconfig` to config the project
+
+      1-1. Example Configuration ->  
 
-          WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid")  
-          WIFI Password: WIFI password, and default is "mypassword"  
           Target host ip address : the host that you want to connect to.(default is 127.0.0.1)
+
+     1-2. Example Connection Configuration ->
+     
+          WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid")  
+          WIFI Password: WIFI password, and default is "mypassword"
+    
     
     Note: the example program uses 11111 port. If you want to use different port  
         , you need to modify DEFAULT_PORT definition in the code.
 
 When you want to test the wolfSSL client
 
-1. "make flash monitor" to load the firmware and see the context  
+1. `idf.py -p <PORT> flash` and then `idf.py monitor` to load the firmware and see the context  
 2. You can use <wolfssl>/examples/server/server program for test.  
 
-         e.g. Launch ./examples/server/server -v 4 -b -i
+         e.g. Launch ./examples/server/server -v 4 -b -i -d
 
 See the README.md file in the upper level 'examples' directory for more information about examples.

+ 0 - 12
IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/Kconfig.projbuild

@@ -1,17 +1,5 @@
 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.
-
 config TARGET_HOST
     string "Target host"
     default "127.0.01.1"

+ 6 - 6
IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md

@@ -1,17 +1,18 @@
-#wolfSSL Example
+# wolfSSL Server Example
 
 The Example contains a wolfSSL simple server.
 
-1. "make menuconfigure" to configure the project
+1. `idf.py menuconfigure` to configure the project
 
-    1-1. Example Configuration ->
+    1-1. Example Connection Configuration ->
+    
            WIFI SSID : your own WIFI, which is connected to the Internet.(default is "myssid")  
            WIFI Password : WIFI password, and default is "mypassword"
 
 When you want to test the wolfSSL simple server demo
 
-1. "make flash" to compile the code and load the firmware
-2. "make monitor" to see the context. The assigned IP address can be found in output message.
+1. `idf.py -p <PORT> flash` to compile the code and load the firmware
+2. `idf.py monitor` to see the context. The assigned IP address can be found in output message.
 3. Once the server connects to the wifi, it is waiting for client request.  
     ("Waiting for a connection..." message will be displayed.)
    
@@ -19,4 +20,3 @@ When you want to test the wolfSSL simple server demo
     e.g ./example/client/client -h xx.xx.xx
 
 See the README.md file in the upper level 'examples' directory for more information about examples.
-

+ 4 - 4
IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md

@@ -1,10 +1,10 @@
-#wolfSSL Example
+# wolfSSL Crypt Test Example
 
 The Example contains of wolfSSL test program.
 
 When you want to run the benchmark program
-1. "make menuconfig" to configure the program,first
-2. "make flash" to compile and load the firmware
-3. "make monitor" to see the message
+1. `idf.py menuconfig` to configure the program,first
+2. `idf.py build` to compile and `idf.py -p <PORT> flash` to load the firmware
+3. `idf.py monitor` to see the message
 
 See the README.md file in the upper level 'examples' directory for more information about examples.

+ 16 - 6
IDE/Espressif/ESP-IDF/libs/CMakeLists.txt

@@ -16,12 +16,22 @@ set(COMPONENT_SRCDIRS "./src/"
 
 set(COMPONENT_REQUIRES lwip)
 
-set(COMPONENT_ADD_INCLUDEDIRS
-    "."
-    "./include"
-    "../freertos/include/freertos" 
-    "${WOLFSSL_ROOT}"
-    )
+if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/)
+    set(COMPONENT_ADD_INCLUDEDIRS
+        "."
+        "./include"
+        "../freertos/FreeRTOS-Kernel/include/freertos"
+       "${WOLFSSL_ROOT}"
+       )
+else()
+
+   set(COMPONENT_ADD_INCLUDEDIRS
+       "."
+       "./include"
+       "../freertos/include/freertos"
+       "${WOLFSSL_ROOT}"
+      )
+endif()
 
 if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib)
     list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib")

+ 4 - 0
IDE/Espressif/ESP-IDF/setup.sh

@@ -58,6 +58,7 @@ ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/src
 ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt
 ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src
 ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl
+${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl/openssl
 ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/test
 ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/include
 
@@ -76,9 +77,12 @@ ${CPDCMD} ./src/*.c ${WOLFSSLLIB_TRG_DIR}/src/
 ${CPDCMD} -r ./wolfcrypt/src/*.{c,i} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/
 ${CPDCMD} -r ./wolfcrypt/src/port  ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/port/
 ${CPDCMD} -r ./wolfcrypt/test ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/
+# Copy dummy test_paths.h to handle the case configure hasn't yet executed 
+${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/dummy_test_paths.h ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/test/test_paths.h 
 ${CPDCMD} -r ./wolfcrypt/benchmark ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/
 
 ${CPDCMD} -r ./wolfssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/
+${CPDCMD} -r ./wolfssl/openssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/openssl/
 ${CPDCMD} -r ./wolfssl/wolfcrypt ${WOLFSSLLIB_TRG_DIR}/wolfssl/
 
 # user_settings.h

+ 9 - 4
IDE/Espressif/ESP-IDF/setup_win.bat

@@ -17,13 +17,14 @@ 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%
+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%\wolfssl\openssl
 mkdir      %WOLFSSLLIB_TRG_DIR%\test
 mkdir      %WOLFSSLLIB_TRG_DIR%\include
 
@@ -33,8 +34,12 @@ 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\
+rem Copy dummy test_paths.h to handle the case configure hasn't yet executed 
+echo F |xcopy /E/Y %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h
+xcopy /E/Y/Q %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLIB_TRG_DIR%\wolfcrypt\test\test_paths.h
 xcopy /E/Y/Q %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
 xcopy /Y/Q %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\
+xcopy /Y/Q %BASEDIR%\wolfssl\openssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\
 xcopy /E/Y/Q %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
 
 rem user_settings.h
@@ -50,11 +55,11 @@ rem Benchmark program
 rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
 mkdir      %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
 
-xcopy      %BASEDIR%\wolfcrypt\benchmark\benchmark.h  %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h
-xcopy      %BASEDIR%\wolfcrypt\benchmark\benchmark.c  %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c
+echo F |xcopy /E/Y %BASEDIR%\wolfcrypt\benchmark\benchmark.h  %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h
+echo F |xcopy /E/Y %BASEDIR%\wolfcrypt\benchmark\benchmark.c  %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c
 
 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\
+xcopy /E/F/Q/Y %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
 
 rem Crypt Test program
 rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_test\

+ 2 - 2
IDE/Espressif/ESP-IDF/test/README.md

@@ -4,7 +4,7 @@ The test contains of wolfSSL unit-test app on Unity.
 
 When you want to run the app  
 1. Go to /esp-idf/tools/unit-test-app/ folder  
-2. "idf.py menuconfig" to configure unit test app.  
-3. "idf.py -T wolfssl build" to build wolfssl unit test app.  
+2. `idf.py menuconfig` to configure unit test app.  
+3. `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.

+ 9 - 3
wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h

@@ -38,11 +38,17 @@
 #include "soc/dport_reg.h"
 #include "soc/hwcrypto_reg.h"
 #include "soc/cpu.h"
-#include "driver/periph_ctrl.h"
+
+#if ESP_IDF_VERSION_MAJOR >= 5
+ #include "esp_private/periph_ctrl.h"
+#else
+ #include "driver/periph_ctrl.h"
+#endif
+
 #if ESP_IDF_VERSION_MAJOR >= 4
-#include <esp32/rom/ets_sys.h>
+ #include <esp32/rom/ets_sys.h>
 #else
-#include <rom/ets_sys.h>
+ #include <rom/ets_sys.h>
 #endif
 
 #ifdef __cplusplus