Tidy up Espressif ESP32 test and benchmark examples (#5800)

Tidy up Espressif ESP32 test and benchmark examples:
* add VisualGDB project and solution files for server and client
* "hardware in use revert to software" is now verbose level message
* Remove (void) TAG;  - not needed to appease compiler
* include esp_log.h lib with defined(WOLFSSL_ESPIDF)
* large ESP32 default stack size
* check for max number of arguments assembled into array
* cleanup & comments per code review
* wolfssl_test VisualGDB updates
* Espressif wolfssl_test default stack 55,000 bytes
This commit is contained in:
gojimmypi 2022-11-30 10:01:46 -08:00 committed by GitHub
parent 973de0e954
commit fec7469c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 2116 additions and 57 deletions

View File

@ -0,0 +1,23 @@
# Espressif Updates
See [#5795]()
## Changes in November 2022
Updates to Espressif ESP-IDF wolfssl_benchmark and wolfssl_test examples:
- Benchmark example no longer runs tests.
- Fixed Test example that was missing code files. (no longer installed locally)
- Rename `benchmark/main` and `test/main` filenames from `helper.c` to `main.c`, cleaned up.
- Added `main.h`
- Revised `main/CMakeLists.txt` to use only `main.c`
- Set components `main` and `wolfssl` for project `CMakeLists.txt`
- Update wolfcrypt esp32_sha.c and sha256.c to now report unexpected reentry as verbose log rather than error message.
- `wolfcrypt/test.c` now returns `args.return_code` when `WOLFSSL_ESPIDF` is defined.
- `wolfcrypt/test.h` now declares `int wolf_test_task(void)` when `WOLFSSL_ESPIDF` is defined.
- `setup.sh` no longer copies benchmark.c(.h) to local project directory.
- Added `libs/Tigard.cfg` file for Tigard JTAG debugger.
- Update `sdkconfig.defaults` with compiler optimizations and stack check.
- Added VisualGDB Project file & Visual Studio solution file.
- Added optional `time_helper` for wolfssl_test
- Exclude `ssl_misc.c` in component cmake to fix warning: #warning ssl_misc.c does not need to be compiled separately from ssl.c

View File

@ -3,4 +3,10 @@
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS
main
wolfssl
) # set components
project(wolfssl_benchmark)

View File

@ -14,3 +14,177 @@ When you want to run the benchmark program
2. `idf.py monitor` to see the message
See the README.md file in the upper level 'examples' directory for more information about examples.
## Performance
Reminder than when building on WSL in `/mnt/c` there will be a noticeable performance degradation at compile time. Using `~/` will be faster at the cost of shared filesystems.
Example build on WSL:
```
Optionally install wolfSSL component
# cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF
./setup.sh
cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark
# Pick ESP-IDF install directory, this one for v4.4.2 in VisualGDB
. /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/export.sh
idf.py build flash -p /dev/ttyS20 -b 921600 monitor
```
## Example Output
Note the default wolfSSL `user_settings.h` is configured by default to be the most
compatible across the widest ranges of targets. Contact wolfSSL at support@wolfssl.com
for help in optimizing for your particular application, or see the
[docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html).
Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 921600 monitor`:
```
--- idf_monitor on /dev/ttyS7 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
(377) cpu_start: Starting scheduler ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6664
load:0x40078000,len:14848
load:0x40080400,len:3792
0x40080400: _init at ??:?
entry 0x40080694
I (27) boot: ESP-IDF v4.4.2-dirty 2nd stage bootloader
I (27) boot: compile time 13:41:41
I (27) boot: chip revision: 1
I (30) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed : 40MHz
I (42) boot.esp32: SPI Mode : DIO
I (46) boot.esp32: SPI Flash Size : 2MB
I (51) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (60) boot: ## Label Usage Type ST Offset Length
I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (75) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (82) boot: 2 factory factory app 00 00 00010000 00100000
I (90) boot: End of partition table
I (94) boot_comm: chip revision: 1, min. application chip revision: 0
I (101) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=12bf4h ( 76788) map
I (137) esp_image: segment 1: paddr=00022c1c vaddr=3ffb0000 size=02420h ( 9248) load
I (141) esp_image: segment 2: paddr=00025044 vaddr=40080000 size=0afd4h ( 45012) load
I (161) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=33148h (209224) map
I (237) esp_image: segment 4: paddr=00063170 vaddr=4008afd4 size=00550h ( 1360) load
I (238) esp_image: segment 5: paddr=000636c8 vaddr=50000000 size=00010h ( 16) load
I (249) boot: Loaded app from partition at offset 0x10000
I (249) boot: Disabling RNG early entropy source...
I (266) cpu_start: Pro cpu up.
I (266) cpu_start: Starting app cpu, entry point is 0x40081098
0x40081098: call_start_cpu1 at /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/components/esp_system/port/cpu_start.c:160
I (0) cpu_start: App cpu up.
I (280) cpu_start: Pro cpu start user code
I (280) cpu_start: cpu freq: 240000000
I (280) cpu_start: Application information:
I (285) cpu_start: Project name: wolfssl_benchmark
I (291) cpu_start: App version: v5.5.3-stable-108-gbd7b442df-di
I (298) cpu_start: Compile time: Nov 17 2022 14:10:03
I (304) cpu_start: ELF file SHA256: fbb520f5bbf963a0...
I (310) cpu_start: ESP-IDF: v4.4.2-dirty
I (316) heap_init: Initializing. RAM available for dynamic allocation:
I (323) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (329) heap_init: At 3FFB3DE8 len 0002C218 (176 KiB): DRAM
I (335) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (341) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (348) heap_init: At 4008B524 len 00014ADC (82 KiB): IRAM
I (355) spi_flash: detected chip: generic
I (359) spi_flash: flash io: dio
W (362) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (377) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (391) wolfssl_benchmark: app_main CONFIG_BENCH_ARGV = -lng 0
I (397) wolfssl_benchmark: construct_argv arg:-lng 0
------------------------------------------------------------------------------
wolfSSL version 5.5.3
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
RNG 1 MiB took 1.017 seconds, 1.320 MiB/s
AES-128-CBC-enc 6 MiB took 1.002 seconds, 5.726 MiB/s
AES-128-CBC-dec 5 MiB took 1.000 seconds, 5.347 MiB/s
AES-192-CBC-enc 6 MiB took 1.004 seconds, 5.714 MiB/s
AES-192-CBC-dec 5 MiB took 1.001 seconds, 5.341 MiB/s
AES-256-CBC-enc 6 MiB took 1.000 seconds, 5.713 MiB/s
AES-256-CBC-dec 5 MiB took 1.002 seconds, 5.336 MiB/s
AES-128-GCM-enc 300 KiB took 1.004 seconds, 298.805 KiB/s
AES-128-GCM-dec 300 KiB took 1.004 seconds, 298.805 KiB/s
AES-192-GCM-enc 300 KiB took 1.007 seconds, 297.915 KiB/s
AES-192-GCM-dec 300 KiB took 1.008 seconds, 297.619 KiB/s
AES-256-GCM-enc 300 KiB took 1.011 seconds, 296.736 KiB/s
AES-256-GCM-dec 300 KiB took 1.011 seconds, 296.736 KiB/s
GMAC Default 403 KiB took 1.002 seconds, 402.196 KiB/s
3DES 450 KiB took 1.028 seconds, 437.743 KiB/s
MD5 14 MiB took 1.001 seconds, 13.756 MiB/s
SHA 14 MiB took 1.001 seconds, 14.463 MiB/s
SHA-256 14 MiB took 1.000 seconds, 14.233 MiB/s
SHA-512 17 MiB took 1.000 seconds, 16.626 MiB/s
HMAC-MD5 14 MiB took 1.000 seconds, 13.599 MiB/s
HMAC-SHA 14 MiB took 1.000 seconds, 13.989 MiB/s
HMAC-SHA256 14 MiB took 1.000 seconds, 13.940 MiB/s
HMAC-SHA512 16 MiB took 1.000 seconds, 16.064 MiB/s
PBKDF2 640 bytes took 1.009 seconds, 634.291 bytes/s
RSA 2048 public 52 ops took 1.022 sec, avg 19.654 ms, 50.881 ops/sec
RSA 2048 private 4 ops took 1.056 sec, avg 264.000 ms, 3.788 ops/sec
ECC [ SECP256R1] 256 key gen 4 ops took 1.216 sec, avg 304.000 ms, 3.289 ops/sec
ECDHE [ SECP256R1] 256 agree 4 ops took 1.215 sec, avg 303.750 ms, 3.292 ops/sec
ECDSA [ SECP256R1] 256 sign 4 ops took 1.226 sec, avg 306.500 ms, 3.263 ops/sec
ECDSA [ SECP256R1] 256 verify 2 ops took 1.172 sec, avg 586.000 ms, 1.706 ops/sec
CURVE 25519 key gen 3 ops took 1.279 sec, avg 426.333 ms, 2.346 ops/sec
CURVE 25519 agree 4 ops took 1.701 sec, avg 425.250 ms, 2.352 ops/sec
ED 25519 key gen 46 ops took 1.008 sec, avg 21.913 ms, 45.635 ops/sec
ED 25519 sign 42 ops took 1.038 sec, avg 24.714 ms, 40.462 ops/sec
ED 25519 verify 26 ops took 1.009 sec, avg 38.808 ms, 25.768 ops/sec
Benchmark complete
```
## Known Issues and Common Issues
### Permission denied
Delete project directory `build`, `.visualgdb` and `.vs` directories. Ensure no other build
process is using the same files in Windows, WSL, Visual Studio, VSCode, etc.
Example message:
```
-- Building ESP-IDF components for target esp32
CMake Error at /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/tools/cmake/component.cmake:131 (file):
file failed to open for writing (Permission denied):
/mnt/c/workspace-pr/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test/build/bootloader/component_properties.temp.cmake
```
### user_settings.h: No such file or directory
Ensure wolfSSL is installed in the ESP-IDF or local project `components` directory.
Example message:
```
esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj -c ../main/main.c
../main/main.c:27:10: fatal error: user_settings.h: No such file or directory
#include <user_settings.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
```
A 'clean` may be needed after freshly installing a new component:
```
idf.py clean build flash -p /dev/ttyS7 -b 921600 monitor
```

View File

@ -0,0 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32802.440
MinimumVisualStudioVersion = 10.0.40219.1
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_benchmark", "VisualGDB_wolfssl_benchmark.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CF8A8B6E-ECCF-481A-92AC-1E2F432816E8}"
ProjectSection(SolutionItems) = preProject
components\wolfssl\wolfcrypt\benchmark\benchmark.c = components\wolfssl\wolfcrypt\benchmark\benchmark.c
components\wolfssl\wolfcrypt\benchmark\benchmark.h = components\wolfssl\wolfcrypt\benchmark\benchmark.h
..\..\README.md = ..\..\README.md
..\..\UPDATE.md = ..\..\UPDATE.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|VisualGDB = Debug|VisualGDB
Release|VisualGDB = Release|VisualGDB
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {969EF1DC-F8DA-46B8-A2AC-A7FDC3234245}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,268 @@
<?xml version="1.0"?>
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Project xsi:type="com.visualgdb.project.external.esp-idf">
<CustomSourceDirectories>
<Directories />
<PathStyle>Unknown</PathStyle>
</CustomSourceDirectories>
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
<ProjectModeSettings>
<ProjectGUID>7bbd1486-d457-4e49-92ba-0cfc9d80849e</ProjectGUID>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<HeaderScanMode>SourceDirs</HeaderScanMode>
</ProjectModeSettings>
</Project>
<Build xsi:type="com.visualgdb.build.cmake">
<BuildLogMode xsi:nil="true" />
<ToolchainID>
<ID>com.visualgdb.xtensa-esp32-elf</ID>
<Version>
<GCC>8.4.0</GCC>
<GDB>8.1.0</GDB>
<Revision>9</Revision>
</Version>
</ToolchainID>
<RelativeSourceDirectory />
<ConfigurationType>DEBUG</ConfigurationType>
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
<MakeCommandTemplate>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(ToolchainNinja)</Command>
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
<BackgroundMode xsi:nil="true" />
</MakeCommandTemplate>
<CMakeCommand>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
<BackgroundMode xsi:nil="true" />
</CMakeCommand>
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
<ExportCompileCommands>false</ExportCompileCommands>
<DisableToolchainFile>false</DisableToolchainFile>
<CMakeMakefileType>Ninja</CMakeMakefileType>
<DeployAsRoot>false</DeployAsRoot>
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
<UseCCache>false</UseCCache>
<ProjectModeSettings>
<ProjectItemSettings>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<GroupTargetsByPaths>true</GroupTargetsByPaths>
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
<AutoRefreshProject>true</AutoRefreshProject>
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
<SortTargetsByName>true</SortTargetsByName>
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
<SortSourcesByName>true</SortSourcesByName>
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
</ProjectItemSettings>
<TargetSpecificSettings />
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
<ProjectGUID>eadcc9ab-72b3-4b51-a838-593e5d80ddf7</ProjectGUID>
<VirtualFolders />
<ConfigurationNameCase>Upper</ConfigurationNameCase>
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
<ESPIDFExtension>
<IDFCheckout>
<Subdirectory>esp-idf/v4.4.2</Subdirectory>
<Type>ESPIDF</Type>
</IDFCheckout>
<COMPort>COM7</COMPort>
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
<UseCCache>false</UseCCache>
<DeviceID>ESP32</DeviceID>
</ESPIDFExtension>
</ProjectModeSettings>
</Build>
<CustomBuild>
<PreSyncActions />
<PreBuildActions />
<PostBuildActions />
<PreCleanActions />
<PostCleanActions />
</CustomBuild>
<CustomDebug>
<PreDebugActions />
<PostDebugActions />
<DebugStopActions />
<BreakMode>Default</BreakMode>
</CustomDebug>
<DeviceTerminalSettings>
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
<ComPortName>COM20</ComPortName>
<AdvancedSettings>
<BaudRate>115200</BaudRate>
<DataBits>8</DataBits>
<Parity>None</Parity>
<StopBits>One</StopBits>
<FlowControl>None</FlowControl>
</AdvancedSettings>
</Connection>
<LastConnectionTime>0</LastConnectionTime>
<EchoTypedCharacters>false</EchoTypedCharacters>
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
<ReconnectAutomatically>false</ReconnectAutomatically>
<DisplayMode>ASCII</DisplayMode>
<Colors>
<Background>
<Alpha>255</Alpha>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Background>
<Disconnected>
<Alpha>255</Alpha>
<Red>169</Red>
<Green>169</Green>
<Blue>169</Blue>
</Disconnected>
<Text>
<Alpha>255</Alpha>
<Red>211</Red>
<Green>211</Green>
<Blue>211</Blue>
</Text>
<Echo>
<Alpha>255</Alpha>
<Red>144</Red>
<Green>238</Green>
<Blue>144</Blue>
</Echo>
<Inactive>
<Alpha>255</Alpha>
<Red>169</Red>
<Green>169</Green>
<Blue>169</Blue>
</Inactive>
</Colors>
<HexSettings>
<MaximumBytesPerLine>16</MaximumBytesPerLine>
<ShowTextView>true</ShowTextView>
<BreaksAroundEcho>true</BreaksAroundEcho>
<AutoSend>true</AutoSend>
<SendAsHex>true</SendAsHex>
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
</HexSettings>
<LineEnding>LF</LineEnding>
<TreatLFAsCRLF>false</TreatLFAsCRLF>
<KeepOpenAfterExit>false</KeepOpenAfterExit>
<ShowAfterProgramming>false</ShowAfterProgramming>
</DeviceTerminalSettings>
<CustomShortcuts>
<Shortcuts />
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
</CustomShortcuts>
<UserDefinedVariables />
<ImportedPropertySheets />
<CodeSense>
<Enabled>Unknown</Enabled>
<ExtraSettings>
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
<FormattingEngine xsi:nil="true" />
</ExtraSettings>
<CodeAnalyzerSettings>
<Enabled>false</Enabled>
</CodeAnalyzerSettings>
</CodeSense>
<Configurations>
<VisualGDBConfiguration>
<Name>Debug</Name>
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
</VisualGDBConfiguration>
<VisualGDBConfiguration>
<Name>Release</Name>
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
</VisualGDBConfiguration>
</Configurations>
<ProgramArgumentsSuggestions />
<Debug xsi:type="com.visualgdb.debug.embedded">
<AdditionalStartupCommands />
<AdditionalGDBSettings>
<Features>
<DisableAutoDetection>false</DisableAutoDetection>
<UseFrameParameter>false</UseFrameParameter>
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
<ListLocalsSupported>false</ListLocalsSupported>
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
<ThreadInfoSupported>false</ThreadInfoSupported>
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
<SupportTargetCommand>false</SupportTargetCommand>
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
</Features>
<EnableSmartStepping>false</EnableSmartStepping>
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
<UseAppleExtensions>false</UseAppleExtensions>
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
<MakeLogFile>false</MakeLogFile>
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
<UseRelativePathsOnly>false</UseRelativePathsOnly>
<ExitAction>None</ExitAction>
<DisableDisassembly>false</DisableDisassembly>
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
<DisableSignals>false</DisableSignals>
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
<EnableNonStopMode>false</EnableNonStopMode>
<MaxBreakpointLimit>0</MaxBreakpointLimit>
<EnableVerboseMode>true</EnableVerboseMode>
<EnablePrettyPrinters>false</EnablePrettyPrinters>
</AdditionalGDBSettings>
<DebugMethod>
<ID>openocd</ID>
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg</CommandLine>
<ExtraParameters>
<Frequency xsi:nil="true" />
<BoostedFrequency xsi:nil="true" />
<ConnectUnderReset>false</ConnectUnderReset>
</ExtraParameters>
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
<ProgramMode>Enabled</ProgramMode>
<StartupCommands>
<string>set remotetimeout 60</string>
<string>target remote :$$SYS:GDB_PORT$$</string>
<string>mon gdb_breakpoint_override hard</string>
<string>mon reset halt</string>
<string>load</string>
</StartupCommands>
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
<PreferredGDBPort>0</PreferredGDBPort>
<PreferredTelnetPort>0</PreferredTelnetPort>
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
<SelectedCoreIndex xsi:nil="true" />
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
<SuggestionLogicRevision>1</SuggestionLogicRevision>
<CheckFLASHSize>true</CheckFLASHSize>
<FLASHSettings>
<Size>size2MB</Size>
<Frequency>freq40M</Frequency>
<Mode>DIO</Mode>
</FLASHSettings>
<PatchBootloader>true</PatchBootloader>
</Configuration>
</DebugMethod>
<AutoDetectRTOS>true</AutoDetectRTOS>
<SemihostingSupport>Disabled</SemihostingSupport>
<SemihostingPollingDelay>0</SemihostingPollingDelay>
<StepIntoEntryPoint>false</StepIntoEntryPoint>
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
<StopAtEntryPoint>false</StopAtEntryPoint>
<EnableVirtualHalts>false</EnableVirtualHalts>
<DynamicAnalysisSettings />
<EndOfStackSymbol>_estack</EndOfStackSymbol>
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
<UnusedStackFillPattern xsi:nil="true" />
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
</Debug>
</VisualGDBProjectSettings2>

View File

@ -4,7 +4,7 @@
#
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
set(COMPONENT_SRCS "benchmark.c" "helper.c")
set(COMPONENT_SRCS main.c)
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()

View File

@ -1,4 +1,4 @@
/* helper.c
/* benchmark main.c
*
* Copyright (C) 2006-2022 wolfSSL Inc.
*
@ -18,24 +18,42 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* ESP-IDF */
#include <esp_log.h>
#include "sdkconfig.h"
/* wolfSSL */
#include <user_settings.h>
#ifndef WOLFSSL_ESPIDF
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfcrypt/benchmark/benchmark.h>
#include "sdkconfig.h"
#include "esp_log.h"
/* check BENCH_ARGV in sdkconfig to determine need to set WOLFSSL_BENCH_ARGV */
#ifdef CONFIG_BENCH_ARGV
#define WOLFSSL_BENCH_ARGV CONFIG_BENCH_ARGV
#define WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS 22 /* arbitrary number of max args */
#endif
#define WOLFSSL_BENCH_ARGV CONFIG_BENCH_ARGV
/*
** the wolfssl component can be installed in either:
**
** - the ESP-IDF component directory
**
** ** OR **
**
** - the local project component directory
**
** it is not recommended to install in both.
**
*/
/* proto-type */
extern void wolf_benchmark_task();
extern void wolf_crypt_task();
static const char* const TAG = "wolfbenchmark";
char* __argv[22];
#include "main.h"
static const char* const TAG = "wolfssl_benchmark";
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
&& defined(WOLFSSL_ATECC508A)
@ -98,22 +116,26 @@ void my_atmel_free(int slotId)
#endif /* CUSTOM_SLOT_ALLOCATION */
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
/* the following are needed by benchmark.c with args */
#ifdef WOLFSSL_BENCH_ARGV
char* __argv[WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS];
int construct_argv()
{
int cnt = 0;
int i = 0;
int len = 0;
char *_argv; /* buffer for copying the string */
char *ch; /* char pointer to trace the string */
char buff[16] = { 0 }; /* buffer for a argument copy */
char *_argv; /* buffer for copying the string */
char *ch; /* char pointer to trace the string */
char buff[16] = { 0 }; /* buffer for a argument copy */
printf("arg:%s\n", CONFIG_BENCH_ARGV);
ESP_LOGI(TAG, "construct_argv arg:%s\n", CONFIG_BENCH_ARGV);
len = strlen(CONFIG_BENCH_ARGV);
_argv = (char*)malloc(len + 1);
if (!_argv) {
return -1;
}
memset(_argv, 0, len+1);
memset(_argv, 0, len + 1);
memcpy(_argv, CONFIG_BENCH_ARGV, len);
_argv[len] = '\0';
ch = _argv;
@ -123,8 +145,15 @@ int construct_argv()
__argv[cnt][9] = '\0';
cnt = 1;
while (*ch != '\0')
{
while (*ch != '\0') {
/* check that we don't overflow manual arg assembly */
if (cnt >= (WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS)) {
ESP_LOGE(TAG, "Abort construct_argv;"
"Reached maximum defined arguments = %d",
WOLFSSL_BENCH_ARGV_MAX_ARGUMENTS);
break;
}
/* skip white-space */
while (*ch == ' ') { ++ch; }
@ -148,11 +177,12 @@ int construct_argv()
return (cnt);
}
#endif
/* entry point */
void app_main(void)
{
(void) TAG;
ESP_LOGI(TAG, "app_main CONFIG_BENCH_ARGV = %s", WOLFSSL_BENCH_ARGV);
/* when using atecc608a on esp32-wroom-32se */
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
@ -168,10 +198,22 @@ void app_main(void)
#endif
#endif
#ifndef NO_CRYPT_TEST
wolf_crypt_task();
#endif
#ifndef NO_CRYPT_BENCHMARK
#ifdef NO_CRYPT_BENCHMARK
ESP_LOGI(TAG, "NO_CRYPT_BENCHMARK defined, skipping wolf_benchmark_task")
#else
/* although wolfCrypt_Init() may be explicitly called above,
** note it is still always called in wolf_benchmark_task.
*/
wolf_benchmark_task();
#endif
}
/* wolfCrypt_Cleanup should always be called at completion,
** and is called in wolf_benchmark_task().
*/
/* after the test, we'll just wait */
while (1) {
/* nothing */
}
#endif /* NO_CRYPT_BENCHMARK */
} /* main */

View File

@ -0,0 +1,29 @@
#pragma once
/* benchmark main.h
*
* Copyright (C) 2006-2022 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
*/
void app_main(void);
/* see wolfssl/wolfcrypt/benchmark/benchmark.h */
extern void wolf_benchmark_task();

View File

@ -1,6 +1,31 @@
CONFIG_BENCH_ARGV="-lng 0"
CONFIG_MAIN_TASK_STACK_SIZE=7500
CONFIG_FREERTOS_HZ=1000
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
170 CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
#
# Default main stack size
#
# This is typically way bigger than needed for stack size. See user_settings.h
#
CONFIG_ESP_MAIN_TASK_STACK_SIZE=55500
# Legacy stack size for older ESP-IDF versions
CONFIG_MAIN_TASK_STACK_SIZE=55500
#
# Watchdog Timers
#
# We don't want to have the watchdog timeout during tests
#
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n
#
# Compiler options
#
CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
CONFIG_COMPILER_HIDE_PATHS_MACROS=y
CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y
CONFIG_COMPILER_STACK_CHECK=y

View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_client", "VisualGDB_wolfssl_client.vgdbproj", "{E903E9CC-1A23-4B00-8914-7E45EC21E351}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|VisualGDB = Debug|VisualGDB
Release|VisualGDB = Release|VisualGDB
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Release|VisualGDB.Build.0 = Release|VisualGDB
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
{E903E9CC-1A23-4B00-8914-7E45EC21E351}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D510376F-F313-4EF6-8EF5-248D1949DFEB}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,265 @@
<?xml version="1.0"?>
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Project xsi:type="com.visualgdb.project.external.esp-idf">
<CustomSourceDirectories>
<Directories />
<PathStyle>Unknown</PathStyle>
</CustomSourceDirectories>
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
<ProjectModeSettings>
<ProjectGUID>bdbba681-1213-45f8-a44e-4652fe489fe3</ProjectGUID>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<HeaderScanMode>SourceDirs</HeaderScanMode>
</ProjectModeSettings>
</Project>
<Build xsi:type="com.visualgdb.build.cmake">
<BuildLogMode xsi:nil="true" />
<ToolchainID>
<ID>com.visualgdb.xtensa-esp32-elf</ID>
<Version>
<GCC>8.4.0</GCC>
<GDB>8.1.0</GDB>
<Revision>9</Revision>
</Version>
</ToolchainID>
<ConfigurationType>DEBUG</ConfigurationType>
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
<MakeCommandTemplate>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(ToolchainNinja)</Command>
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
<BackgroundMode xsi:nil="true" />
</MakeCommandTemplate>
<CMakeCommand>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
<BackgroundMode xsi:nil="true" />
</CMakeCommand>
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
<ExportCompileCommands>false</ExportCompileCommands>
<DisableToolchainFile>false</DisableToolchainFile>
<CMakeMakefileType>Ninja</CMakeMakefileType>
<DeployAsRoot>false</DeployAsRoot>
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
<UseCCache>false</UseCCache>
<ProjectModeSettings>
<ProjectItemSettings>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<GroupTargetsByPaths>true</GroupTargetsByPaths>
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
<AutoRefreshProject>true</AutoRefreshProject>
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
<SortTargetsByName>true</SortTargetsByName>
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
<SortSourcesByName>true</SortSourcesByName>
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
</ProjectItemSettings>
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
<ProjectGUID>e903e9cc-1a23-4b00-8914-7e45ec21e351</ProjectGUID>
<VirtualFolders />
<ConfigurationNameCase>Upper</ConfigurationNameCase>
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
<ESPIDFExtension>
<IDFCheckout>
<Version>v4.4.2</Version>
<Subdirectory>esp-idf/v4.4.2</Subdirectory>
<Type>ESPIDF</Type>
</IDFCheckout>
<COMPort>COM20</COMPort>
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
<UseCCache>false</UseCCache>
<DeviceID>ESP32</DeviceID>
</ESPIDFExtension>
</ProjectModeSettings>
</Build>
<CustomBuild>
<PreSyncActions />
<PreBuildActions />
<PostBuildActions />
<PreCleanActions />
<PostCleanActions />
</CustomBuild>
<CustomDebug>
<PreDebugActions />
<PostDebugActions />
<DebugStopActions />
<BreakMode>Default</BreakMode>
</CustomDebug>
<DeviceTerminalSettings>
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
<ComPortName>COM20</ComPortName>
<AdvancedSettings>
<BaudRate>115200</BaudRate>
<DataBits>8</DataBits>
<Parity>None</Parity>
<StopBits>One</StopBits>
<FlowControl>None</FlowControl>
</AdvancedSettings>
</Connection>
<LastConnectionTime>0</LastConnectionTime>
<EchoTypedCharacters>false</EchoTypedCharacters>
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
<ReconnectAutomatically>false</ReconnectAutomatically>
<DisplayMode>ASCII</DisplayMode>
<Colors>
<Background>
<Alpha>255</Alpha>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Background>
<Disconnected>
<Alpha>255</Alpha>
<Red>169</Red>
<Green>169</Green>
<Blue>169</Blue>
</Disconnected>
<Text>
<Alpha>255</Alpha>
<Red>211</Red>
<Green>211</Green>
<Blue>211</Blue>
</Text>
<Echo>
<Alpha>255</Alpha>
<Red>144</Red>
<Green>238</Green>
<Blue>144</Blue>
</Echo>
<Inactive>
<Alpha>255</Alpha>
<Red>169</Red>
<Green>169</Green>
<Blue>169</Blue>
</Inactive>
</Colors>
<HexSettings>
<MaximumBytesPerLine>16</MaximumBytesPerLine>
<ShowTextView>true</ShowTextView>
<BreaksAroundEcho>true</BreaksAroundEcho>
<AutoSend>true</AutoSend>
<SendAsHex>true</SendAsHex>
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
</HexSettings>
<LineEnding>LF</LineEnding>
<TreatLFAsCRLF>false</TreatLFAsCRLF>
<KeepOpenAfterExit>false</KeepOpenAfterExit>
<ShowAfterProgramming>false</ShowAfterProgramming>
</DeviceTerminalSettings>
<CustomShortcuts>
<Shortcuts />
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
</CustomShortcuts>
<UserDefinedVariables />
<CodeSense>
<Enabled>Unknown</Enabled>
<ExtraSettings>
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
<FormattingEngine xsi:nil="true" />
</ExtraSettings>
<CodeAnalyzerSettings>
<Enabled>false</Enabled>
</CodeAnalyzerSettings>
</CodeSense>
<Configurations>
<VisualGDBConfiguration>
<Name>Debug</Name>
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
</VisualGDBConfiguration>
<VisualGDBConfiguration>
<Name>Release</Name>
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
</VisualGDBConfiguration>
</Configurations>
<Debug xsi:type="com.visualgdb.debug.embedded">
<AdditionalStartupCommands />
<AdditionalGDBSettings>
<Features>
<DisableAutoDetection>false</DisableAutoDetection>
<UseFrameParameter>false</UseFrameParameter>
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
<ListLocalsSupported>false</ListLocalsSupported>
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
<ThreadInfoSupported>false</ThreadInfoSupported>
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
<SupportTargetCommand>false</SupportTargetCommand>
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
</Features>
<EnableSmartStepping>false</EnableSmartStepping>
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
<UseAppleExtensions>false</UseAppleExtensions>
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
<MakeLogFile>false</MakeLogFile>
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
<UseRelativePathsOnly>false</UseRelativePathsOnly>
<ExitAction>None</ExitAction>
<DisableDisassembly>false</DisableDisassembly>
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
<DisableSignals>false</DisableSignals>
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
<EnableNonStopMode>false</EnableNonStopMode>
<MaxBreakpointLimit>0</MaxBreakpointLimit>
<EnableVerboseMode>true</EnableVerboseMode>
<EnablePrettyPrinters>false</EnablePrettyPrinters>
</AdditionalGDBSettings>
<DebugMethod>
<ID>openocd</ID>
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg</CommandLine>
<ExtraParameters>
<Frequency xsi:nil="true" />
<BoostedFrequency xsi:nil="true" />
<ConnectUnderReset>false</ConnectUnderReset>
</ExtraParameters>
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
<ProgramMode>Enabled</ProgramMode>
<StartupCommands>
<string>set remotetimeout 60</string>
<string>target remote :$$SYS:GDB_PORT$$</string>
<string>mon gdb_breakpoint_override hard</string>
<string>mon reset halt</string>
<string>load</string>
</StartupCommands>
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
<PreferredGDBPort>0</PreferredGDBPort>
<PreferredTelnetPort>0</PreferredTelnetPort>
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
<SelectedCoreIndex xsi:nil="true" />
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
<SuggestionLogicRevision>1</SuggestionLogicRevision>
<CheckFLASHSize>true</CheckFLASHSize>
<FLASHSettings>
<Size>size2MB</Size>
<Frequency>freq40M</Frequency>
<Mode>DIO</Mode>
</FLASHSettings>
<PatchBootloader>true</PatchBootloader>
</Configuration>
</DebugMethod>
<AutoDetectRTOS>true</AutoDetectRTOS>
<SemihostingSupport>Auto</SemihostingSupport>
<SemihostingPollingDelay>0</SemihostingPollingDelay>
<StepIntoEntryPoint>false</StepIntoEntryPoint>
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
<StopAtEntryPoint>false</StopAtEntryPoint>
<EnableVirtualHalts>false</EnableVirtualHalts>
<DynamicAnalysisSettings />
<EndOfStackSymbol>_estack</EndOfStackSymbol>
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
<UnusedStackFillPattern xsi:nil="true" />
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
</Debug>
</VisualGDBProjectSettings2>

View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_server", "VisualGDB_wolfssl_server.vgdbproj", "{CD5A90CA-2D40-461A-A0C3-27654371BB00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|VisualGDB = Debug|VisualGDB
Release|VisualGDB = Release|VisualGDB
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Release|VisualGDB.Build.0 = Release|VisualGDB
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
{CD5A90CA-2D40-461A-A0C3-27654371BB00}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {719A8CBE-E881-4B20-89F3-9910520E1067}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,269 @@
<?xml version="1.0"?>
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Project xsi:type="com.visualgdb.project.external.esp-idf">
<CustomSourceDirectories>
<Directories />
<PathStyle>Unknown</PathStyle>
</CustomSourceDirectories>
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
<ProjectModeSettings>
<ProjectGUID>63883b8e-8fa2-4e2f-807c-31c07f619c51</ProjectGUID>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<HeaderScanMode>SourceDirs</HeaderScanMode>
</ProjectModeSettings>
</Project>
<Build xsi:type="com.visualgdb.build.cmake">
<BuildLogMode xsi:nil="true" />
<ToolchainID>
<ID>com.visualgdb.xtensa-esp32-elf</ID>
<Version>
<GCC>8.4.0</GCC>
<GDB>8.1.0</GDB>
<Revision>9</Revision>
</Version>
</ToolchainID>
<RelativeSourceDirectory />
<ConfigurationType>DEBUG</ConfigurationType>
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
<MakeCommandTemplate>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(ToolchainNinja)</Command>
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
<BackgroundMode xsi:nil="true" />
</MakeCommandTemplate>
<CMakeCommand>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
<BackgroundMode xsi:nil="true" />
</CMakeCommand>
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
<ExportCompileCommands>false</ExportCompileCommands>
<DisableToolchainFile>false</DisableToolchainFile>
<CMakeMakefileType>Ninja</CMakeMakefileType>
<DeployAsRoot>false</DeployAsRoot>
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
<UseCCache>false</UseCCache>
<ProjectModeSettings>
<ProjectItemSettings>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<GroupTargetsByPaths>true</GroupTargetsByPaths>
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
<AutoRefreshProject>true</AutoRefreshProject>
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
<SortTargetsByName>true</SortTargetsByName>
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
<SortSourcesByName>true</SortSourcesByName>
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
</ProjectItemSettings>
<TargetSpecificSettings />
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
<ProjectGUID>cd5a90ca-2d40-461a-a0c3-27654371bb00</ProjectGUID>
<VirtualFolders />
<ConfigurationNameCase>Upper</ConfigurationNameCase>
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
<ESPIDFExtension>
<IDFCheckout>
<Version>v4.4.2</Version>
<Subdirectory>esp-idf/v4.4.2</Subdirectory>
<Type>ESPIDF</Type>
</IDFCheckout>
<COMPort>COM20</COMPort>
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
<UseCCache>false</UseCCache>
<DeviceID>ESP32</DeviceID>
</ESPIDFExtension>
</ProjectModeSettings>
</Build>
<CustomBuild>
<PreSyncActions />
<PreBuildActions />
<PostBuildActions />
<PreCleanActions />
<PostCleanActions />
</CustomBuild>
<CustomDebug>
<PreDebugActions />
<PostDebugActions />
<DebugStopActions />
<BreakMode>Default</BreakMode>
</CustomDebug>
<DeviceTerminalSettings>
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
<ComPortName>COM20</ComPortName>
<AdvancedSettings>
<BaudRate>115200</BaudRate>
<DataBits>8</DataBits>
<Parity>None</Parity>
<StopBits>One</StopBits>
<FlowControl>None</FlowControl>
</AdvancedSettings>
</Connection>
<LastConnectionTime>0</LastConnectionTime>
<EchoTypedCharacters>false</EchoTypedCharacters>
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
<ReconnectAutomatically>false</ReconnectAutomatically>
<DisplayMode>ASCII</DisplayMode>
<Colors>
<Background>
<Alpha>255</Alpha>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Background>
<Disconnected>
<Alpha>255</Alpha>
<Red>169</Red>
<Green>169</Green>
<Blue>169</Blue>
</Disconnected>
<Text>
<Alpha>255</Alpha>
<Red>211</Red>
<Green>211</Green>
<Blue>211</Blue>
</Text>
<Echo>
<Alpha>255</Alpha>
<Red>144</Red>
<Green>238</Green>
<Blue>144</Blue>
</Echo>
<Inactive>
<Alpha>255</Alpha>
<Red>169</Red>
<Green>169</Green>
<Blue>169</Blue>
</Inactive>
</Colors>
<HexSettings>
<MaximumBytesPerLine>16</MaximumBytesPerLine>
<ShowTextView>true</ShowTextView>
<BreaksAroundEcho>true</BreaksAroundEcho>
<AutoSend>true</AutoSend>
<SendAsHex>true</SendAsHex>
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
</HexSettings>
<LineEnding>LF</LineEnding>
<TreatLFAsCRLF>false</TreatLFAsCRLF>
<KeepOpenAfterExit>false</KeepOpenAfterExit>
<ShowAfterProgramming>false</ShowAfterProgramming>
</DeviceTerminalSettings>
<CustomShortcuts>
<Shortcuts />
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
</CustomShortcuts>
<UserDefinedVariables />
<ImportedPropertySheets />
<CodeSense>
<Enabled>Unknown</Enabled>
<ExtraSettings>
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
<FormattingEngine xsi:nil="true" />
</ExtraSettings>
<CodeAnalyzerSettings>
<Enabled>false</Enabled>
</CodeAnalyzerSettings>
</CodeSense>
<Configurations>
<VisualGDBConfiguration>
<Name>Debug</Name>
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
</VisualGDBConfiguration>
<VisualGDBConfiguration>
<Name>Release</Name>
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
</VisualGDBConfiguration>
</Configurations>
<ProgramArgumentsSuggestions />
<Debug xsi:type="com.visualgdb.debug.embedded">
<AdditionalStartupCommands />
<AdditionalGDBSettings>
<Features>
<DisableAutoDetection>false</DisableAutoDetection>
<UseFrameParameter>false</UseFrameParameter>
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
<ListLocalsSupported>false</ListLocalsSupported>
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
<ThreadInfoSupported>false</ThreadInfoSupported>
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
<SupportTargetCommand>false</SupportTargetCommand>
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
</Features>
<EnableSmartStepping>false</EnableSmartStepping>
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
<UseAppleExtensions>false</UseAppleExtensions>
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
<MakeLogFile>false</MakeLogFile>
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
<UseRelativePathsOnly>false</UseRelativePathsOnly>
<ExitAction>None</ExitAction>
<DisableDisassembly>false</DisableDisassembly>
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
<DisableSignals>false</DisableSignals>
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
<EnableNonStopMode>false</EnableNonStopMode>
<MaxBreakpointLimit>0</MaxBreakpointLimit>
<EnableVerboseMode>true</EnableVerboseMode>
<EnablePrettyPrinters>false</EnablePrettyPrinters>
</AdditionalGDBSettings>
<DebugMethod>
<ID>openocd</ID>
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg</CommandLine>
<ExtraParameters>
<Frequency xsi:nil="true" />
<BoostedFrequency xsi:nil="true" />
<ConnectUnderReset>false</ConnectUnderReset>
</ExtraParameters>
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
<ProgramMode>Enabled</ProgramMode>
<StartupCommands>
<string>set remotetimeout 60</string>
<string>target remote :$$SYS:GDB_PORT$$</string>
<string>mon gdb_breakpoint_override hard</string>
<string>mon reset halt</string>
<string>load</string>
</StartupCommands>
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
<PreferredGDBPort>0</PreferredGDBPort>
<PreferredTelnetPort>0</PreferredTelnetPort>
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
<SelectedCoreIndex xsi:nil="true" />
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
<SuggestionLogicRevision>1</SuggestionLogicRevision>
<CheckFLASHSize>true</CheckFLASHSize>
<FLASHSettings>
<Size>size2MB</Size>
<Frequency>freq40M</Frequency>
<Mode>DIO</Mode>
</FLASHSettings>
<PatchBootloader>true</PatchBootloader>
</Configuration>
</DebugMethod>
<AutoDetectRTOS>true</AutoDetectRTOS>
<SemihostingSupport>Auto</SemihostingSupport>
<SemihostingPollingDelay>0</SemihostingPollingDelay>
<StepIntoEntryPoint>false</StepIntoEntryPoint>
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
<StopAtEntryPoint>false</StopAtEntryPoint>
<EnableVirtualHalts>false</EnableVirtualHalts>
<DynamicAnalysisSettings />
<EndOfStackSymbol>_estack</EndOfStackSymbol>
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
<UnusedStackFillPattern xsi:nil="true" />
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
</Debug>
</VisualGDBProjectSettings2>

View File

@ -1,6 +1,12 @@
# The following five lines of boilerplate have to be in your project's
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS
main
wolfssl
) # set components
project(wolfssl_test)

View File

@ -1,10 +1,142 @@
# wolfSSL Crypt Test Example
The Example contains of wolfSSL test program.
The Example contains of wolfSSL benchmark 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"
The list of argument can be find in help.
When you want to run the benchmark program
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
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.
Reminder than when building on WSL in `/mnt/c` there will be a noticeable performance degradation at compile time. Using `~/` will be faster at the cost of shared filesystems.
Example build on WSL, assuming `git clone` from `c:\workspace`:
```
# Optionally install wolfSSL component
# cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF
./setup.sh
# switch to test example
cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test
# Pick ESP-IDF install directory, this one for v4.4.2 in VisualGDB
. /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/export.sh
# build and flash, in this example to COM20
idf.py build flash -p /dev/ttyS20 -b 921600 monitor
```
## Example Output
Note the default wolfSSL `user_settings.h` is configured by default to be the most
compatible across the widest ranges of targets. Contact wolfSSL at support@wolfssl.com
for help in optimizing for your particular application, or see the
[docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html).
Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 921600 monitor`:
```
ets Jun 8 2016 00:22:57
rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6612
load:0x40078000,len:14788
load:0x40080400,len:3792
entry 0x40080694
I (26) boot: ESP-IDF v4.4.1-dirty 2nd stage bootloader
I (26) boot: compile time 15:25:38
I (26) boot: chip revision: 1
I (29) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed : 40MHz
I (41) boot.esp32: SPI Mode : DIO
I (46) boot.esp32: SPI Flash Size : 2MB
I (50) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (59) boot: ## Label Usage Type ST Offset Length
I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (74) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (81) boot: 2 factory factory app 00 00 00010000 00100000
I (89) boot: End of partition table
I (93) boot_comm: chip revision: 1, min. application chip revision: 0
I (100) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=16ca4h ( 93348) map
I (143) esp_image: segment 1: paddr=00026ccc vaddr=3ffb0000 size=024d4h ( 9428) load
I (147) esp_image: segment 2: paddr=000291a8 vaddr=40080000 size=06e70h ( 28272) load
I (160) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=412d8h (266968) map
I (257) esp_image: segment 4: paddr=00071300 vaddr=40086e70 size=045a8h ( 17832) load
I (265) esp_image: segment 5: paddr=000758b0 vaddr=50000000 size=00010h ( 16) load
I (270) boot: Loaded app from partition at offset 0x10000
I (270) boot: Disabling RNG early entropy source...
I (285) cpu_start: Pro cpu up.
I (286) cpu_start: Starting app cpu, entry point is 0x40081088
I (273) cpu_start: App cpu up.
I (300) cpu_start: Pro cpu start user code
I (300) cpu_start: cpu freq: 160000000
I (300) cpu_start: Application information:
I (305) cpu_start: Project name: wolfssl_test
I (310) cpu_start: App version: v5.5.3-stable-108-gbd7b442df-di
I (317) cpu_start: Compile time: Nov 17 2022 15:24:40
I (323) cpu_start: ELF file SHA256: 90957eeb4f0d2246...
I (329) cpu_start: ESP-IDF: v4.4.1-dirty
I (335) heap_init: Initializing. RAM available for dynamic allocation:
I (342) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (348) heap_init: At 3FFB2DF0 len 0002D210 (180 KiB): DRAM
I (354) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (360) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (367) heap_init: At 4008B418 len 00014BE8 (82 KiB): IRAM
I (374) spi_flash: detected chip: generic
I (378) spi_flash: flash io: dio
W (382) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (396) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
------------------------------------------------------------------------------
wolfSSL version 5.5.3
------------------------------------------------------------------------------
error test passed!
MEMORY test passed!
base64 test passed!
asn test passed!
RANDOM test passed!
MD5 test passed!
MD4 test passed!
SHA test passed!
SHA-256 test passed!
SHA-512 test passed!
Hash test passed!
HMAC-MD5 test passed!
HMAC-SHA test passed!
HMAC-SHA256 test passed!
HMAC-SHA512 test passed!
HMAC-KDF test passed!
TLSv1.3 KDF test passed!
GMAC test passed!
DES test passed!
DES3 test passed!
AES test passed!
AES192 test passed!
AES256 test passed!
AES-GCM test passed!
RSA test passed!
PWDBASED test passed!
ECC test passed!
ECC buffer test passed!
CURVE25519 test passed!
ED25519 test passed!
logging test passed!
time test passed!
mutex test passed!
Test complete
I (136548) wolfcrypt_test: Exiting main with return code: 0
I (136548) wolfssl_test: wolf_test_task complete success result code = 0
```

View File

@ -0,0 +1,42 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32802.440
MinimumVisualStudioVersion = 10.0.40219.1
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_test", "VisualGDB_wolfssl_test.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{35EEC1E7-13AB-4C74-BFCE-22142A10E1C1}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
sdkconfig = sdkconfig
sdkconfig.defaults = sdkconfig.defaults
build\config\sdkconfig.h = build\config\sdkconfig.h
..\..\..\..\..\wolfcrypt\test\test.c = ..\..\..\..\..\wolfcrypt\test\test.c
..\..\..\..\..\wolfcrypt\test\test.h = ..\..\..\..\..\wolfcrypt\test\test.h
..\..\..\..\..\..\..\SysGCC\esp32\esp-idf\v4.4.1\components\wolfssl\include\user_settings.h = ..\..\..\..\..\..\..\SysGCC\esp32\esp-idf\v4.4.1\components\wolfssl\include\user_settings.h
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|VisualGDB = Debug|VisualGDB
Release|VisualGDB = Release|VisualGDB
Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB
Tests (Release)|VisualGDB = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A0AC9105-F2CF-44E7-8032-3CD9E77EC9F6}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,269 @@
<?xml version="1.0"?>
<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Project xsi:type="com.visualgdb.project.external.esp-idf">
<CustomSourceDirectories>
<Directories />
<PathStyle>Unknown</PathStyle>
</CustomSourceDirectories>
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
<ProjectModeSettings>
<ProjectGUID>35e5525f-318a-466e-a8c7-36548547d801</ProjectGUID>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<HeaderScanMode>SourceDirs</HeaderScanMode>
</ProjectModeSettings>
</Project>
<Build xsi:type="com.visualgdb.build.cmake">
<BuildLogMode xsi:nil="true" />
<ToolchainID>
<ID>com.visualgdb.xtensa-esp32-elf</ID>
<Version>
<GCC>8.4.0</GCC>
<GDB>8.1.0</GDB>
<Revision>9</Revision>
</Version>
</ToolchainID>
<RelativeSourceDirectory />
<ConfigurationType>DEBUG</ConfigurationType>
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
<MakeCommandTemplate>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(ToolchainNinja)</Command>
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
<BackgroundMode xsi:nil="true" />
</MakeCommandTemplate>
<CMakeCommand>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
<BackgroundMode xsi:nil="true" />
</CMakeCommand>
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
<ExportCompileCommands>false</ExportCompileCommands>
<DisableToolchainFile>false</DisableToolchainFile>
<CMakeMakefileType>Ninja</CMakeMakefileType>
<DeployAsRoot>false</DeployAsRoot>
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
<UseCCache>false</UseCCache>
<ProjectModeSettings>
<ProjectItemSettings>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<GroupTargetsByPaths>true</GroupTargetsByPaths>
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
<AutoRefreshProject>true</AutoRefreshProject>
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
<SortTargetsByName>true</SortTargetsByName>
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
<SortSourcesByName>true</SortSourcesByName>
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
</ProjectItemSettings>
<TargetSpecificSettings />
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
<ProjectGUID>eadcc9ab-72b3-4b51-a838-593e5d80ddf7</ProjectGUID>
<VirtualFolders />
<ConfigurationNameCase>Upper</ConfigurationNameCase>
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
<ESPIDFExtension>
<IDFCheckout>
<Version>v4.4.2</Version>
<Subdirectory>esp-idf/v4.4.2</Subdirectory>
<Type>ESPIDF</Type>
</IDFCheckout>
<COMPort>COM20</COMPort>
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
<UseCCache>false</UseCCache>
<DeviceID>ESP32</DeviceID>
</ESPIDFExtension>
</ProjectModeSettings>
</Build>
<CustomBuild>
<PreSyncActions />
<PreBuildActions />
<PostBuildActions />
<PreCleanActions />
<PostCleanActions />
</CustomBuild>
<CustomDebug>
<PreDebugActions />
<PostDebugActions />
<DebugStopActions />
<BreakMode>Default</BreakMode>
</CustomDebug>
<DeviceTerminalSettings>
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
<ComPortName>COM20</ComPortName>
<AdvancedSettings>
<BaudRate>115200</BaudRate>
<DataBits>8</DataBits>
<Parity>None</Parity>
<StopBits>One</StopBits>
<FlowControl>None</FlowControl>
</AdvancedSettings>
</Connection>
<LastConnectionTime>0</LastConnectionTime>
<EchoTypedCharacters>false</EchoTypedCharacters>
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
<ReconnectAutomatically>false</ReconnectAutomatically>
<DisplayMode>ASCII</DisplayMode>
<Colors>
<Background>
<Alpha>255</Alpha>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Background>
<Disconnected>
<Alpha>255</Alpha>
<Red>169</Red>
<Green>169</Green>
<Blue>169</Blue>
</Disconnected>
<Text>
<Alpha>255</Alpha>
<Red>211</Red>
<Green>211</Green>
<Blue>211</Blue>
</Text>
<Echo>
<Alpha>255</Alpha>
<Red>144</Red>
<Green>238</Green>
<Blue>144</Blue>
</Echo>
<Inactive>
<Alpha>255</Alpha>
<Red>169</Red>
<Green>169</Green>
<Blue>169</Blue>
</Inactive>
</Colors>
<HexSettings>
<MaximumBytesPerLine>16</MaximumBytesPerLine>
<ShowTextView>true</ShowTextView>
<BreaksAroundEcho>true</BreaksAroundEcho>
<AutoSend>true</AutoSend>
<SendAsHex>true</SendAsHex>
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
</HexSettings>
<LineEnding>LF</LineEnding>
<TreatLFAsCRLF>false</TreatLFAsCRLF>
<KeepOpenAfterExit>false</KeepOpenAfterExit>
<ShowAfterProgramming>false</ShowAfterProgramming>
</DeviceTerminalSettings>
<CustomShortcuts>
<Shortcuts />
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
</CustomShortcuts>
<UserDefinedVariables />
<ImportedPropertySheets />
<CodeSense>
<Enabled>Unknown</Enabled>
<ExtraSettings>
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
<FormattingEngine xsi:nil="true" />
</ExtraSettings>
<CodeAnalyzerSettings>
<Enabled>false</Enabled>
</CodeAnalyzerSettings>
</CodeSense>
<Configurations>
<VisualGDBConfiguration>
<Name>Debug</Name>
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
</VisualGDBConfiguration>
<VisualGDBConfiguration>
<Name>Release</Name>
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
</VisualGDBConfiguration>
</Configurations>
<ProgramArgumentsSuggestions />
<Debug xsi:type="com.visualgdb.debug.embedded">
<AdditionalStartupCommands />
<AdditionalGDBSettings>
<Features>
<DisableAutoDetection>false</DisableAutoDetection>
<UseFrameParameter>false</UseFrameParameter>
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
<ListLocalsSupported>false</ListLocalsSupported>
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
<ThreadInfoSupported>false</ThreadInfoSupported>
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
<SupportTargetCommand>false</SupportTargetCommand>
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
</Features>
<EnableSmartStepping>false</EnableSmartStepping>
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
<UseAppleExtensions>false</UseAppleExtensions>
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
<MakeLogFile>false</MakeLogFile>
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
<UseRelativePathsOnly>false</UseRelativePathsOnly>
<ExitAction>None</ExitAction>
<DisableDisassembly>false</DisableDisassembly>
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
<DisableSignals>false</DisableSignals>
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
<EnableNonStopMode>false</EnableNonStopMode>
<MaxBreakpointLimit>0</MaxBreakpointLimit>
<EnableVerboseMode>true</EnableVerboseMode>
<EnablePrettyPrinters>false</EnablePrettyPrinters>
</AdditionalGDBSettings>
<DebugMethod>
<ID>openocd</ID>
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
<CommandLine>-f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg</CommandLine>
<ExtraParameters>
<Frequency xsi:nil="true" />
<BoostedFrequency xsi:nil="true" />
<ConnectUnderReset>false</ConnectUnderReset>
</ExtraParameters>
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
<ProgramMode>Enabled</ProgramMode>
<StartupCommands>
<string>set remotetimeout 60</string>
<string>target remote :$$SYS:GDB_PORT$$</string>
<string>mon gdb_breakpoint_override hard</string>
<string>mon reset halt</string>
<string>load</string>
</StartupCommands>
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
<PreferredGDBPort>0</PreferredGDBPort>
<PreferredTelnetPort>0</PreferredTelnetPort>
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
<SelectedCoreIndex xsi:nil="true" />
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
<SuggestionLogicRevision>1</SuggestionLogicRevision>
<CheckFLASHSize>true</CheckFLASHSize>
<FLASHSettings>
<Size>size2MB</Size>
<Frequency>freq40M</Frequency>
<Mode>DIO</Mode>
</FLASHSettings>
<PatchBootloader>true</PatchBootloader>
</Configuration>
</DebugMethod>
<AutoDetectRTOS>true</AutoDetectRTOS>
<SemihostingSupport>Auto</SemihostingSupport>
<SemihostingPollingDelay>0</SemihostingPollingDelay>
<StepIntoEntryPoint>false</StepIntoEntryPoint>
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
<StopAtEntryPoint>false</StopAtEntryPoint>
<EnableVirtualHalts>false</EnableVirtualHalts>
<DynamicAnalysisSettings />
<EndOfStackSymbol>_estack</EndOfStackSymbol>
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
<UnusedStackFillPattern xsi:nil="true" />
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
</Debug>
</VisualGDBProjectSettings2>

View File

@ -4,7 +4,11 @@
#
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS")
set(COMPONENT_SRCS "test.c")
set(COMPONENT_SRCS "main.c")
# when using time helper:
# set(COMPONENT_SRCS "main.c" "time_helper.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()

View File

@ -0,0 +1,29 @@
menu "Example Configuration"
config BENCH_ARGV
string "Arguments for benchmark test"
default "-lng 0"
help
-? <num> Help, print this usage
0: English, 1: Japanese
-csv Print terminal output in csv format
-base10 Display bytes as power of 10 (eg 1 kB = 1000 Bytes)
-no_aad No additional authentication data passed.
-dgst_full Full digest operation performed.
-rsa_sign Measure RSA sign/verify instead of encrypt/decrypt.
-<alg> Algorithm to benchmark. Available algorithms include:
cipher aes-cbc aes-gcm chacha20 chacha20-poly1305
digest md5 poly1305 sha sha2 sha224 sha256 sha384 sha512 sha3
sha3-224 sha3-256 sha3-384 sha3-512
mac hmac hmac-md5 hmac-sha hmac-sha224 hmac-sha256 hmac-sha384
hmac-sha512
asym rsa rsa-sz dh ecc-kg ecc
other rng
-lng <num> Display benchmark result by specified language.
0: English, 1: Japanese
<num> Size of block in bytes
e.g -lng 1
e.g sha
endmenu

View File

@ -0,0 +1,172 @@
/* main.c
*
* Copyright (C) 2006-2022 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
*/
/* ESP-IDF */
#include <esp_log.h>
#include "sdkconfig.h"
/* wolfSSL */
#include <user_settings.h>
#ifndef WOLFSSL_ESPIDF
#warning "problem with wolfSSL user settings. Check components/wolfssl/include"
#endif
#include <wolfcrypt/test/test.h>
/*
** the wolfssl component can be installed in either:
**
** - the ESP-IDF component directory
**
** ** OR **
**
** - the local project component directory
**
** it is not recommended to install in both.
**
*/
/*
** although the wolfcrypt/test includes a default time setting,
** see the enclosed optional time helper for adding NNTP.
** be sure to add "time_helper.c" in main/CMakeLists.txt
*/
#undef WOLFSSL_USE_TIME_HELPER
#if defined(WOLFSSL_USE_TIME_HELPER)
#include "time_helper.h" */
#endif
/* see wolfssl/wolfcrypt/test/test.h */
extern void wolf_crypt_task();
static const char* const TAG = "wolfssl_test";
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
&& defined(WOLFSSL_ATECC508A)
#include "wolfssl/wolfcrypt/port/atmel/atmel.h"
/* when you need to use a custom slot allocation, */
/* enable the definition CUSTOM_SLOT_ALLOCAION. */
#if defined(CUSTOM_SLOT_ALLOCATION)
static byte mSlotList[ATECC_MAX_SLOT];
/* initialize slot array */
void my_atmel_slotInit()
{
int i;
for (i = 0; i < ATECC_MAX_SLOT; i++) {
mSlotList[i] = ATECC_INVALID_SLOT;
}
}
/* allocate slot depending on slotType */
int my_atmel_alloc(int slotType)
{
int i, slot = ATECC_INVALID_SLOT;
switch (slotType) {
case ATMEL_SLOT_ENCKEY:
slot = 4;
break;
case ATMEL_SLOT_DEVICE:
slot = 0;
break;
case ATMEL_SLOT_ECDHE:
slot = 0;
break;
case ATMEL_SLOT_ECDHE_ENC:
slot = 4;
break;
case ATMEL_SLOT_ANY:
for (i = 0; i < ATECC_MAX_SLOT; i++) {
if (mSlotList[i] == ATECC_INVALID_SLOT) {
slot = i;
break;
} /* if */
} /* for */
} /* switch */
return slot;
}
/* free slot array */
void my_atmel_free(int slotId)
{
if (slotId >= 0 && slotId < ATECC_MAX_SLOT) {
mSlotList[slotId] = ATECC_INVALID_SLOT;
}
}
#endif /* CUSTOM_SLOT_ALLOCATION */
#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */
/* entry point */
void app_main(void)
{
int rc = 0;
#if defined (WOLFSSL_USE_TIME_HELPER)
set_time();
#endif
/* when using atecc608a on esp32-wroom-32se */
#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \
&& defined(WOLFSSL_ATECC508A)
#if defined(CUSTOM_SLOT_ALLOCATION)
my_atmel_slotInit();
/* to register the callback, it needs to be initialized. */
if ((wolfCrypt_Init()) != 0) {
ESP_LOGE(TAG, "wolfCrypt_Init failed");
return;
}
atmel_set_slot_allocator(my_atmel_alloc, my_atmel_free);
#endif
#endif
#ifdef NO_CRYPT_TEST
ESP_LOGI(TAG, "NO_CRYPT_TEST defined, skipping wolf_test_task");
#else
/* Although wolfCrypt_Init() may be explicitly called above,
** Note it is still always called in wolf_test_task.
*/
rc = wolf_test_task();
/* note wolfCrypt_Cleanup() should always be called when finished.
** This is called at the end of wolf_test_task();
*/
if (rc == 0) {
ESP_LOGI(TAG, "wolf_test_task complete success result code = %d", rc);
}
else {
ESP_LOGE(TAG, "wolf_test_task FAIL result code = %d", rc);
/* see wolfssl/wolfcrypt/error-crypt.h */
}
/* after the test, we'll just wait */
while (1) {
/* nothing */
}
#endif
}

View File

@ -0,0 +1,119 @@
/* time_helper.c
*
* Copyright (C) 2006-2022 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
*/
#include <string.h>
#include <lwip/apps/sntp.h>
#include "sdkconfig.h"
#include "esp_log.h"
#include "time_helper.h"
const static char* TAG = "Time Helper";
#define TIME_ZONE "PST-8"
/* NELEMS(x) number of elements
* To determine the number of elements in the array, we can divide the total size of
* the array by the size of the array element
* See https://stackoverflow.com/questions/37538/how-do-i-determine-the-size-of-my-array-in-c
**/
#define NELEMS(x) ( (int)(sizeof(x) / sizeof((x)[0])) )
#define NTP_SERVER_LIST ( (char*[]) { \
"pool.ntp.org", \
"time.nist.gov", \
"utcnist.colorado.edu" \
} \
)
/* #define NTP_SERVER_COUNT using NELEMS:
*
* (int)(sizeof(NTP_SERVER_LIST) / sizeof(NTP_SERVER_LIST[0]))
*/
#define NTP_SERVER_COUNT NELEMS(NTP_SERVER_LIST)
char* ntpServerList[NTP_SERVER_COUNT] = NTP_SERVER_LIST;
/* our NTP server list is global info */
extern char* ntpServerList[NTP_SERVER_COUNT];
int set_time(void)
{
/* we'll also return a result code of zero */
int res = 0;
int i = 0; /* counter for time servers */
time_t interim_time;
/* ideally, we'd like to set time from network,
* but let's set a default time, just in case */
struct tm timeinfo = {
.tm_year = 2022 - 1900,
.tm_mon = 11,
.tm_mday = 15,
.tm_hour = 3,
.tm_min = 25,
.tm_sec = 0
};
struct timeval now;
#ifndef NTP_SERVER_COUNT
#define NTP_SERVER_COUNT 0
char* ntpServerList[NTP_SERVER_COUNT];
#endif /* not defined: NTP_SERVER_COUNT */
#ifndef TIME_ZONE
#define TIME_ZONE "PST-8"
#endif /* not defined: TIME_ZONE */
/* set interim static time */
interim_time = mktime(&timeinfo);
now = (struct timeval){ .tv_sec = interim_time };
settimeofday(&now, NULL);
/* set timezone */
setenv("TZ", TIME_ZONE, 1);
tzset();
if (NTP_SERVER_COUNT) {
/* next, let's setup NTP time servers
*
* see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#sntp-time-synchronization
*/
sntp_setoperatingmode(SNTP_OPMODE_POLL);
ESP_LOGI(TAG, "sntp_setservername:");
for (i = 0; i < NTP_SERVER_COUNT; i++) {
const char* thisServer = ntpServerList[i];
if (strncmp(thisServer, "\x00", 1) == 0) {
/* just in case we run out of NTP servers */
break;
}
ESP_LOGI(TAG, "%s", thisServer);
sntp_setservername(i, thisServer);
}
sntp_init();
ESP_LOGI(TAG, "sntp_init done.");
}
else {
ESP_LOGI(TAG, "No sntp time servers found.");
}
return res;
}

View File

@ -0,0 +1,32 @@
#ifndef _TIME_HELPER_H
/*
* Copyright (C) 2006-2022 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
*/
#ifdef __cplusplus
extern "C" {
#endif
int set_time(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* #ifndef _TIME_HELPER_H */

View File

@ -1,2 +1,27 @@
#
# Default main stack size
#
# This is typically way bigger than needed for stack size. See user_settings.h
#
CONFIG_ESP_MAIN_TASK_STACK_SIZE=55000
# Legacy stack size for older ESP-IDF versions
CONFIG_MAIN_TASK_STACK_SIZE=11000
CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=
#
# Watchdog Timers
#
# We don't want to have the watchdog timeout during tests
#
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n
#
# Compiler options
#
CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2
CONFIG_COMPILER_HIDE_PATHS_MACROS=y
CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y
CONFIG_COMPILER_STACK_CHECK=y

View File

@ -30,6 +30,8 @@ set(COMPONENT_SRCDIRS "./src/"
"./wolfcrypt/src/"
"./wolfcrypt/src/port/Espressif/"
"./wolfcrypt/src/port/atmel/"
"./wolfcrypt/benchmark/"
"./wolfcrypt/test/"
# "$ENV{IDF_PATH}/components/soc/esp32s3/include/soc"
)
@ -69,6 +71,7 @@ set(COMPONENT_SRCEXCLUDE
"./src/conf.c"
"./src/misc.c"
"./src/pk.c"
"./src/ssl_misc.c" # included by ssl.c
"./src/x509.c"
"./src/x509_str.c"
"./wolfcrypt/src/evp.c"

View File

@ -0,0 +1,7 @@
Files in IDE\Espressif\ESP-IDF\libs:
`CMakeLists.txt` used in ESP-IDF `wolfssl` component directory
`component.mk` used in ESP-IDF `wolfssl` component directory
`tigard.cfg` Tigard JTAG config file

View File

@ -29,6 +29,8 @@ COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/freertos/include/freerto
COMPONENT_SRCDIRS := src wolfcrypt/src
COMPONENT_SRCDIRS += wolfcrypt/src/port/Espressif
COMPONENT_SRCDIRS += wolfcrypt/src/port/atmel
COMPONENT_SRCDIRS += wolfcrypt/benchmark
COMPONENT_SRCDIRS += wolfcrypt/test
CFLAGS +=-DWOLFSSL_USER_SETTINGS

View File

@ -0,0 +1,8 @@
adapter driver ftdi
ftdi vid_pid 0x0403 0x6010
ftdi channel 1
adapter speed 29500
ftdi layout_init 0x0038 0x003b
ftdi layout_signal nTRST -data 0x0010
ftdi layout_signal nSRST -data 0x0020
transport select jtag

View File

@ -77,8 +77,8 @@ ${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
# 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/
@ -96,7 +96,7 @@ ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/dummy_config_h ${WOLFSSLLIB_TRG_DIR}/include/c
# unit test app
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/test/* ${WOLFSSLLIB_TRG_DIR}/test/
popd > /dev/null #
popd > /dev/null #
${CPDCMD} ./libs/CMakeLists.txt ${WOLFSSLLIB_TRG_DIR}/
${CPDCMD} ./libs/component.mk ${WOLFSSLLIB_TRG_DIR}/
@ -111,9 +111,6 @@ ${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
${CPDCMD} ${BASEDIR}/wolfcrypt/benchmark/benchmark.h ${BASEDIR}/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/benchmark.h
${CPDCMD} ${BASEDIR}/wolfcrypt/benchmark/benchmark.c ${BASEDIR}/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/benchmark.c
${CPDCMD} -r ./wolfcrypt/benchmark/benchmark.c ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/
@ -156,7 +153,7 @@ ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/* ${WOLFSSLEXP_TRG_DIR
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/
${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_server/main/include/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_server/main/include/
popd > /dev/null #
popd > /dev/null #
if [ "${WOLFSSL_SETUP_VERBOSE}" == "true" ]; then
echo "Copy complete!"

View File

@ -308,11 +308,6 @@ 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
if %errorlevel% NEQ 0 GOTO :COPYERR
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

View File

@ -179,7 +179,7 @@ int esp_unroll_sha_module_enable(WC_ESP32SHA* ctx)
/* this could be a warning of wonkiness in RTOS environment.
* we were successful, but not expected depth count*/
ESP_LOGE(TAG, "warning lockDepth mismatch.");
ESP_LOGV(TAG, "warning lockDepth mismatch.");
}
ctx->lockDepth = 0;
ctx->mode = ESP32_SHA_INIT;
@ -274,7 +274,7 @@ int esp_sha_try_hw_lock(WC_ESP32SHA* ctx)
ESP_LOGV(TAG, "Hardware Mode, lock depth = %d", ctx->lockDepth);
}
else {
ESP_LOGI(TAG, ">>>> Hardware in use; Mode REVERT to ESP32_SHA_SW");
ESP_LOGV(TAG, ">>>> Hardware in use; Mode REVERT to ESP32_SHA_SW");
ctx->mode = ESP32_SHA_SW;
return 0; /* success, but revert to SW */
}

View File

@ -1760,10 +1760,10 @@ void wc_Sha256Free(wc_Sha256* sha256)
* should have already been released (lockDepth = 0)
*/
InitSha256(sha256); /* unlock mutex, set mode to ESP32_SHA_INIT */
ESP_LOGE("sha256", "ERROR: hardware unlock needed in wc_Sha256Free");
ESP_LOGV("sha256", "Alert: hardware unlock needed in wc_Sha256Free.");
}
else {
ESP_LOGV("sha256", "hardware unlock not needed in wc_Sha256Free");
ESP_LOGV("sha256", "Hardware unlock not needed in wc_Sha256Free.");
}
#endif
}

View File

@ -118,6 +118,7 @@
#elif defined(WOLFSSL_ESPIDF)
#include <time.h>
#include <sys/time.h>
#include <esp_log.h>
#elif defined(WOLFSSL_ZEPHYR)
#include <stdio.h>
@ -1640,11 +1641,20 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
printf("Testing complete. You may close the window now\n");
while (1);
#endif
#ifndef WOLFSSL_ESPIDF
printf("Exiting main with return code: %d\n", args.return_code);
return args.return_code;
#ifdef WOLFSSL_ESPIDF
/* ESP_LOGI to print takes up a lot less memory than printf */
ESP_LOGI("wolfcrypt_test", "Exiting main with return code: % d\n", args.return_code);
#endif
}
/* everything else will use printf */
#if !defined(WOLFSSL_ESPIDF)
/* gate this for target platforms wishing to avoid printf reference */
printf("Exiting main with return code: %d\n", args.return_code);
#endif
return args.return_code;
} /* wolfcrypt_test_main or wolf_test_task */
#endif /* NO_MAIN_DRIVER */

View File

@ -33,10 +33,15 @@ THREAD_RETURN WOLFSSL_THREAD wolfcrypt_test(void* args);
#else
int wolfcrypt_test(void* args);
#endif
#ifndef NO_MAIN_DRIVER
int wolfcrypt_test_main(int argc, char** argv);
#endif
#if defined(WOLFSSL_ESPIDF) || defined(_WIN32_WCE)
int wolf_test_task(void);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif