From b2037266234688231f43997dd551a31b9fa86e46 Mon Sep 17 00:00:00 2001
From: gojimmypi <13059545+gojimmypi@users.noreply.github.com>
Date: Mon, 28 Mar 2022 11:54:50 -0700
Subject: [PATCH 1/4] Overhaul Espressif ESP-IDF wolfSSL setup_win.bat
# Description
This is a replacement to https://github.com/wolfSSL/wolfssl/pull/4989, per the [comment](https://github.com/wolfSSL/wolfssl/pull/4989#issuecomment-1080998040)
Overhauled `win_setup.bat` for more robust and flexible install of wolfSSL to ESP-IDF `component` directory.
Functionally, there are no significant changes. However this version:
- more verbose output
- show directories used
- more error checking
- check for existing wolfSSL component; prompt to purge or update
- save and optionally re-use `config.h` and `user_settings.h`
- optionally target an alternate ESP-IDF path (useful for VisualGDB)
- offer tips and reminders upon completion
# Testing
Tested on Windows 10 with both ESP-IDF command prompt and stand-alone DOS prompt (e.g. for VisualGDB)
# Checklist
- [ ] added tests
- [ ] updated/added doxygen
- [ ] updated appropriate READMEs
- [ ] Updated manual and documentation
cc: @dgarske
---
IDE/Espressif/ESP-IDF/setup_win.bat | 379 ++++++++++++++++++++++++----
1 file changed, 323 insertions(+), 56 deletions(-)
diff --git a/IDE/Espressif/ESP-IDF/setup_win.bat b/IDE/Espressif/ESP-IDF/setup_win.bat
index 158a1846c..9902b71ed 100644
--- a/IDE/Espressif/ESP-IDF/setup_win.bat
+++ b/IDE/Espressif/ESP-IDF/setup_win.bat
@@ -1,82 +1,349 @@
@echo off
REM Expect the script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
+::******************************************************************************************************
+::******************************************************************************************************
+echo;
+echo wolfSSL Windows Setup.
+echo;
+echo This utility will copy a static snapshot of wolfSSL files to the ESP32-IDF component directory.
+echo;
+echo If you wish to keep your component library fresh with git pull, consider hard link with mklink.
+echo;
+echo "mklink [[/d] | [/h] | [/j]] "
+echo;
+::******************************************************************************************************
+::******************************************************************************************************
+
+:: if there's a setup.sh, we are probably starting in the right place.
if NOT EXIST "setup.sh" (
- echo "Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
- goto exit
+ echo Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
+ goto :ERR
)
-if "%IDF_PATH%" == "" (
- echo "Please launch the script from ESP-IDF command prompt."
- goto exit
+:: if there's also a default user_settings.h, we are very likely starting in the right place.
+if NOT EXIST "user_settings.h" (
+ echo Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
+ goto :ERR
)
+:: see if there was a parameter passed for a specific EDP-IDF directory
+:: this may be different than the standard ESP-IDF environment (e.g. VisualGDB)
+if not "%1" == "" (
+ if not exist "%1" (
+ echo "ERROR: optional directory was specified, but not found: %1"
+ goto :ERR
+ )
+
+ SET IDF_PATH=%1
+ echo Using specified IDF_PATH: %IDF_PATH%
+)
+
+:: if no IDF_PATH is found, we don't know what to do. Go exit with error.
+if "%IDF_PATH%" == "" (
+ echo Please launch the script from ESP-IDF command prompt,
+ echo or set your desired IDF_PATH environment variable,
+ echo or pass a parameter to your directory, such as for VisualGDB with ESP-IDF 4.4:
+ echo;
+ echo .\setup_win.bat C:\SysGCC\esp32\esp-idf\v4.4
+ echo;
+ goto :ERR
+)
+
+:: Here we go!
+:: setup some path variables
+echo;
+
set SCRIPTDIR=%CD%
-set BASEDIR=%SCRIPTDIR%\..\..\..\
+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%\wolfssl\openssl
-mkdir %WOLFSSLLIB_TRG_DIR%\test
-mkdir %WOLFSSLLIB_TRG_DIR%\include
+echo Using SCRIPTDIR = %SCRIPTDIR%
+echo Using BASEDIR = %BASEDIR%
+echo Using WOLFSSL_ESPIDFDIR = %WOLFSSL_ESPIDFDIR%
+echo Using WOLFSSLLIB_TRG_DIR = %WOLFSSLLIB_TRG_DIR%
+echo Using WOLFSSLEXP_TRG_DIR = %WOLFSSLEXP_TRG_DIR%
+
+echo;
+echo Equivalalent destination path:
+dir %WOLFSSL_ESPIDFDIR%\*.xyzzy 2> nul | findstr \
+
+echo;
+echo Equivalalent source directory paths:
+:: show the path of the equivalent %VALUE% (search for files that don't exist, supress error, and look for string with "\")
+dir %BASEDIR%\*.xyzzy 2> nul | findstr \
+dir %WOLFSSLLIB_TRG_DIR%\*.xyzzy 2> nul | findstr \
+dir %WOLFSSLEXP_TRG_DIR%\*.xyzzy 2> nul | findstr \
+
+:: set the FileStamp variable to the current date: YYMMYY_HHMMSS
+:: the simplest method, to use existing TIME ad DATE variables:
+:: date = Thu 09/17/2015
+:: time = 11:13:15.47
+:: 012345678901234567890
+::
+:: There is no leading zero for single digit hours (e.g. 9:00am), so we need to manually include the zero
+:: here |
+if "%TIME:~0,1%" == " " set FileStamp=%DATE:~12,2%%DATE:~7,2%%DATE:~4,2%_0%TIME:~1,1%%TIME:~3,2%%TIME:~6,2%
+
+:: otherwise, if a space not found before the digit, it is a 2 digit hour, so no extract zero is needed
+if NOT "%TIME:~0,1%" == " " set FileStamp=%DATE:~12,2%%DATE:~7,2%%DATE:~4,2%_%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
+
+:: Backup existing user settings
+if exist %WOLFSSLLIB_TRG_DIR%\include\config.h (
+ echo;
+ echo Saving: %WOLFSSLLIB_TRG_DIR%\include\config.h
+ echo to: %SCRIPTDIR%\config_h_%FileStamp%.bak
+ copy %WOLFSSLLIB_TRG_DIR%\include\config.h %SCRIPTDIR%\config_h_%FileStamp%.bak
+ echo;
+)
+
+if exist %WOLFSSL_ESPIDFDIR%\user_settings.h (
+ echo Saving: %WOLFSSLLIB_TRG_DIR%\include\user_settings.h
+ echo to: %SCRIPTDIR%\user_settings_h_%FileStamp%.bak
+ copy %WOLFSSLLIB_TRG_DIR%\include\user_settings.h %SCRIPTDIR%\user_settings_h_%FileStamp%.bak
+ echo;
+)
+
+
+:: do we really want to erase existing user config?
+if exist %WOLFSSLLIB_TRG_DIR% (
+ echo;
+ echo WARNING: Existing files found in %WOLFSSLLIB_TRG_DIR%
+ echo;
+
+ :: clear any prior errorlevel
+ call;
+ choice /c YN /m "Delete files and proceed with install in %WOLFSSLLIB_TRG_DIR% "
+ if errorlevel 2 GOTO :NODELETE
+ GOTO :PURGE
+
+
+echo;
+echo Ready to copy files into %IDF_PATH%
+
+
+::******************************************************************************************************
+:NODELETE
+::******************************************************************************************************
+ :: clear any prior errorlevel
+ echo;
+ call;
+ choice /c YN /m "Refresh files %WOLFSSLLIB_TRG_DIR% (there will be a prompt to keep or overwrite user_settings and config) "
+ if errorlevel 2 GOTO :NOCOPY
+ GOTO :REFRESH
+)
+
+
+::******************************************************************************************************
+:PURGE
+::******************************************************************************************************
+:: purge existing directory
+
+if exist %WOLFSSLLIB_TRG_DIR% (
+ echo;
+ echo Removing %WOLFSSLLIB_TRG_DIR%
+ rmdir %WOLFSSLLIB_TRG_DIR% /S /Q
+ echo;
+) else (
+ echo;
+ echo Prior %WOLFSSLLIB_TRG_DIR% not found, installing fresh.
+ echo;
+)
+
+::******************************************************************************************************
+:REFRESH
+::******************************************************************************************************
+if not exist %WOLFSSLLIB_TRG_DIR% mkdir %WOLFSSLLIB_TRG_DIR%
+if not exist %WOLFSSLLIB_TRG_DIR%\src mkdir %WOLFSSLLIB_TRG_DIR%\src
+if not exist %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src mkdir %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
+if not exist %WOLFSSLLIB_TRG_DIR%\wolfssl mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl
+if not exist %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl
+if not exist %WOLFSSLLIB_TRG_DIR%\test mkdir %WOLFSSLLIB_TRG_DIR%\test
+if not exist %WOLFSSLLIB_TRG_DIR%\include 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\
+echo;
+echo Copying files to %WOLFSSLLIB_TRG_DIR%\src\
+xcopy %BASEDIR%\src\*.c %WOLFSSLLIB_TRG_DIR%\src\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
+
+echo;
+echo Copying src\*.c files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
+xcopy %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
+
+echo;
+echo Copying src\*.i files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
+xcopy %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
+
+echo;
+echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\
+xcopy %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\ /S /E /Q /Y
+
+echo;
+echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
+xcopy %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\ /S /E /Q /Y
+
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\
+echo F |xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
+xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
-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
+echo;
+echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
+xcopy %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\ /S /E /Q /Y
-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%\
+echo;
+echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\
+xcopy %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\ /S /E /Q /Y
-rem Benchmark program
-rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
-mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
+echo;
+echo Copying files to%WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\
+xcopy %BASEDIR%\wolfssl\openssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\ /S /E /Q /Y
-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
+echo;
+echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
+xcopy %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\ /S /E /Q /Y
-xcopy /F/Q %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
-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\
-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\
+::******************************************************************************************************
+:: user_settings and config defaults
+::******************************************************************************************************
+:: user_settings.h (default, may be overwritten by prior file)
+echo;
+echo Copying default user_settings.h to %WOLFSSLLIB_TRG_DIR%\include\
+xcopy %WOLFSSL_ESPIDFDIR%\user_settings.h %WOLFSSLLIB_TRG_DIR%\include\ /F
-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\
+:: echo Creating new config file: %WOLFSSLLIB_TRG_DIR%\include\config.h (default, may be overwritten by prior file)
+echo new config > %WOLFSSLLIB_TRG_DIR%\include\config.h
+xcopy %WOLFSSL_ESPIDFDIR%\dummy_config_h. %WOLFSSLLIB_TRG_DIR%\include\config.h /F /Y
-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
+:: Check if operator wants to keep prior config.h
+if EXIST config_h_%FileStamp%.bak (
+ echo;
+ :: clear any prior errorlevel
+ call;
+ choice /c YN /m "Use your prior config.h "
+ if errorlevel 2 GOTO :NO_CONFIG_RESTORE
+ xcopy config_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\config.h /Y
+) else (
+ echo;
+ echo Prior config.h not found. Using default file.
+)
+::******************************************************************************************************
+:NO_CONFIG_RESTORE
+::******************************************************************************************************
+
+:: Check if operator wants to keep prior config.h
+if EXIST user_settings_h_%FileStamp%.bak (
+ echo;
+ :: clear any prior errorlevel
+ call;
+ choice /c YN /m "User your prior user_settings.h "
+ if errorlevel 2 GOTO :NO_USER_SETTINGS_RESTORE
+ xcopy user_settings_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\user_settings.h /Y
+
+) else (
+ echo;
+ echo Prior user_settings.h not found. Using default file.
+)
+
+::******************************************************************************************************
+:NO_USER_SETTINGS_RESTORE
+::******************************************************************************************************
+
+
+:: unit test app
+echo;
+echo Copying unit files to %WOLFSSLLIB_TRG_DIR%\test\
+xcopy %WOLFSSL_ESPIDFDIR%\test %WOLFSSLLIB_TRG_DIR%\test\ /S /E /Q /Y
+
+echo;
+echo Copying CMakeLists.txt to %WOLFSSLLIB_TRG_DIR%\
+xcopy %WOLFSSL_ESPIDFDIR%\libs\CMakeLists.txt %WOLFSSLLIB_TRG_DIR%\ /F
+
+echo;
+echo Copying component.mk to %WOLFSSLLIB_TRG_DIR%\
+xcopy %WOLFSSL_ESPIDFDIR%\libs\component.mk %WOLFSSLLIB_TRG_DIR%\ /F
+
+:: Benchmark program
+echo;
+echo Removing %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
+rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /S /Q
+
+echo;
+echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
+mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
+xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.h %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h /F /Y
+xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c /F /Y
+xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\ /F /Y
+
+xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /Q /Y
+
+:: Crypt Test program
+echo;
+echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_test\
+rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /Q
+mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
+
+xcopy %BASEDIR%\wolfcrypt\test\test.c %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\ /S /E /Q /Y
+xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_test %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /E /Q /Y
+
+:: TLS Client program
+echo;
+echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
+rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /Q
+mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\main\
+
+xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_client %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /E /Q /Y
+
+:: TLS Server program
+echo;
+echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
+rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /Q
+mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\main\
+
+xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_server %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /E /Q /Y
+
+goto :DONE
+
+:: error during copy encountered
+::******************************************************************************************************
+:COPYERR
+::******************************************************************************************************
+echo;
+echo Error during copy.
+goto :ERR
+
+:: abort at user request
+::******************************************************************************************************
+:NOCOPY
+::******************************************************************************************************
+echo;
+echo Setup did not copy any files.
+goto :ERR
+
+:: ERROR
+::******************************************************************************************************
+:ERR
+::******************************************************************************************************
+exit /B 1
+
+:: Success
+::******************************************************************************************************
+:DONE
+::******************************************************************************************************
+echo;
+echo;
+echo Edit config file in "%WOLFSSLLIB_TRG_DIR%\include\user_settings.h" before trying to compile.
+echo;
+echo See Component files for wolfSSL in %WOLFSSLLIB_TRG_DIR%
+echo;
+echo See additional examples at https://github.com/wolfSSL/wolfssl-examples
+echo;
+echo REMINDER: Ensure any wolfSSL #include definitions occur BEFORE include files in your source code.
+echo;
+echo setup_win.bat for ESP-IDF completed.
From d287863a35537f6a217b8dde4121b4083b6fe469 Mon Sep 17 00:00:00 2001
From: gojimmypi <13059545+gojimmypi@users.noreply.github.com>
Date: Tue, 29 Mar 2022 12:52:50 -0700
Subject: [PATCH 2/4] Update setup_win.bat
more copy error checking. remove trailing whitespace.
---
IDE/Espressif/ESP-IDF/setup_win.bat | 86 +++++++++++++++++++++--------
1 file changed, 62 insertions(+), 24 deletions(-)
diff --git a/IDE/Espressif/ESP-IDF/setup_win.bat b/IDE/Espressif/ESP-IDF/setup_win.bat
index 9902b71ed..ca81346d1 100644
--- a/IDE/Espressif/ESP-IDF/setup_win.bat
+++ b/IDE/Espressif/ESP-IDF/setup_win.bat
@@ -4,7 +4,7 @@ REM Expect the script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
::******************************************************************************************************
::******************************************************************************************************
echo;
-echo wolfSSL Windows Setup.
+echo wolfSSL Windows Setup. Version 1.0a
echo;
echo This utility will copy a static snapshot of wolfSSL files to the ESP32-IDF component directory.
echo;
@@ -16,13 +16,13 @@ echo;
::******************************************************************************************************
:: if there's a setup.sh, we are probably starting in the right place.
-if NOT EXIST "setup.sh" (
+if NOT EXIST "setup.sh" (
echo Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
goto :ERR
)
:: if there's also a default user_settings.h, we are very likely starting in the right place.
-if NOT EXIST "user_settings.h" (
+if NOT EXIST "user_settings.h" (
echo Please run this script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
goto :ERR
)
@@ -50,7 +50,7 @@ if "%IDF_PATH%" == "" (
goto :ERR
)
-:: Here we go!
+:: Here we go!
:: setup some path variables
echo;
@@ -93,14 +93,14 @@ if NOT "%TIME:~0,1%" == " " set FileStamp=%DATE:~12,2%%DATE:~7,2%%DATE:~4,2%_%T
:: Backup existing user settings
if exist %WOLFSSLLIB_TRG_DIR%\include\config.h (
echo;
- echo Saving: %WOLFSSLLIB_TRG_DIR%\include\config.h
+ echo Saving: %WOLFSSLLIB_TRG_DIR%\include\config.h
echo to: %SCRIPTDIR%\config_h_%FileStamp%.bak
copy %WOLFSSLLIB_TRG_DIR%\include\config.h %SCRIPTDIR%\config_h_%FileStamp%.bak
echo;
)
if exist %WOLFSSL_ESPIDFDIR%\user_settings.h (
- echo Saving: %WOLFSSLLIB_TRG_DIR%\include\user_settings.h
+ echo Saving: %WOLFSSLLIB_TRG_DIR%\include\user_settings.h
echo to: %SCRIPTDIR%\user_settings_h_%FileStamp%.bak
copy %WOLFSSLLIB_TRG_DIR%\include\user_settings.h %SCRIPTDIR%\user_settings_h_%FileStamp%.bak
echo;
@@ -144,7 +144,15 @@ echo Ready to copy files into %IDF_PATH%
if exist %WOLFSSLLIB_TRG_DIR% (
echo;
echo Removing %WOLFSSLLIB_TRG_DIR%
- rmdir %WOLFSSLLIB_TRG_DIR% /S /Q
+ rmdir %WOLFSSLLIB_TRG_DIR% /S /Q
+ if exist %WOLFSSLLIB_TRG_DIR% (
+ echo;
+ echo ERROR: Failed to remove %WOLFSSLLIB_TRG_DIR%
+ echo;
+ echo Check permissions, open files, read-only attributes, etc.
+ echo;
+ GOTO :ERR
+ )
echo;
) else (
echo;
@@ -173,38 +181,47 @@ if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying src\*.c files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying src\*.i files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\
xcopy %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
xcopy %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
-rem Copy dummy test_paths.h to handle the case configure hasn't yet executed
+rem Copy dummy test_paths.h to handle the case configure hasn't yet executed
echo F |xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
xcopy %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\
xcopy %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to%WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\
xcopy %BASEDIR%\wolfssl\openssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
xcopy %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
::******************************************************************************************************
@@ -214,10 +231,12 @@ xcopy %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR
echo;
echo Copying default user_settings.h to %WOLFSSLLIB_TRG_DIR%\include\
xcopy %WOLFSSL_ESPIDFDIR%\user_settings.h %WOLFSSLLIB_TRG_DIR%\include\ /F
+if %errorlevel% NEQ 0 GOTO :COPYERR
:: echo Creating new config file: %WOLFSSLLIB_TRG_DIR%\include\config.h (default, may be overwritten by prior file)
echo new config > %WOLFSSLLIB_TRG_DIR%\include\config.h
xcopy %WOLFSSL_ESPIDFDIR%\dummy_config_h. %WOLFSSLLIB_TRG_DIR%\include\config.h /F /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
:: Check if operator wants to keep prior config.h
@@ -228,6 +247,7 @@ if EXIST config_h_%FileStamp%.bak (
choice /c YN /m "Use your prior config.h "
if errorlevel 2 GOTO :NO_CONFIG_RESTORE
xcopy config_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\config.h /Y
+ if %errorlevel% NEQ 0 GOTO :COPYERR
) else (
echo;
@@ -245,10 +265,11 @@ if EXIST user_settings_h_%FileStamp%.bak (
choice /c YN /m "User your prior user_settings.h "
if errorlevel 2 GOTO :NO_USER_SETTINGS_RESTORE
xcopy user_settings_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\user_settings.h /Y
+ if %errorlevel% NEQ 0 GOTO :COPYERR
) else (
echo;
- echo Prior user_settings.h not found. Using default file.
+ echo Prior user_settings.h not found. Using default file.
)
::******************************************************************************************************
@@ -259,54 +280,69 @@ if EXIST user_settings_h_%FileStamp%.bak (
:: unit test app
echo;
echo Copying unit files to %WOLFSSLLIB_TRG_DIR%\test\
-xcopy %WOLFSSL_ESPIDFDIR%\test %WOLFSSLLIB_TRG_DIR%\test\ /S /E /Q /Y
+xcopy %WOLFSSL_ESPIDFDIR%\test %WOLFSSLLIB_TRG_DIR%\test\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying CMakeLists.txt to %WOLFSSLLIB_TRG_DIR%\
-xcopy %WOLFSSL_ESPIDFDIR%\libs\CMakeLists.txt %WOLFSSLLIB_TRG_DIR%\ /F
+xcopy %WOLFSSL_ESPIDFDIR%\libs\CMakeLists.txt %WOLFSSLLIB_TRG_DIR%\ /F
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying component.mk to %WOLFSSLLIB_TRG_DIR%\
xcopy %WOLFSSL_ESPIDFDIR%\libs\component.mk %WOLFSSLLIB_TRG_DIR%\ /F
+if %errorlevel% NEQ 0 GOTO :COPYERR
:: Benchmark program
echo;
echo Removing %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
-rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /S /Q
+rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /S /Q
+if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
-xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.h %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h /F /Y
-xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c /F /Y
-xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\ /F /Y
+xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.h %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h /F /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
-xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /Q /Y
+xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c /F /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
+
+xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\ /F /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
+
+xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
:: Crypt Test program
echo;
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_test\
-rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /Q
+rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
-xcopy %BASEDIR%\wolfcrypt\test\test.c %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\ /S /E /Q /Y
+xcopy %BASEDIR%\wolfcrypt\test\test.c %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
+
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_test %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
:: TLS Client program
echo;
-echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
-rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /Q
+echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_client\
+rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\main\
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_client %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
:: TLS Server program
echo;
-echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
-rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /Q
+echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_server\
+rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\main\
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_server %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /E /Q /Y
+if %errorlevel% NEQ 0 GOTO :COPYERR
goto :DONE
@@ -316,6 +352,8 @@ goto :DONE
::******************************************************************************************************
echo;
echo Error during copy.
+echo
+echo Please ensure none of the target files are flagged as read-only, open, etc.
goto :ERR
:: abort at user request
@@ -326,7 +364,7 @@ echo;
echo Setup did not copy any files.
goto :ERR
-:: ERROR
+:: ERROR
::******************************************************************************************************
:ERR
::******************************************************************************************************
@@ -346,4 +384,4 @@ echo See additional examples at https://github.com/wolfSSL/wolfssl-examples
echo;
echo REMINDER: Ensure any wolfSSL #include definitions occur BEFORE include files in your source code.
echo;
-echo setup_win.bat for ESP-IDF completed.
+echo setup_win.bat for ESP-IDF completed.
From d72d28ac60054ace2f738d952450a4b011a44ec2 Mon Sep 17 00:00:00 2001
From: gojimmypi <13059545+gojimmypi@users.noreply.github.com>
Date: Tue, 29 Mar 2022 15:39:09 -0700
Subject: [PATCH 3/4] copy errors are now only warnings
---
IDE/Espressif/ESP-IDF/setup_win.bat | 128 +++++++++++++++-------------
1 file changed, 68 insertions(+), 60 deletions(-)
diff --git a/IDE/Espressif/ESP-IDF/setup_win.bat b/IDE/Espressif/ESP-IDF/setup_win.bat
index ca81346d1..4b514a6f9 100644
--- a/IDE/Espressif/ESP-IDF/setup_win.bat
+++ b/IDE/Espressif/ESP-IDF/setup_win.bat
@@ -14,6 +14,7 @@ echo "mklink [[/d] | [/h] | [/j]] "
echo;
::******************************************************************************************************
::******************************************************************************************************
+SET COPYERROR=false
:: if there's a setup.sh, we are probably starting in the right place.
if NOT EXIST "setup.sh" (
@@ -107,32 +108,34 @@ if exist %WOLFSSL_ESPIDFDIR%\user_settings.h (
)
-:: do we really want to erase existing user config?
+::******************************************************************************************************
+:: check if there's already an existing %WOLFSSLLIB_TRG_DIR% and confirm removal
+::******************************************************************************************************
if exist %WOLFSSLLIB_TRG_DIR% (
- echo;
- echo WARNING: Existing files found in %WOLFSSLLIB_TRG_DIR%
- echo;
+ echo;
+ echo WARNING: Existing files found in %WOLFSSLLIB_TRG_DIR%
+ echo;
- :: clear any prior errorlevel
- call;
- choice /c YN /m "Delete files and proceed with install in %WOLFSSLLIB_TRG_DIR% "
- if errorlevel 2 GOTO :NODELETE
- GOTO :PURGE
+ :: clear any prior errorlevel
+ call;
+ choice /c YN /m "Delete files and proceed with install in %WOLFSSLLIB_TRG_DIR% "
+ if errorlevel 2 GOTO :NODELETE
+ GOTO :PURGE
-echo;
-echo Ready to copy files into %IDF_PATH%
+ echo;
+ echo Ready to copy files into %IDF_PATH%
::******************************************************************************************************
:NODELETE
::******************************************************************************************************
:: clear any prior errorlevel
- echo;
- call;
- choice /c YN /m "Refresh files %WOLFSSLLIB_TRG_DIR% (there will be a prompt to keep or overwrite user_settings and config) "
- if errorlevel 2 GOTO :NOCOPY
- GOTO :REFRESH
+ echo;
+ call;
+ choice /c YN /m "Refresh files %WOLFSSLLIB_TRG_DIR% (there will be a prompt to keep or overwrite user_settings and config) "
+ if errorlevel 2 GOTO :NOCOPY
+ GOTO :REFRESH
)
@@ -142,22 +145,22 @@ echo Ready to copy files into %IDF_PATH%
:: purge existing directory
if exist %WOLFSSLLIB_TRG_DIR% (
- echo;
- echo Removing %WOLFSSLLIB_TRG_DIR%
- rmdir %WOLFSSLLIB_TRG_DIR% /S /Q
- if exist %WOLFSSLLIB_TRG_DIR% (
echo;
- echo ERROR: Failed to remove %WOLFSSLLIB_TRG_DIR%
- echo;
- echo Check permissions, open files, read-only attributes, etc.
- echo;
- GOTO :ERR
- )
- echo;
+ echo Removing %WOLFSSLLIB_TRG_DIR%
+ rmdir %WOLFSSLLIB_TRG_DIR% /S /Q
+ if exist %WOLFSSLLIB_TRG_DIR% (
+ SET COPYERROR=true
+ echo;
+ echo WARNING: Failed to remove %WOLFSSLLIB_TRG_DIR%
+ echo;
+ echo Check permissions, open files, read-only attributes, etc.
+ echo;
+ )
+ echo;
) else (
- echo;
- echo Prior %WOLFSSLLIB_TRG_DIR% not found, installing fresh.
- echo;
+ echo;
+ echo Prior %WOLFSSLLIB_TRG_DIR% not found, installing fresh.
+ echo;
)
::******************************************************************************************************
@@ -176,52 +179,52 @@ rem copying ... files in src/ into $WOLFSSLLIB_TRG_DIR%/src
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\src\
xcopy %BASEDIR%\src\*.c %WOLFSSLLIB_TRG_DIR%\src\ /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
echo;
echo Copying src\*.c files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
echo;
echo Copying src\*.i files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\
xcopy %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\ /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
xcopy %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\ /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
rem Copy dummy test_paths.h to handle the case configure hasn't yet executed
echo F |xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
xcopy %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\ /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\
xcopy %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\ /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
echo;
echo Copying files to%WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\
xcopy %BASEDIR%\wolfssl\openssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\ /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
xcopy %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\ /S /E /Q /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
::******************************************************************************************************
@@ -231,27 +234,27 @@ if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying default user_settings.h to %WOLFSSLLIB_TRG_DIR%\include\
xcopy %WOLFSSL_ESPIDFDIR%\user_settings.h %WOLFSSLLIB_TRG_DIR%\include\ /F
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
:: echo Creating new config file: %WOLFSSLLIB_TRG_DIR%\include\config.h (default, may be overwritten by prior file)
echo new config > %WOLFSSLLIB_TRG_DIR%\include\config.h
xcopy %WOLFSSL_ESPIDFDIR%\dummy_config_h. %WOLFSSLLIB_TRG_DIR%\include\config.h /F /Y
-if %errorlevel% NEQ 0 GOTO :COPYERR
+if %errorlevel% NEQ 0 SET COPYERROR=true
:: Check if operator wants to keep prior config.h
if EXIST config_h_%FileStamp%.bak (
- echo;
- :: clear any prior errorlevel
- call;
- choice /c YN /m "Use your prior config.h "
- if errorlevel 2 GOTO :NO_CONFIG_RESTORE
- xcopy config_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\config.h /Y
- if %errorlevel% NEQ 0 GOTO :COPYERR
+ echo;
+ :: clear any prior errorlevel
+ call;
+ choice /c YN /m "Use your prior config.h "
+ if errorlevel 2 GOTO :NO_CONFIG_RESTORE
+ xcopy config_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\config.h /Y
+ if %errorlevel% NEQ 0 SET COPYERROR=true
) else (
- echo;
- echo Prior config.h not found. Using default file.
+ echo;
+ echo Prior config.h not found. Using default file.
)
::******************************************************************************************************
:NO_CONFIG_RESTORE
@@ -259,17 +262,17 @@ if EXIST config_h_%FileStamp%.bak (
:: Check if operator wants to keep prior config.h
if EXIST user_settings_h_%FileStamp%.bak (
- echo;
- :: clear any prior errorlevel
- call;
- choice /c YN /m "User your prior user_settings.h "
- if errorlevel 2 GOTO :NO_USER_SETTINGS_RESTORE
- xcopy user_settings_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\user_settings.h /Y
- if %errorlevel% NEQ 0 GOTO :COPYERR
+ echo;
+ :: clear any prior errorlevel
+ call;
+ choice /c YN /m "User your prior user_settings.h "
+ if errorlevel 2 GOTO :NO_USER_SETTINGS_RESTORE
+ xcopy user_settings_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\user_settings.h /Y
+ if %errorlevel% NEQ 0 SET COPYERROR=true
) else (
- echo;
- echo Prior user_settings.h not found. Using default file.
+ echo;
+ echo Prior user_settings.h not found. Using default file.
)
::******************************************************************************************************
@@ -384,4 +387,9 @@ echo See additional examples at https://github.com/wolfSSL/wolfssl-examples
echo;
echo REMINDER: Ensure any wolfSSL #include definitions occur BEFORE include files in your source code.
echo;
+if "%COPYERROR%" == "true" (
+ echo;
+ echo WARNING: Copy completed with errors! Check for files in use, permissions, symbolic links, etc.
+ echo;
+)
echo setup_win.bat for ESP-IDF completed.
From 409a0acb8862ce20d96e66500b4067fc079d4206 Mon Sep 17 00:00:00 2001
From: gojimmypi <13059545+gojimmypi@users.noreply.github.com>
Date: Tue, 29 Mar 2022 16:07:10 -0700
Subject: [PATCH 4/4] fine tuning on wolfcrypt\test\test_paths.h
---
IDE/Espressif/ESP-IDF/setup_win.bat | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/IDE/Espressif/ESP-IDF/setup_win.bat b/IDE/Espressif/ESP-IDF/setup_win.bat
index 4b514a6f9..d5e125832 100644
--- a/IDE/Espressif/ESP-IDF/setup_win.bat
+++ b/IDE/Espressif/ESP-IDF/setup_win.bat
@@ -201,9 +201,12 @@ echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
xcopy %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\ /S /E /Q /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
-rem Copy dummy test_paths.h to handle the case configure hasn't yet executed
-echo F |xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
-xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
+:: Copy dummy test_paths.h to handle the case configure hasn't yet executed
+echo;
+echo Copying dummy_test_paths.h to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h
+echo new config > %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h
+if %errorlevel% NEQ 0 SET COPYERROR=true
+xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
if %errorlevel% NEQ 0 SET COPYERROR=true
echo;