example code cleanup; confirm working w/ ESP-IDF v5.0
parent
3661692c13
commit
7e26aac247
|
@ -304,3 +304,18 @@ tpm/evp_tpm
|
|||
**/main/build/CMakeFiles/*
|
||||
**/build/*
|
||||
|
||||
# VisualGDB
|
||||
**/.visualgdb
|
||||
|
||||
# Espressif sdk config default should be saved in sdkconfig.defaults
|
||||
# we won't track the actual working sdkconfig files
|
||||
/ESP32/**/sdkconfig
|
||||
/ESP32/**/sdkconfig.old
|
||||
/ESP32/**/sdkconfig.bak
|
||||
|
||||
# the solution files are not needed (Visual Studio will generated them)
|
||||
/ESP32/**/*.sln
|
||||
|
||||
# auto-created CMake backups
|
||||
**/CMakeLists.txt.old
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# wolfSSL ESP32 Examples
|
||||
|
||||
These are wolfSSL TLS 1.3 clients and servers for both wired and wireless Internet.
|
||||
|
||||
Note: wolfSSL v5.5.4 or newer is needed to use these examples with ESP-IDF v5.
|
||||
|
||||
See the [setup scripts](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF) to install.
|
||||
|
||||
|
||||
## ESP32 TLS 1.3 Server
|
||||
|
||||
- [Wireless STA server](./TLS13-wifi_station-server/README.md)
|
||||
|
@ -39,7 +46,7 @@ coming soon:
|
|||
## ESP-IDF
|
||||
|
||||
Although the examples were created using VisualGDB extension for Visual Studio, the
|
||||
examples can be compiled using the ESP-IDF.
|
||||
examples can of course be compiled using the ESP-IDF `idf.py`.
|
||||
|
||||
Once the EDP-IDF is installed, use the [setp_win.bat](https://github.com/wolfSSL/wolfssl/blob/master/IDE/Espressif/ESP-IDF/setup_win.bat) to copy wolfSSL files to
|
||||
the `esp-idf\components` directory, typically in
|
||||
|
@ -54,12 +61,39 @@ cd wolfssl\IDE\Espressif\ESP-IDF\
|
|||
.\setup_win.bat
|
||||
```
|
||||
|
||||
# Tips
|
||||
Build with VisualGDB toolchain from WSL
|
||||
```
|
||||
. /mnt/c/SysGCC/esp32/esp-idf/v5.0/export.sh
|
||||
idf.py -b 115200 -p /dev/ttyS15 build flash monitor
|
||||
```
|
||||
|
||||
|
||||
## Tips
|
||||
|
||||
If JTAG gets into a mode where it is simply always returning an error (app continually resetting)
|
||||
try using serial port to program a basic, operational ["hello world"](./ESP32-hello-world/README.md).
|
||||
The Arduino IDE or command-line ESP-IDF can be handy here.
|
||||
|
||||
## Toolchain Switching in VisualGDB
|
||||
|
||||
Due to occasional difficulty in switching between toolchains, separate VisualGDB solution
|
||||
files are included for ESP-IDF v4.4.1 and v5.0.
|
||||
|
||||
See the `ProjectModeSettings` of the respective .`vgdbproj` file:
|
||||
|
||||
```
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>release/v5.0</Version>
|
||||
<Subdirectory>esp-idf/v5.0</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM20</COMPort>
|
||||
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
|
||||
<UseCCache>false</UseCCache>
|
||||
<DeviceID>ESP32</DeviceID>
|
||||
</ESPIDFExtension>
|
||||
```
|
||||
|
||||
## See also:
|
||||
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31729.503
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7087FBCD-E3BF-44F5-BA16-5A9B41782406}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README-output.txt = README-output.txt
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "TLS13-ENC28J60-server", "TLS13-ENC28J60-server\TLS13-ENC28J60-server.vgdbproj", "{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}"
|
||||
EndProject
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "TLS13-enc28j60-client", "TLS13-ENC28J60-client\TLS13-enc28j60-client.vgdbproj", "{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}"
|
||||
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
|
||||
{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{78B33F2B-5B03-4D34-BAF6-82060DD9FA8F}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{67AFCF00-979E-40FB-AE8A-CDEB4F8EE7DC}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {65BE29BE-BAE2-4235-9F23-0B1E199AB7BB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31729.503
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7087FBCD-E3BF-44F5-BA16-5A9B41782406}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README-output.txt = README-output.txt
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "TLS13-wifi_station-client", "TLS13-wifi_station-client\TLS13-wifi_station-client.vgdbproj", "{4904362E-3B9F-44CC-9C44-740B27FDFBE5}"
|
||||
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
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {65BE29BE-BAE2-4235-9F23-0B1E199AB7BB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31729.503
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "TLS13-client", "TLS13-client.vgdbproj", "{4904362E-3B9F-44CC-9C44-740B27FDFBE5}"
|
||||
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
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E0F17030-83D2-4967-AF75-777516FF525D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31729.503
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "TLS13-client", "TLS13-wifi_station-client.vgdbproj", "{4904362E-3B9F-44CC-9C44-740B27FDFBE5}"
|
||||
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
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{4904362E-3B9F-44CC-9C44-740B27FDFBE5}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E0F17030-83D2-4967-AF75-777516FF525D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -20,9 +20,10 @@
|
|||
<Version>
|
||||
<GCC>8.4.0</GCC>
|
||||
<GDB>8.1.0</GDB>
|
||||
<Revision>7</Revision>
|
||||
<Revision>9</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory />
|
||||
<ConfigurationType>DEBUG</ConfigurationType>
|
||||
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
|
||||
<MakeCommandTemplate>
|
||||
|
@ -57,6 +58,7 @@
|
|||
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
|
||||
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
|
||||
</ProjectItemSettings>
|
||||
<TargetSpecificSettings />
|
||||
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
|
||||
<ProjectGUID>4904362e-3b9f-44cc-9c44-740b27fdfbe5</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
|
@ -65,8 +67,8 @@
|
|||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>release/v4.4</Version>
|
||||
<Subdirectory>esp-idf/v4.4</Subdirectory>
|
||||
<Version>v4.4.1</Version>
|
||||
<Subdirectory>esp-idf/v4.4.1</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM20</COMPort>
|
||||
|
@ -155,6 +157,7 @@
|
|||
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
|
||||
</CustomShortcuts>
|
||||
<UserDefinedVariables />
|
||||
<ImportedPropertySheets />
|
||||
<CodeSense>
|
||||
<Enabled>Unknown</Enabled>
|
||||
<ExtraSettings>
|
||||
|
@ -177,6 +180,7 @@
|
|||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
</Configurations>
|
||||
<ProgramArgumentsSuggestions />
|
||||
<Debug xsi:type="com.visualgdb.debug.embedded">
|
||||
<AdditionalStartupCommands />
|
||||
<AdditionalGDBSettings>
|
|
@ -0,0 +1,345 @@
|
|||
<?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>eb963948-ff31-4e03-878f-5cd21b92f36b</ProjectGUID>
|
||||
<GroupSourcesByTypes>true</GroupSourcesByTypes>
|
||||
<GroupSourcesByPaths>true</GroupSourcesByPaths>
|
||||
<HeaderScanMode>SourceDirs</HeaderScanMode>
|
||||
</ProjectModeSettings>
|
||||
<TestSettings>
|
||||
<InitializationTimeout>30</InitializationTimeout>
|
||||
<DefaultTestTimeout>60</DefaultTestTimeout>
|
||||
<ApptraceInitializationTimeout>5</ApptraceInitializationTimeout>
|
||||
<FinalizationTimeout>5</FinalizationTimeout>
|
||||
</TestSettings>
|
||||
</Project>
|
||||
<Build xsi:type="com.visualgdb.build.cmake">
|
||||
<BuildLogMode xsi:nil="true" />
|
||||
<ToolchainID>
|
||||
<ID>com.visualgdb.xtensa-esp32-elf</ID>
|
||||
<Version>
|
||||
<GCC>11.2.0</GCC>
|
||||
<GDB>9.2.90</GDB>
|
||||
<Revision>2</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory />
|
||||
<ConfigurationType>DEBUG</ConfigurationType>
|
||||
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
|
||||
<MakeCommandTemplate>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<RemoteHost>
|
||||
<HostName>BuildMachine</HostName>
|
||||
<Transport>BuiltinShortcut</Transport>
|
||||
</RemoteHost>
|
||||
<Command>$(ToolchainNinja)</Command>
|
||||
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</MakeCommandTemplate>
|
||||
<CMakeCommand>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<RemoteHost>
|
||||
<HostName>BuildMachine</HostName>
|
||||
<Transport>BuiltinShortcut</Transport>
|
||||
</RemoteHost>
|
||||
<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>4904362e-3b9f-44cc-9c44-740b27fdfbe5</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
<ConfigurationNameCase>Upper</ConfigurationNameCase>
|
||||
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>release/v5.0</Version>
|
||||
<Subdirectory>esp-idf/v5.0</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>
|
||||
<CustomBreakCommand>
|
||||
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
|
||||
<RemoteHost>
|
||||
<HostName>BuildMachine</HostName>
|
||||
<Transport>BuiltinShortcut</Transport>
|
||||
</RemoteHost>
|
||||
<BackgroundMode xsi:nil="true" />
|
||||
</CustomBreakCommand>
|
||||
</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>True</Enabled>
|
||||
<ExtraSettings>
|
||||
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
|
||||
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
|
||||
<DiscoverySettings>
|
||||
<Mode>Enabled</Mode>
|
||||
<SearchInProjectDir>true</SearchInProjectDir>
|
||||
<SearchInSourceDirs>true</SearchInSourceDirs>
|
||||
<SearchInIncludeSubdirs>true</SearchInIncludeSubdirs>
|
||||
</DiscoverySettings>
|
||||
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
|
||||
<FormattingEngine xsi:nil="true" />
|
||||
</ExtraSettings>
|
||||
<CodeAnalyzerSettings>
|
||||
<Enabled>false</Enabled>
|
||||
<SelectedAnalyzers>
|
||||
<string>apiModeling.google.GTest</string>
|
||||
<string>core.builtin.BuiltinFunctions</string>
|
||||
<string>core.builtin.NoReturnFunctions</string>
|
||||
<string>core.CallAndMessage</string>
|
||||
<string>core.DivideZero</string>
|
||||
<string>core.DynamicTypePropagation</string>
|
||||
<string>core.NonnilStringConstants</string>
|
||||
<string>core.NonNullParamChecker</string>
|
||||
<string>core.NullDereference</string>
|
||||
<string>core.StackAddressEscape</string>
|
||||
<string>core.UndefinedBinaryOperatorResult</string>
|
||||
<string>core.uninitialized.ArraySubscript</string>
|
||||
<string>core.uninitialized.Assign</string>
|
||||
<string>core.uninitialized.Branch</string>
|
||||
<string>core.uninitialized.CapturedBlockVariable</string>
|
||||
<string>core.uninitialized.UndefReturn</string>
|
||||
<string>core.VLASize</string>
|
||||
<string>cplusplus.NewDelete</string>
|
||||
<string>cplusplus.NewDeleteLeaks</string>
|
||||
<string>cplusplus.SelfAssignment</string>
|
||||
<string>deadcode.DeadStores</string>
|
||||
<string>nullability.NullPassedToNonnull</string>
|
||||
<string>nullability.NullReturnedFromNonnull</string>
|
||||
<string>security.insecureAPI.getpw</string>
|
||||
<string>security.insecureAPI.gets</string>
|
||||
<string>security.insecureAPI.mkstemp</string>
|
||||
<string>security.insecureAPI.mktemp</string>
|
||||
<string>security.insecureAPI.UncheckedReturn</string>
|
||||
<string>security.insecureAPI.vfork</string>
|
||||
<string>unix.API</string>
|
||||
<string>unix.cstring.BadSizeArg</string>
|
||||
<string>unix.cstring.NullArg</string>
|
||||
<string>unix.Malloc</string>
|
||||
<string>unix.MallocSizeof</string>
|
||||
<string>unix.MismatchedDeallocator</string>
|
||||
<string>unix.StdCLibraryFunctions</string>
|
||||
<string>unix.Vfork</string>
|
||||
</SelectedAnalyzers>
|
||||
<ExtraArguments>
|
||||
<string>-analyzer-store=region</string>
|
||||
<string>-analyzer-opt-analyze-nested-blocks</string>
|
||||
<string>-analyzer-eagerly-assume</string>
|
||||
</ExtraArguments>
|
||||
</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>
|
||||
<GDBPreStartupCommands />
|
||||
<GDBStartupCommands />
|
||||
<GDBFinalizationCommands />
|
||||
</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 13000" -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>
|
|
@ -35,7 +35,7 @@
|
|||
#include <wolfssl/ssl.h>
|
||||
|
||||
#ifdef WOLFSSL_TRACK_MEMORY
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -52,15 +52,17 @@
|
|||
#define USE_MY_PRIVATE_CONFIG
|
||||
|
||||
#ifdef USE_MY_PRIVATE_CONFIG
|
||||
#include "/workspace/my_private_config.h"
|
||||
#include "/workspace/my_private_config.h"
|
||||
#else
|
||||
/* The examples use WiFi configuration that you can set via project configuration menu
|
||||
|
||||
If you'd rather not, just change the below entries to strings with
|
||||
the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
|
||||
*/
|
||||
#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
|
||||
#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
||||
/*
|
||||
** The examples use WiFi configuration that you can set via project
|
||||
** configuration menu
|
||||
**
|
||||
** If you'd rather not, just change the below entries to strings with
|
||||
** the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
|
||||
*/
|
||||
#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
|
||||
#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
||||
#endif
|
||||
|
||||
/* ESP lwip */
|
||||
|
@ -72,7 +74,7 @@
|
|||
#define TLS_SMP_CLIENT_TASK_WORDS 10240
|
||||
#define TLS_SMP_CLIENT_TASK_PRIORITY 8
|
||||
|
||||
#define TLS_SMP_TARGET_HOST "192.168.1.144"
|
||||
#define TLS_SMP_TARGET_HOST "192.168.25.114"
|
||||
|
||||
|
||||
/* include certificates. Note that there is an experiation date!
|
||||
|
@ -129,20 +131,31 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
|||
{
|
||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
|
||||
esp_wifi_connect();
|
||||
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||
if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY) {
|
||||
esp_wifi_connect();
|
||||
s_retry_num++;
|
||||
ESP_LOGI(TAG, "retry to connect to the AP");
|
||||
} else {
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
||||
}
|
||||
else {
|
||||
if ( event_base == WIFI_EVENT
|
||||
&&
|
||||
event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||
|
||||
/* WiFi disconnected event */
|
||||
if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY) {
|
||||
esp_wifi_connect();
|
||||
s_retry_num++;
|
||||
ESP_LOGI(TAG, "retry to connect to the AP");
|
||||
}
|
||||
else {
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
||||
}
|
||||
ESP_LOGI(TAG, "connect to the AP fail");
|
||||
} /* is WiFi disconnected event */
|
||||
else {
|
||||
if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
||||
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
|
||||
ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
|
||||
s_retry_num = 0;
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
|
||||
} /* is got IP event */
|
||||
}
|
||||
ESP_LOGI(TAG,"connect to the AP fail");
|
||||
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
||||
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
|
||||
ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
|
||||
s_retry_num = 0;
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +163,9 @@ int set_time() {
|
|||
/* we'll also return a result code of zero */
|
||||
int res = 0;
|
||||
|
||||
//*ideally, we'd like to set time from network, but let's set a default time, just in case */
|
||||
/* ideally, we'd like to set time from network,
|
||||
** but let's set a default time, just in case
|
||||
*/
|
||||
struct tm timeinfo;
|
||||
timeinfo.tm_year = 2022 - 1900;
|
||||
timeinfo.tm_mon = 3;
|
||||
|
@ -270,17 +285,9 @@ int tls_smp_client_task() {
|
|||
struct hostent *hp;
|
||||
struct ip4_addr *ip4_addr;
|
||||
|
||||
|
||||
struct timeval tv_now;
|
||||
|
||||
WOLFSSL_ENTER("tls_smp_client_task");
|
||||
|
||||
/* see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#overview */
|
||||
// ret = gettimeofday(&tv_now, NULL);
|
||||
/* 0x0005dcacd95af765 */
|
||||
// int64_t time_us = (int64_t)tv_now.tv_sec * 1000000L + (int64_t)tv_now.tv_usec;
|
||||
|
||||
// WOLFSSL_MSG(time_us) ;
|
||||
|
||||
/* declare wolfSSL objects */
|
||||
WOLFSSL_CTX *ctx = NULL; /* the wolfSSL context object*/
|
||||
|
@ -288,9 +295,9 @@ int tls_smp_client_task() {
|
|||
|
||||
|
||||
#ifdef DEBUG_WOLFSSL
|
||||
WOLFSSL_MSG("Debug ON");
|
||||
ESP_LOGI(TAG,"Debug ON");
|
||||
wolfSSL_Debugging_ON();
|
||||
//ShowCiphers();
|
||||
/* ShowCiphers(); */
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -318,14 +325,14 @@ int tls_smp_client_task() {
|
|||
|
||||
if (*targetServer >= '1' && *targetServer <= '9') {
|
||||
/* Get the server IPv4 address from the command line call */
|
||||
WOLFSSL_MSG("inet_pton");
|
||||
ESP_LOGI(TAG,"inet_pton");
|
||||
if ((ret = inet_pton(AF_INET,
|
||||
TLS_SMP_TARGET_HOST,
|
||||
&servAddr.sin_addr)) != 1) {
|
||||
ESP_LOGE(TAG, "ERROR: invalid address ret=%d\n", ret);
|
||||
|
||||
ret = WOLFSSL_FAILURE;
|
||||
WOLFSSL_ERROR_MSG("ERROR: invalid address\n");
|
||||
ESP_LOGE(TAG, "ERROR: invalid address\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -351,17 +358,17 @@ int tls_smp_client_task() {
|
|||
*/
|
||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sockfd > 0) {
|
||||
WOLFSSL_MSG("socket creation successful\n");
|
||||
ESP_LOGI(TAG,"socket creation successful\n");
|
||||
}
|
||||
else {
|
||||
// TODO show errno
|
||||
ret = WOLFSSL_FAILURE;
|
||||
WOLFSSL_ERROR_MSG("ERROR: failed to create a socket.\n");
|
||||
ESP_LOGE(TAG, "ERROR: failed to create a socket.\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("Skipping socket create.\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "Skipping socket create.\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -383,19 +390,22 @@ int tls_smp_client_task() {
|
|||
* Upon successful completion, connect() shall return 0; otherwise,
|
||||
* -1 shall be returned and errno set to indicate the error.
|
||||
*/
|
||||
int connectResult = connect(sockfd, (struct sockaddr*) &servAddr, sizeof(servAddr));
|
||||
int connectResult = connect(sockfd,
|
||||
(struct sockaddr*) &servAddr,
|
||||
sizeof(servAddr)
|
||||
);
|
||||
if (0 == connectResult) {
|
||||
WOLFSSL_MSG("sockfd connect successful\n");
|
||||
ESP_LOGI(TAG,"sockfd connect successful\n");
|
||||
}
|
||||
else {
|
||||
// TODO show errno
|
||||
WOLFSSL_ERROR_MSG("ERROR: socket connect failed\n");
|
||||
ESP_LOGE(TAG, "ERROR: socket connect failed\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("Skipping socket connect.\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "Skipping socket connect.\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -418,19 +428,19 @@ int tls_smp_client_task() {
|
|||
*/
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
/* only proceed if the prior step was successful */
|
||||
WOLFSSL_MSG("calling wolfSSL_Init");
|
||||
ESP_LOGI(TAG,"calling wolfSSL_Init");
|
||||
ret = wolfSSL_Init();
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("wolfSSL_Init successful\n");
|
||||
ESP_LOGI(TAG,"wolfSSL_Init successful\n");
|
||||
}
|
||||
else {
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_Init failed\n");
|
||||
ESP_LOGE(TAG, "ERROR: wolfSSL_Init failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("Skipping wolfSSL_Init\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "Skipping wolfSSL_Init\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -458,21 +468,21 @@ int tls_smp_client_task() {
|
|||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_METHOD* method = wolfTLSv1_3_client_method();
|
||||
if (method == NULL) {
|
||||
WOLFSSL_ERROR_MSG("ERROR : failed to get wolfTLSv1_3_client_method.\n");
|
||||
ESP_LOGE(TAG, "ERROR : failed to get wolfTLSv1_3_client_method.\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
else {
|
||||
ctx = wolfSSL_CTX_new(method);
|
||||
|
||||
if (ctx == NULL) {
|
||||
WOLFSSL_ERROR_MSG("ERROR : failed to create WOLFSSL_CTX\n");
|
||||
ESP_LOGE(TAG, "ERROR : failed to create WOLFSSL_CTX\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("skipping wolfSSL_CTX_new\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "skipping wolfSSL_CTX_new\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -515,22 +525,22 @@ int tls_smp_client_task() {
|
|||
***************************************************************************
|
||||
*/
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("Loading cert");
|
||||
ESP_LOGI(TAG, "Loading cert");
|
||||
ret = wolfSSL_CTX_use_certificate_buffer(ctx,
|
||||
CERT_FILE,
|
||||
sizeof_CERT_FILE(),
|
||||
WOLFSSL_FILETYPE_PEM);
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("wolfSSL_CTX_use_certificate_buffer successful\n");
|
||||
ESP_LOGI(TAG, "wolfSSL_CTX_use_certificate_buffer successful\n");
|
||||
}
|
||||
else {
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_CTX_use_certificate_buffer failed\n");
|
||||
ESP_LOGE(TAG, "ERROR: wolfSSL_CTX_use_certificate_buffer failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("skipping wolfSSL_CTX_use_certificate_buffer\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "skipping wolfSSL_CTX_use_certificate_buffer\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -582,16 +592,16 @@ int tls_smp_client_task() {
|
|||
sizeof_KEY_FILE(),
|
||||
WOLFSSL_FILETYPE_PEM);
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("wolfSSL_CTX_use_PrivateKey_buffer successful\n");
|
||||
ESP_LOGI(TAG, "wolfSSL_CTX_use_PrivateKey_buffer successful\n");
|
||||
}
|
||||
else {
|
||||
/* TODO fetch and print expiration date since it is a common fail */
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_CTX_use_PrivateKey_buffer failed\n");
|
||||
ESP_LOGE(TAG, "ERROR: wolfSSL_CTX_use_PrivateKey_buffer failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("Skipping wolfSSL_CTX_use_PrivateKey_buffer\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "Skipping wolfSSL_CTX_use_PrivateKey_buffer\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -637,15 +647,15 @@ int tls_smp_client_task() {
|
|||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ret = wolfSSL_CTX_load_verify_buffer(ctx, CA_FILE, sizeof_CA_FILE(), WOLFSSL_FILETYPE_PEM);
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("wolfSSL_CTX_load_verify_buffer successful\n");
|
||||
ESP_LOGI(TAG, "wolfSSL_CTX_load_verify_buffer successful\n");
|
||||
}
|
||||
else {
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_CTX_load_verify_buffer failed\n");
|
||||
ESP_LOGE(TAG, "ERROR: wolfSSL_CTX_load_verify_buffer failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("skipping wolfSSL_CTX_load_verify_buffer\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "skipping wolfSSL_CTX_load_verify_buffer\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -674,13 +684,13 @@ int tls_smp_client_task() {
|
|||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ssl = wolfSSL_new(ctx);
|
||||
if (ssl == NULL) {
|
||||
WOLFSSL_ERROR_MSG("ERROR : failed to create WOLFSSL object\n");
|
||||
ESP_LOGE(TAG, "ERROR : failed to create WOLFSSL object\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("skipping wolfSSL_new\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "skipping wolfSSL_new\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -708,15 +718,15 @@ int tls_smp_client_task() {
|
|||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ret = wolfSSL_set_fd(ssl, sockfd);
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("wolfSSL_set_fd successful\n");
|
||||
ESP_LOGI(TAG, "wolfSSL_set_fd successful\n");
|
||||
}
|
||||
else {
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_set_fd failed\n");
|
||||
ESP_LOGE(TAG, "ERROR: wolfSSL_set_fd failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("skipping wolfSSL_set_fd\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "skipping wolfSSL_set_fd\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -769,15 +779,15 @@ int tls_smp_client_task() {
|
|||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ret = wolfSSL_connect(ssl);
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("wolfSSL_connect successful\n");
|
||||
ESP_LOGI(TAG, "wolfSSL_connect successful\n");
|
||||
}
|
||||
else {
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_connect failed\n");
|
||||
ESP_LOGE(TAG, "ERROR: wolfSSL_connect failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("skipping wolfSSL_connect\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "skipping wolfSSL_connect\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -838,8 +848,8 @@ int tls_smp_client_task() {
|
|||
/* write the message over secure connection to the server */
|
||||
if (wolfSSL_write(ssl, sendMessage, len) == len) {
|
||||
|
||||
WOLFSSL_MSG("wolfSSL_write message sent successfully:\n");
|
||||
WOLFSSL_MSG(sendMessage);
|
||||
ESP_LOGI(TAG, "wolfSSL_write message sent successfully:\n");
|
||||
ESP_LOGI(TAG, "%s", sendMessage);
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -848,15 +858,15 @@ int tls_smp_client_task() {
|
|||
|
||||
char err_buff[80];
|
||||
wolfSSL_ERR_error_string(err, err_buff);
|
||||
WOLFSSL_ERROR_MSG(err_buff);
|
||||
ESP_LOGE(TAG, "%s", err_buff);
|
||||
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_write FAILED.\n");
|
||||
ESP_LOGE(TAG, "ERROR: wolfSSL_write FAILED.\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* a prior error occured */
|
||||
WOLFSSL_ERROR_MSG("Skipping wolfSSL_write\n");
|
||||
/* a prior error occurred */
|
||||
ESP_LOGE(TAG, "Skipping wolfSSL_write\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -920,9 +930,9 @@ int tls_smp_client_task() {
|
|||
|
||||
/* one or more bytes received is considered success */
|
||||
|
||||
/* Print to stdout any data the server sends */
|
||||
WOLFSSL_MSG("wolfSSL_read received message:\n");
|
||||
WOLFSSL_MSG(buff);
|
||||
/* Print any data the server sends */
|
||||
ESP_LOGI(TAG, "wolfSSL_read received message:\n");
|
||||
ESP_LOGI(TAG, "%s", buff);
|
||||
}
|
||||
else {
|
||||
/* get the integer error value */
|
||||
|
@ -932,9 +942,9 @@ int tls_smp_client_task() {
|
|||
/* get the human-readable error string. */
|
||||
char err_buff[80] = "\x0";
|
||||
wolfSSL_ERR_error_string(err, err_buff);
|
||||
WOLFSSL_ERROR_MSG(err_buff);
|
||||
ESP_LOGE(TAG, "%s", err_buff);
|
||||
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_read FAILED.\n");
|
||||
ESP_LOGE(TAG, "ERROR: wolfSSL_read FAILED.\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -952,26 +962,42 @@ int tls_smp_client_task() {
|
|||
}
|
||||
|
||||
if (ssl) {
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
}
|
||||
|
||||
if (ctx) {
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
}
|
||||
|
||||
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
|
||||
|
||||
WOLFSSL_LEAVE("tls_smp_client_task", ret);
|
||||
WOLFSSL_MSG("tls_smp_client_task done!\n");
|
||||
ESP_LOGI(TAG,"tls_smp_client_task done!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
//Initialize NVS
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
|
||||
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING);
|
||||
ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET);
|
||||
ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz", CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ);
|
||||
ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount);
|
||||
|
||||
ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL));
|
||||
|
||||
/* Initialize NVS */
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES
|
||||
||
|
||||
ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||
ret = nvs_flash_init();
|
||||
}
|
||||
|
@ -986,6 +1012,8 @@ void app_main(void)
|
|||
ESP_LOGI(TAG, "main loop");
|
||||
vTaskDelay(DelayTicks ? DelayTicks : 1); /* Minimum delay = 1 tick */
|
||||
tls_smp_client_task();
|
||||
|
||||
/* upon completion, wait forever */
|
||||
for (;;)
|
||||
{
|
||||
vTaskDelay(DelayTicks ? DelayTicks : 1); /* Minimum delay = 1 tick */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# 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=55000
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
# minimum C3 chip revision known to work is 2.
|
||||
# rev 0 and 1 not available for testing.
|
||||
# all revisions expected to work.
|
||||
CONFIG_ESP32C3_REV_MIN_0=
|
||||
CONFIG_ESP32C3_REV_MIN_1=
|
||||
CONFIG_ESP32C3_REV_MIN_2=y
|
||||
CONFIG_ESP32C3_REV_MIN_3=
|
||||
|
||||
#
|
||||
# Partition Table
|
||||
#
|
||||
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||
CONFIG_PARTITION_TABLE_MD5=y
|
||||
# end of Partition Table
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31729.503
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "ESP32-TLS13-server", "ESP32-TLS13-wifi_station-server.vgdbproj", "{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}"
|
||||
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
|
||||
{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB
|
||||
{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}.Debug|VisualGDB.Build.0 = Debug|VisualGDB
|
||||
{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}.Release|VisualGDB.ActiveCfg = Release|VisualGDB
|
||||
{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}.Release|VisualGDB.Build.0 = Release|VisualGDB
|
||||
{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB
|
||||
{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB
|
||||
{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB
|
||||
{6B1C0FCA-05B1-4F65-A57E-5EC9768F9866}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C818398D-7E23-4E3B-8076-2DCDCB03967C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -20,9 +20,10 @@
|
|||
<Version>
|
||||
<GCC>8.4.0</GCC>
|
||||
<GDB>8.1.0</GDB>
|
||||
<Revision>7</Revision>
|
||||
<Revision>9</Revision>
|
||||
</Version>
|
||||
</ToolchainID>
|
||||
<RelativeSourceDirectory />
|
||||
<ConfigurationType>DEBUG</ConfigurationType>
|
||||
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
|
||||
<MakeCommandTemplate>
|
||||
|
@ -57,6 +58,7 @@
|
|||
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
|
||||
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
|
||||
</ProjectItemSettings>
|
||||
<TargetSpecificSettings />
|
||||
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
|
||||
<ProjectGUID>6b1c0fca-05b1-4f65-a57e-5ec9768f9866</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
|
@ -65,8 +67,8 @@
|
|||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>release/v4.4</Version>
|
||||
<Subdirectory>esp-idf/v4.4</Subdirectory>
|
||||
<Version>v4.4.1</Version>
|
||||
<Subdirectory>esp-idf/v4.4.1</Subdirectory>
|
||||
<Type>ESPIDF</Type>
|
||||
</IDFCheckout>
|
||||
<COMPort>COM20</COMPort>
|
||||
|
@ -155,6 +157,7 @@
|
|||
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
|
||||
</CustomShortcuts>
|
||||
<UserDefinedVariables />
|
||||
<ImportedPropertySheets />
|
||||
<CodeSense>
|
||||
<Enabled>Unknown</Enabled>
|
||||
<ExtraSettings>
|
||||
|
@ -177,6 +180,7 @@
|
|||
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
|
||||
</VisualGDBConfiguration>
|
||||
</Configurations>
|
||||
<ProgramArgumentsSuggestions />
|
||||
<Debug xsi:type="com.visualgdb.debug.embedded">
|
||||
<AdditionalStartupCommands />
|
||||
<AdditionalGDBSettings>
|
|
@ -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>591b9b62-1581-445d-93c1-f2751ed04cfc</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>11.2.0</GCC>
|
||||
<GDB>9.2.90</GDB>
|
||||
<Revision>2</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>6b1c0fca-05b1-4f65-a57e-5ec9768f9866</ProjectGUID>
|
||||
<VirtualFolders />
|
||||
<ConfigurationNameCase>Upper</ConfigurationNameCase>
|
||||
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
|
||||
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
|
||||
<ESPIDFExtension>
|
||||
<IDFCheckout>
|
||||
<Version>release/v5.0</Version>
|
||||
<Subdirectory>esp-idf/v5.0</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 13000" -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>
|
|
@ -31,15 +31,17 @@
|
|||
#define WOLFSSL_ESPIDF
|
||||
#define WOLFSSL_ESPWROOM32
|
||||
#define WOLFSSL_USER_SETTINGS
|
||||
#include <wolfssl/wolfcrypt/settings.h> // make sure this appears before any other wolfSSL headers
|
||||
|
||||
|
||||
#include <wolfssl/version.h>
|
||||
/* make sure user_settings.h appears before any other wolfSSL headers */
|
||||
#include <user_settings.h>
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
#ifdef WOLFSSL_TRACK_MEMORY
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#include <wolfssl/wolfcrypt/mem_track.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
******************************************************************************
|
||||
|
@ -48,19 +50,23 @@
|
|||
******************************************************************************
|
||||
**/
|
||||
|
||||
/* when using a private config with plain text passwords, not my_private_config.h should be excluded from git updates */
|
||||
/* when using a private config with plain text passwords,
|
||||
** define USE_MY_PRIVATE_CONFIG.
|
||||
** note my_private_config.h should be excluded from git updates
|
||||
*/
|
||||
#define USE_MY_PRIVATE_CONFIG
|
||||
|
||||
#ifdef USE_MY_PRIVATE_CONFIG
|
||||
#include "/workspace/my_private_config.h"
|
||||
#include "/mnt/c/workspace/my_private_config.h"
|
||||
#else
|
||||
/* The examples use WiFi configuration that you can set via project configuration menu
|
||||
|
||||
If you'd rather not, just change the below entries to strings with
|
||||
the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
|
||||
*/
|
||||
#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
|
||||
#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
||||
/* The examples use WiFi configuration that you can set via project
|
||||
* configuration menu
|
||||
*
|
||||
* If you'd rather not, just change the below entries to strings with
|
||||
* the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
|
||||
*/
|
||||
#define EXAMPLE_ESP_WIFI_SSID CONFIG_ESP_WIFI_SSID
|
||||
#define EXAMPLE_ESP_WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
||||
#endif
|
||||
|
||||
/* ESP lwip */
|
||||
|
@ -72,14 +78,14 @@
|
|||
#define TLS_SMP_CLIENT_TASK_WORDS 10240
|
||||
#define TLS_SMP_CLIENT_TASK_PRIORITY 8
|
||||
|
||||
/* include certificates. Note that there is an experiation date!
|
||||
*
|
||||
* See also https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h
|
||||
|
||||
for example:
|
||||
|
||||
#define USE_CERT_BUFFERS_2048
|
||||
#include <wolfssl/certs_test.h>
|
||||
/* include certificates. Note that there is an expiration date!
|
||||
**
|
||||
** See also https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h
|
||||
**
|
||||
** for example:
|
||||
**
|
||||
** #define USE_CERT_BUFFERS_2048
|
||||
** #include <wolfssl/certs_test.h>
|
||||
*/
|
||||
#include "embedded_CLIENT_CERT_FILE.h"
|
||||
#include "embedded_SERVER_CERT_FILE.h"
|
||||
|
@ -107,9 +113,11 @@ TickType_t DelayTicks = 5000 / portTICK_PERIOD_MS;
|
|||
/* FreeRTOS event group to signal when we are connected*/
|
||||
static EventGroupHandle_t s_wifi_event_group;
|
||||
|
||||
/* The event group allows multiple bits for each event, but we only care about two events:
|
||||
* - we are connected to the AP with an IP
|
||||
* - we failed to connect after the maximum amount of retries */
|
||||
/* The event group allows multiple bits for each event,
|
||||
** but we only care about two events:
|
||||
** - we are connected to the AP with an IP
|
||||
** - we failed to connect after the maximum amount of retries
|
||||
*/
|
||||
#define WIFI_CONNECTED_BIT BIT0
|
||||
#define WIFI_FAIL_BIT BIT1
|
||||
|
||||
|
@ -120,30 +128,48 @@ static int s_retry_num = 0;
|
|||
static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void* event_data)
|
||||
{
|
||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
|
||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START)
|
||||
{
|
||||
esp_wifi_connect();
|
||||
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||
if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY) {
|
||||
}
|
||||
else if (event_base == WIFI_EVENT
|
||||
&&
|
||||
event_id == WIFI_EVENT_STA_DISCONNECTED)
|
||||
{
|
||||
|
||||
/* we have WiFi disconnected event, so try reconnect */
|
||||
if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY)
|
||||
{
|
||||
esp_wifi_connect();
|
||||
s_retry_num++;
|
||||
ESP_LOGI(TAG, "retry to connect to the AP");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
||||
}
|
||||
ESP_LOGI(TAG,"connect to the AP fail");
|
||||
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
||||
ESP_LOGI(TAG, "connect to the AP fail");
|
||||
}
|
||||
else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP)
|
||||
{
|
||||
|
||||
/* we have an IP address! */
|
||||
ip_event_got_ip_t* event = (ip_event_got_ip_t*) event_data;
|
||||
ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->ip_info.ip));
|
||||
s_retry_num = 0;
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_CONNECTED_BIT);
|
||||
}
|
||||
else {
|
||||
ESP_LOGI(TAG, "WiFi event not handled: event_id = %li", event_id);
|
||||
}
|
||||
}
|
||||
|
||||
int set_time() {
|
||||
/* we'll also return a result code of zero */
|
||||
int res = 0;
|
||||
|
||||
//*ideally, we'd like to set time from network, but let's set a default time, just in case */
|
||||
/*ideally, we'd like to set time from network,
|
||||
but let's set a default time, just in case */
|
||||
struct tm timeinfo;
|
||||
timeinfo.tm_year = 2022 - 1900;
|
||||
timeinfo.tm_mon = 3;
|
||||
|
@ -209,9 +235,11 @@ void wifi_init_sta(void)
|
|||
.sta = {
|
||||
.ssid = EXAMPLE_ESP_WIFI_SSID,
|
||||
.password = EXAMPLE_ESP_WIFI_PASS,
|
||||
/* Setting a password implies station will connect to all security modes including WEP/WPA.
|
||||
* However these modes are deprecated and not advisable to be used. Incase your Access point
|
||||
* doesn't support WPA2, these mode can be enabled by commenting below line */
|
||||
/* Setting a password implies station will connect to all security
|
||||
* modes including WEP/WPA.However these modes are deprecated and
|
||||
* not advisable to be used. In case your Access point doesn't
|
||||
* support WPA2, these mode can be enabled by commenting below line
|
||||
*/
|
||||
.threshold.authmode = WIFI_AUTH_WPA2_PSK,
|
||||
|
||||
.pmf_cfg = {
|
||||
|
@ -226,29 +254,40 @@ void wifi_init_sta(void)
|
|||
|
||||
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
||||
|
||||
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum
|
||||
* number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
|
||||
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT)
|
||||
** or connection failed for the maximum number of re-tries (WIFI_FAIL_BIT).
|
||||
** The bits are set by event_handler() (see above)
|
||||
*/
|
||||
EventBits_t bits = xEventGroupWaitBits(s_wifi_event_group,
|
||||
WIFI_CONNECTED_BIT | WIFI_FAIL_BIT,
|
||||
pdFALSE,
|
||||
pdFALSE,
|
||||
portMAX_DELAY);
|
||||
|
||||
/* xEventGroupWaitBits() returns the bits before the call returned, hence we can test which event actually
|
||||
* happened. */
|
||||
/* xEventGroupWaitBits() returns the bits before the call returned,
|
||||
** hence we can test which event actually happened.
|
||||
*/
|
||||
if (bits & WIFI_CONNECTED_BIT) {
|
||||
ESP_LOGI(TAG, "connected to ap SSID:%s password:%s",
|
||||
EXAMPLE_ESP_WIFI_SSID, EXAMPLE_ESP_WIFI_PASS);
|
||||
} else if (bits & WIFI_FAIL_BIT) {
|
||||
}
|
||||
else if (bits & WIFI_FAIL_BIT) {
|
||||
ESP_LOGI(TAG, "Failed to connect to SSID:%s, password:%s",
|
||||
EXAMPLE_ESP_WIFI_SSID, EXAMPLE_ESP_WIFI_PASS);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "UNEXPECTED EVENT");
|
||||
}
|
||||
|
||||
/* The event will not be processed after unregister */
|
||||
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_STA_GOT_IP, instance_got_ip));
|
||||
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, instance_any_id));
|
||||
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(IP_EVENT,
|
||||
IP_EVENT_STA_GOT_IP,
|
||||
instance_got_ip)
|
||||
);
|
||||
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT,
|
||||
ESP_EVENT_ANY_ID,
|
||||
instance_any_id)
|
||||
);
|
||||
vEventGroupDelete(s_wifi_event_group);
|
||||
}
|
||||
|
||||
|
@ -258,7 +297,7 @@ int tls_smp_server_task() {
|
|||
struct sockaddr_in servAddr;
|
||||
const int BUFF_SIZE = 256;
|
||||
char buff[BUFF_SIZE];
|
||||
size_t len; /* we'll be looking at the length of messages sent and received */
|
||||
size_t len; /* we'll be looking at the length of messages sent & received */
|
||||
|
||||
struct sockaddr_in clientAddr;
|
||||
socklen_t size = sizeof(clientAddr);
|
||||
|
@ -270,7 +309,10 @@ int tls_smp_server_task() {
|
|||
|
||||
/* declare wolfSSL objects */
|
||||
WOLFSSL_CTX *ctx = NULL; /* the wolfSSL context object*/
|
||||
WOLFSSL *ssl = NULL; /* although called "ssl" is is the secure object for reading and writings data*/
|
||||
|
||||
|
||||
WOLFSSL *ssl = NULL; /* although called "ssl" this is the secure object
|
||||
for reading and writing data*/
|
||||
|
||||
#ifdef HAVE_SIGNAL
|
||||
signal(SIGINT, sig_handler);
|
||||
|
@ -279,7 +321,7 @@ int tls_smp_server_task() {
|
|||
#ifdef DEBUG_WOLFSSL
|
||||
wolfSSL_Debugging_ON();
|
||||
WOLFSSL_MSG("Debug ON v0.2b");
|
||||
//ShowCiphers();
|
||||
/* ShowCiphers(); */
|
||||
#endif /* DEBUG_WOLFSSL */
|
||||
|
||||
#ifndef WOLFSSL_TLS13
|
||||
|
@ -297,7 +339,7 @@ int tls_smp_server_task() {
|
|||
|
||||
/*
|
||||
***************************************************************************
|
||||
* Create a socket that uses an internet IPv4 address,
|
||||
* Create a socket that uses an Internet IPv4 address,
|
||||
* Sets the socket to be stream based (TCP),
|
||||
* 0 means choose the default protocol.
|
||||
*
|
||||
|
@ -325,9 +367,9 @@ int tls_smp_server_task() {
|
|||
* Symbolic constants that can be used for the domain argument are
|
||||
* defined in the <sys/socket.h> header.
|
||||
*
|
||||
* The type argument specifies the socket type, which determines the semantics
|
||||
* of communication over the socket. The following socket types are defined;
|
||||
* implementations may specify additional socket types:
|
||||
* The type argument specifies the socket type, which determines the
|
||||
* semantics of communication over the socket. The following socket types
|
||||
* are defined; implementations may specify additional socket types:
|
||||
*
|
||||
* SOCK_STREAM Provides sequenced, reliable, bidirectional,
|
||||
* connection-mode byte streams, and may provide a
|
||||
|
@ -349,25 +391,32 @@ int tls_smp_server_task() {
|
|||
* used. The protocols supported by the system are
|
||||
* implementation-defined.
|
||||
*
|
||||
* The process may need to have appropriate privileges to use the socket() function or to create some sockets.
|
||||
* The process may need to have appropriate privileges to use the
|
||||
* socket() function or to create some sockets.
|
||||
*
|
||||
* Return Value
|
||||
* Upon successful completion, socket() shall return a non-negative integer,
|
||||
* the socket file descriptor. Otherwise, a value of -1 shall be returned
|
||||
* Upon successful completion, socket() shall return a non-negative
|
||||
* integer, the socket file descriptor.
|
||||
*
|
||||
* Otherwise, a value of -1 shall be returned
|
||||
* and errno set to indicate the error.
|
||||
*
|
||||
* Errors; The socket() function shall fail if:
|
||||
*
|
||||
* EAFNOSUPPORT The implementation does not support the specified address family.
|
||||
* EMFILE No more file descriptors are available for this process.
|
||||
* EAFNOSUPPORT The implementation does not support the specified
|
||||
* address family.
|
||||
* EMFILE No more file descriptors are available
|
||||
* for this process.
|
||||
* ENFILE No more file descriptors are available for the system.
|
||||
* EPROTONOSUPPORT The protocol is not supported by the address family, or the protocol is not supported by the implementation.
|
||||
* EPROTONOSUPPORT The protocol is not supported by the address family,
|
||||
* or the protocol is not supported by the implementation.
|
||||
* EPROTOTYPE The socket type is not supported by the protocol.
|
||||
*
|
||||
* The socket() function may fail if:
|
||||
*
|
||||
* EACCES The process does not have appropriate privileges.
|
||||
* ENOBUFS Insufficient resources were available in the system to perform the operation.
|
||||
* ENOBUFS Insufficient resources were available in the system to
|
||||
* perform the operation.
|
||||
* ENOMEM Insufficient memory was available to fulfill the request.
|
||||
*
|
||||
* see: https://linux.die.net/man/3/socket
|
||||
|
@ -421,12 +470,18 @@ int tls_smp_server_task() {
|
|||
* be set to the protocol number of TCP
|
||||
*
|
||||
* Return Value
|
||||
* On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
|
||||
* On success, zero is returned.
|
||||
* On error, -1 is returned, and errno is set appropriately.
|
||||
*
|
||||
* Errors
|
||||
* EBADF The argument sockfd is not a valid descriptor.
|
||||
* EFAULT The address pointed to by optval is not in a valid part of the process address space. For getsockopt(), this error may also be returned if optlen is not in a valid part of the process address space.
|
||||
* EINVAL optlen invalid in setsockopt(). In some cases this error can also occur for an invalid value in optval (e.g., for the IP_ADD_MEMBERSHIP option described in ip(7)).
|
||||
* EFAULT The address pointed to by optval is not in a valid part of
|
||||
* the process address space. For getsockopt(), this error
|
||||
* may also be returned if optlen is not in a valid part of
|
||||
* the process address space.
|
||||
* EINVAL optlen invalid in setsockopt(). In some cases this error
|
||||
* can also occur for an invalid value in optval
|
||||
* e.g., for the IP_ADD_MEMBERSHIP option described in ip(7)
|
||||
* ENOPROTOOPT The option is unknown at the level indicated.
|
||||
* ENOTSOCK The argument sockfd is a file, not a socket.
|
||||
*
|
||||
|
@ -446,7 +501,7 @@ int tls_smp_server_task() {
|
|||
WOLFSSL_MSG("setsockopt re-use addr successful\n");
|
||||
}
|
||||
else {
|
||||
// TODO show errno
|
||||
ESP_LOGE(TAG, "setsockopt failed with code %i", soc_ret);
|
||||
ret = WOLFSSL_FAILURE;
|
||||
WOLFSSL_ERROR_MSG("ERROR: failed to setsockopt addr on socket.\n");
|
||||
}
|
||||
|
@ -467,11 +522,9 @@ int tls_smp_server_task() {
|
|||
if (soc_ret == 0) {
|
||||
WOLFSSL_MSG("setsockopt re-use port successful\n");
|
||||
}
|
||||
else {
|
||||
// TODO show errno
|
||||
// ret = WOLFSSL_FAILURE;
|
||||
// TODO what's up with the error?
|
||||
WOLFSSL_ERROR_MSG("ERROR: failed to setsockopt port on socket. >> IGNORED << \n");
|
||||
else {
|
||||
WOLFSSL_MSG("Note: failed to setsockopt port on socket."
|
||||
" >> IGNORED << \n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -504,10 +557,12 @@ int tls_smp_server_task() {
|
|||
* a SOCK_STREAM socket may receive connections.
|
||||
*
|
||||
* Return Value
|
||||
* On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
|
||||
* On success, zero is returned.
|
||||
* On error, -1 is returned, and errno is set appropriately.
|
||||
*
|
||||
* Errors
|
||||
* EACCES The address is protected, and the user is not the superuser.
|
||||
* EACCES The address is protected, and
|
||||
* the user is not the superuser.
|
||||
* EADDRINUSE The given address is already in use.
|
||||
* EBADF sockfd is not a valid descriptor.
|
||||
* EINVAL The socket is already bound to an address.
|
||||
|
@ -520,7 +575,11 @@ int tls_smp_server_task() {
|
|||
*/
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
/* Bind the server socket to our port */
|
||||
int soc_ret = bind(sockfd, (struct sockaddr*)&servAddr, sizeof(servAddr));
|
||||
int soc_ret = bind(sockfd,
|
||||
(struct sockaddr*)&servAddr,
|
||||
sizeof(servAddr)
|
||||
);
|
||||
|
||||
if (soc_ret > -1) {
|
||||
WOLFSSL_MSG("socket bind successful\n");
|
||||
}
|
||||
|
@ -549,10 +608,10 @@ int tls_smp_server_task() {
|
|||
*
|
||||
* The backlog argument defines the maximum length to which the queue of
|
||||
* pending connections for sockfd may grow.If a connection request arrives
|
||||
* when the queue is full, the client may receive an error with an indication
|
||||
* of ECONNREFUSED or, if the underlying protocol supports retransmission,
|
||||
* the request may be ignored so that a later reattempt at connection
|
||||
* succeeds.
|
||||
* when the queue is full, the client may receive an error with an
|
||||
* indication of ECONNREFUSED or, if the underlying protocol supports
|
||||
* retransmission, the request may be ignored so that a later reattempt
|
||||
* at connection succeeds.
|
||||
*
|
||||
* Return Value
|
||||
* On success, zero is returned.
|
||||
|
@ -561,9 +620,10 @@ int tls_smp_server_task() {
|
|||
* EADDRINUSE Another socket is already listening on the same port.
|
||||
* EBADF The argument sockfd is not a valid descriptor.
|
||||
* ENOTSOCK The argument sockfd is not a socket.
|
||||
* EOPNOTSUPP The socket is not of a type that supports the listen() operation.
|
||||
* EOPNOTSUPP The socket is not of a type that supports
|
||||
* the listen() operation.
|
||||
*
|
||||
* ses: https://linux.die.net/man/2/listen
|
||||
* see: https://linux.die.net/man/2/listen
|
||||
*/
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
|
@ -620,11 +680,13 @@ int tls_smp_server_task() {
|
|||
* SSL/TLS protocol method for input.
|
||||
*
|
||||
* Returns
|
||||
* pointer If successful the call will return a pointer to the newly-created WOLFSSL_CTX.
|
||||
* pointer If successful the call will return a pointer
|
||||
* to the newly-created WOLFSSL_CTX.
|
||||
|
||||
* NULL upon failure.
|
||||
*
|
||||
* Parameters
|
||||
* method pointer to the desired WOLFSSL_METHOD to use for the SSL context.
|
||||
* method pointer to the desired WOLFSSL_METHOD to use for SSL context.
|
||||
* This is created using one of the wolfSSLvXX_XXXX_method() functions to
|
||||
* specify SSL/TLS/DTLS protocol level.
|
||||
*
|
||||
|
@ -635,7 +697,8 @@ int tls_smp_server_task() {
|
|||
WOLFSSL_METHOD* method = wolfTLSv1_3_server_method();
|
||||
WOLFSSL_MSG("calling wolfTLSv1_3_server_method");
|
||||
if (method == NULL) {
|
||||
WOLFSSL_ERROR_MSG("ERROR : failed to get wolfTLSv1_3_server_method.\n");
|
||||
WOLFSSL_ERROR_MSG("ERROR : "
|
||||
"failed to get wolfTLSv1_3_server_method.\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
else {
|
||||
|
@ -674,7 +737,8 @@ int tls_smp_server_task() {
|
|||
* Returns
|
||||
* SSL_SUCCESS upon success.
|
||||
* SSL_BAD_FILETYPE will be returned if the file is the wrong format.
|
||||
* SSL_BAD_FILE will be returned if the file doesn’t exist, can’t be read, or is corrupted.
|
||||
* SSL_BAD_FILE will be returned if the file doesn’t exist,
|
||||
* can’t be read, or is corrupted.
|
||||
* MEMORY_E will be returned if an out of memory condition occurs.
|
||||
* ASN_INPUT_E will be returned if Base16 decoding fails on the file.
|
||||
*
|
||||
|
@ -682,7 +746,8 @@ int tls_smp_server_task() {
|
|||
* ssl pointer to the SSL session, created with wolfSSL_new().
|
||||
* in buffer containing certificate to load.
|
||||
* sz size of the certificate located in buffer.
|
||||
* format format of the certificate to be loaded. Possible values are SSL_FILETYPE_ASN1 or SSL_FILETYPE_PEM.
|
||||
* format format of the certificate to be loaded.
|
||||
* Possible values are SSL_FILETYPE_ASN1 or SSL_FILETYPE_PEM.
|
||||
*
|
||||
*
|
||||
* Pay attention to expiration dates and the current date setting
|
||||
|
@ -701,7 +766,8 @@ int tls_smp_server_task() {
|
|||
WOLFSSL_MSG("wolfSSL_CTX_use_certificate_buffer successful\n");
|
||||
}
|
||||
else {
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_CTX_use_certificate_buffer failed\n");
|
||||
WOLFSSL_ERROR_MSG("ERROR: "
|
||||
"wolfSSL_CTX_use_certificate_buffer failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -732,18 +798,21 @@ int tls_smp_server_task() {
|
|||
* Please see the examples for proper usage.
|
||||
*
|
||||
* Returns
|
||||
* SSL_SUCCESS upon success
|
||||
* SSL_BAD_FILETYPE will be returned if the file is the wrong format.
|
||||
* SSL_BAD_FILE will be returned if the file doesn’t exist, can’t be read, or is corrupted.
|
||||
* MEMORY_E will be returned if an out of memory condition occurs.
|
||||
* ASN_INPUT_E will be returned if Base16 decoding fails on the file.
|
||||
* NO_PASSWORD will be returned if the key file is encrypted but no password is provided.
|
||||
* SSL_SUCCESS upon success.
|
||||
* SSL_BAD_FILETYPE returned if the file is the wrong format.
|
||||
* SSL_BAD_FILE returned if the file doesn’t exist,
|
||||
* can’t be read, or is corrupted.
|
||||
*
|
||||
* MEMORY_E returned if an out of memory condition occurs.
|
||||
* ASN_INPUT_E returned if Base16 decoding fails on the file.
|
||||
* NO_PASSWORD returned if the key file is encrypted
|
||||
* but no password is provided.
|
||||
*
|
||||
* Parameters
|
||||
* ctx pointer to the SSL context, created with wolfSSL_CTX_new().
|
||||
* inthe input buffer containing the private key to be loaded.
|
||||
* ctx pointer to the SSL context, created with wolfSSL_CTX_new().
|
||||
* in the input buffer containing the private key to be loaded.
|
||||
*
|
||||
* sz the size of the input buffer.
|
||||
* sz the size of the input buffer.
|
||||
*
|
||||
* format the format of the private key located in the input buffer(in).
|
||||
* Possible values are SSL_FILETYPE_ASN1 or SSL_FILETYPE_PEM.
|
||||
|
@ -756,12 +825,14 @@ int tls_smp_server_task() {
|
|||
KEY_FILE,
|
||||
sizeof_KEY_FILE(),
|
||||
WOLFSSL_FILETYPE_PEM);
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("wolfSSL_CTX_use_PrivateKey_buffer successful\n");
|
||||
}
|
||||
else {
|
||||
/* TODO fetch and print expiration date since it is a common fail */
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_CTX_use_PrivateKey_buffer failed\n");
|
||||
WOLFSSL_ERROR_MSG("ERROR: "
|
||||
"wolfSSL_CTX_use_PrivateKey_buffer failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -791,30 +862,39 @@ int tls_smp_server_task() {
|
|||
*
|
||||
* Returns
|
||||
*
|
||||
* SSL_SUCCESS upon success
|
||||
* SSL_BAD_FILETYPE will be returned if the file is the wrong format.
|
||||
* SSL_BAD_FILE will be returned if the file doesn’t exist, can’t be read, or is corrupted.
|
||||
* MEMORY_E will be returned if an out of memory condition occurs.
|
||||
* ASN_INPUT_E will be returned if Base16 decoding fails on the file.
|
||||
* BUFFER_E will be returned if a chain buffer is bigger than the receiving buffer.
|
||||
* SSL_SUCCESS upon success
|
||||
* SSL_BAD_FILETYPE returned if the file is the wrong format.
|
||||
* SSL_BAD_FILE returned if the file doesn’t exist, can’t be read,
|
||||
* or is corrupted.
|
||||
* MEMORY_E returned if an out of memory condition occurs.
|
||||
* ASN_INPUT_E returned if Base16 decoding fails on the file.
|
||||
* BUFFER_E returned if a chain buffer is bigger than
|
||||
* the receiving buffer.
|
||||
*
|
||||
* Parameters
|
||||
*
|
||||
* ctx pointer to the SSL context, created with wolfSSL_CTX_new().
|
||||
* in pointer to the CA certificate buffer.
|
||||
* sz size of the input CA certificate buffer, in.
|
||||
* format format of the buffer certificate, either SSL_FILETYPE_ASN1 or SSL_FILETYPE_PEM.
|
||||
* ctx pointer to the SSL context, created with wolfSSL_CTX_new().
|
||||
* in pointer to the CA certificate buffer.
|
||||
* sz size of the input CA certificate buffer, in.
|
||||
* format format of the buffer certificate, either SSL_FILETYPE_ASN1
|
||||
* or SSL_FILETYPE_PEM.
|
||||
*
|
||||
* see https://www.wolfssl.com/doxygen/group__CertsKeys.html#gaa37539cce3388c628ac4672cf5606785
|
||||
***************************************************************************
|
||||
*/
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ret = wolfSSL_CTX_load_verify_buffer(ctx, CA_FILE, sizeof_CA_FILE(), WOLFSSL_FILETYPE_PEM);
|
||||
ret = wolfSSL_CTX_load_verify_buffer(ctx,
|
||||
CA_FILE,
|
||||
sizeof_CA_FILE(),
|
||||
WOLFSSL_FILETYPE_PEM
|
||||
);
|
||||
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_MSG("wolfSSL_CTX_load_verify_buffer successful\n");
|
||||
}
|
||||
else {
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_CTX_load_verify_buffer failed\n");
|
||||
WOLFSSL_ERROR_MSG("ERROR: "
|
||||
"wolfSSL_CTX_load_verify_buffer failed\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -826,9 +906,6 @@ int tls_smp_server_task() {
|
|||
WOLFSSL_VERIFY_PEER | WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT,
|
||||
NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Continue to accept clients until mShutdown is issued */
|
||||
while (!mShutdown && (ret == WOLFSSL_SUCCESS)) {
|
||||
WOLFSSL_MSG("Waiting for a connection...\n");
|
||||
|
@ -836,19 +913,19 @@ int tls_smp_server_task() {
|
|||
/* Accept client connections */
|
||||
if ((mConnd = accept(sockfd, (struct sockaddr*)&clientAddr, &size))
|
||||
== -1) {
|
||||
// fprintf(stderr, "ERROR: failed to accept the connection\n\n");
|
||||
|
||||
ret = -1;
|
||||
// TODO goto exit;
|
||||
WOLFSSL_ERROR_MSG("ERROR: failed socket accept\n");
|
||||
goto exit;
|
||||
WOLFSSL_ERROR_MSG("ERROR: failed socket connection accept\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
/* Create a WOLFSSL object */
|
||||
if ((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||
// fprintf(stderr, "ERROR: failed to create WOLFSSL object\n");
|
||||
WOLFSSL_ERROR_MSG("ERROR: failed to create WOLFSSL object\n");
|
||||
ret = -1;
|
||||
//TODO goto exit;
|
||||
WOLFSSL_ERROR_MSG("ERROR: filed wolfSSL_new during loop\n");
|
||||
goto exit;
|
||||
WOLFSSL_ERROR_MSG("ERROR: failed wolfSSL_new during loop\n");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -868,17 +945,16 @@ int tls_smp_server_task() {
|
|||
/* Establish TLS connection */
|
||||
if ((ret = wolfSSL_accept(ssl)) != WOLFSSL_SUCCESS) {
|
||||
WOLFSSL_ERROR_MSG("ERROR: wolfSSL_accept\n");
|
||||
|
||||
ret = WOLFSSL_FAILURE;
|
||||
// fprintf(stderr,
|
||||
// "wolfSSL_accept error = %d\n",
|
||||
// wolfSSL_get_error(ssl, ret));
|
||||
// TODO goto exit;
|
||||
ESP_LOGE(TAG, "wolfSSL_accept error = %d\n",
|
||||
wolfSSL_get_error(ssl, ret));
|
||||
goto exit;
|
||||
}
|
||||
else {
|
||||
WOLFSSL_MSG("Client connected successfully\n");
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SECRET_CALLBACK
|
||||
wolfSSL_FreeArrays(ssl);
|
||||
#endif
|
||||
|
@ -886,16 +962,17 @@ int tls_smp_server_task() {
|
|||
/* Read the client data into our buff array */
|
||||
memset(buff, 0, sizeof(buff));
|
||||
if ((ret = wolfSSL_read(ssl, buff, sizeof(buff) - 1)) < 0) {
|
||||
// fprintf(stderr, "ERROR: failed to read\n");
|
||||
//TODO goto exit;
|
||||
ESP_LOGE(TAG, "wolfSSL_read error = %d\n",
|
||||
wolfSSL_get_error(ssl, ret));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Print to stdout any data the client sends */
|
||||
// printf("Client: %s\n", buff);
|
||||
/* Print any data the client sends */
|
||||
ESP_LOGI(TAG, "Client: %s\n", buff);
|
||||
|
||||
/* Check for server shutdown command */
|
||||
if (strncmp(buff, "shutdown", 8) == 0) {
|
||||
// printf("Shutdown command issued!\n");
|
||||
ESP_LOGI(TAG, "Shutdown command issued!\n");
|
||||
mShutdown = 1;
|
||||
}
|
||||
|
||||
|
@ -906,14 +983,15 @@ int tls_smp_server_task() {
|
|||
|
||||
/* Reply back to the client */
|
||||
if ((ret = wolfSSL_write(ssl, buff, len)) != len) {
|
||||
// fprintf(stderr, "ERROR: failed to write\n");
|
||||
// TODO goto exit;
|
||||
ESP_LOGE(TAG, "wolfSSL_write error = %d\n",
|
||||
wolfSSL_get_error(ssl, ret));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Cleanup after this connection */
|
||||
wolfSSL_shutdown(ssl);
|
||||
if (ssl) {
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
ssl = NULL;
|
||||
}
|
||||
if (mConnd != SOCKET_INVALID) {
|
||||
|
@ -931,26 +1009,27 @@ int tls_smp_server_task() {
|
|||
*
|
||||
***************************************************************************
|
||||
*/
|
||||
exit:
|
||||
if (mConnd != SOCKET_INVALID) {
|
||||
close(mConnd); /* Close the connection to the client */
|
||||
close(mConnd); /* Close the connection to the client */
|
||||
mConnd = SOCKET_INVALID;
|
||||
}
|
||||
|
||||
if (sockfd != SOCKET_INVALID) {
|
||||
close(sockfd); /* Close the socket listening for clients */
|
||||
close(sockfd); /* Close the socket listening for clients */
|
||||
sockfd = SOCKET_INVALID;
|
||||
}
|
||||
|
||||
if (ssl) {
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
wolfSSL_free(ssl); /* Free the wolfSSL object */
|
||||
}
|
||||
|
||||
|
||||
if (ctx) {
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
|
||||
}
|
||||
|
||||
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
|
||||
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -958,7 +1037,21 @@ int tls_smp_server_task() {
|
|||
|
||||
void app_main(void)
|
||||
{
|
||||
//Initialize NVS
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
ESP_LOGI(TAG, "--------------------------------------------------------");
|
||||
|
||||
|
||||
ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING);
|
||||
ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET);
|
||||
ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz", CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ);
|
||||
ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount);
|
||||
|
||||
ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL));
|
||||
|
||||
/* Initialize NVS */
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||
|
@ -975,9 +1068,12 @@ void app_main(void)
|
|||
ESP_LOGI(TAG, "main loop");
|
||||
vTaskDelay(DelayTicks ? DelayTicks : 1); /* Minimum delay = 1 tick */
|
||||
tls_smp_server_task();
|
||||
|
||||
/* done. wait forever */
|
||||
for (;;)
|
||||
{
|
||||
vTaskDelay(DelayTicks ? DelayTicks : 1); /* Minimum delay = 1 tick */
|
||||
vTaskDelay(DelayTicks ? DelayTicks : 1); /* Minimum delay = 1 tick
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# 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=55000
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
# minimum C3 chip revision known to work is 2.
|
||||
# rev 0 and 1 not available for testing.
|
||||
# all revisions expected to work.
|
||||
CONFIG_ESP32C3_REV_MIN_0=
|
||||
CONFIG_ESP32C3_REV_MIN_1=
|
||||
CONFIG_ESP32C3_REV_MIN_2=y
|
||||
CONFIG_ESP32C3_REV_MIN_3=
|
||||
|
||||
#
|
||||
# Partition Table
|
||||
#
|
||||
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||
CONFIG_PARTITION_TABLE_MD5=y
|
||||
# end of Partition Table
|
Loading…
Reference in New Issue