Skip to content

Commit ec818e5

Browse files
Merge pull request #6682 from gojimmypi/Espressif-template
Add Espressif ESP-IDF template project
2 parents 45bcb65 + a957f0e commit ec818e5

9 files changed

Lines changed: 1217 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# The following lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.5)
4+
5+
# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
6+
7+
# This tag is used to include this file in the ESP Component Registry:
8+
# __ESP_COMPONENT_SOURCE__
9+
10+
# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find
11+
# USE_MY_PRIVATE_CONFIG path for my_private_config.h
12+
#
13+
if(WIN32)
14+
# Windows-specific configuration here
15+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
16+
message("Detected Windows")
17+
endif()
18+
if(CMAKE_HOST_UNIX)
19+
message("Detected UNIX")
20+
endif()
21+
if(APPLE)
22+
message("Detected APPLE")
23+
endif()
24+
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
25+
# Windows-specific configuration here
26+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
27+
message("Detected WSL")
28+
endif()
29+
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
30+
# Windows-specific configuration here
31+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
32+
message("Detected Linux")
33+
endif()
34+
if(APPLE)
35+
# Windows-specific configuration here
36+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
37+
message("Detected Apple")
38+
endif()
39+
# End optional WOLFSSL_CMAKE_SYSTEM_NAME
40+
41+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
42+
43+
project(wolfssl_template)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# wolfSSL Template Project
2+
3+
This is an example minimally viable wolfSSL template to get started with your own project.
4+
5+
### Prerequisites
6+
7+
It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) has been installed.
8+
9+
### Files Included
10+
11+
- [main.c](./main/main.c) with a simple call to an Espressif library (`ESP_LOGI`) and a call to a wolfSSL library (`esp_ShowExtendedSystemInfo`) .
12+
13+
- See [components/wolfssl/include](./components/wolfssl/include/user_settings.h) directory to edit the wolfSSL `user_settings.h`.
14+
15+
- Edit [main/CMakeLists.txt](./main/CMakeLists.txt) to add/remove source files.
16+
17+
- The [components/wolfssl/CMakeLists.txt](./components/wolfssl/CMakeLists.txt) typically does not need to be changed.
18+
19+
- Optional [VisualGDB Project](./VisualGDB/wolfssl_template_IDF_v5.1_ESP32.vgdbproj) for Visual Studio using ESP32 and ESP-IDF v5.1.
20+
21+
- Edit the project [CMakeLists.txt](./CMakeLists.txt) to optionally point this project's wolfSSL component source code at a different directory:
22+
23+
```
24+
set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
25+
```
26+
27+
28+
## Getting Started:
29+
30+
Here's an example using the command-line [idf.py](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-py.html).
31+
32+
Edit your `WRK_IDF_PATH`to point to your ESP-IDF install directory.
33+
34+
```
35+
WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.1
36+
37+
echo "Run export.sh from ${WRK_IDF_PATH}"
38+
. ${WRK_IDF_PATH}/export.sh
39+
40+
# build the example:
41+
idf.py build
42+
43+
# flash the code onto the serial device at /dev/ttyS19
44+
idf.py flash -p /dev/ttyS19 -b 115200
45+
46+
# build, flash, and view UART output with one command:
47+
idf.py flash -p /dev/ttyS19 -b 115200 monitor
48+
```
49+
50+
Press `Ctrl+]` to exit `idf.py monitor`. See [additional monitor keyboard commands](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-monitor.html).
51+
52+
## Other Examples:
53+
54+
For examples, see:
55+
56+
- [TLS Client](../wolfssl_client/README.md)
57+
- [TLS Server](../wolfssl_server/README.md)
58+
- [Benchmark](../wolfssl_benchmark/README.md)
59+
- [Test](../wolfssl_test/README.md)
60+
- [wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32)
61+
- [wolfssh-examples](https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif)
62+
63+
64+
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
<?xml version="1.0"?>
2+
<VisualGDBProjectSettings2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<Project xsi:type="com.visualgdb.project.external.esp-idf">
4+
<CustomSourceDirectories>
5+
<Directories />
6+
<PathStyle>Unknown</PathStyle>
7+
</CustomSourceDirectories>
8+
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
9+
<ProjectModeSettings>
10+
<ProjectGUID>7bbd1486-d457-4e49-92ba-0cfc9d80849e</ProjectGUID>
11+
<GroupSourcesByTypes>true</GroupSourcesByTypes>
12+
<GroupSourcesByPaths>true</GroupSourcesByPaths>
13+
<HeaderScanMode>SourceDirs</HeaderScanMode>
14+
</ProjectModeSettings>
15+
</Project>
16+
<Build xsi:type="com.visualgdb.build.cmake">
17+
<BuildLogMode xsi:nil="true" />
18+
<ToolchainID>
19+
<ID>com.visualgdb.xtensa-esp32-elf</ID>
20+
<Version>
21+
<GCC>12.2.0</GCC>
22+
<GDB>12.1</GDB>
23+
<Revision>1</Revision>
24+
</Version>
25+
</ToolchainID>
26+
<RelativeSourceDirectory>..</RelativeSourceDirectory>
27+
<ConfigurationType>DEBUG</ConfigurationType>
28+
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
29+
<MakeCommandTemplate>
30+
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
31+
<Command>$(ToolchainNinja)</Command>
32+
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
33+
<BackgroundMode xsi:nil="true" />
34+
</MakeCommandTemplate>
35+
<CMakeCommand>
36+
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
37+
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
38+
<BackgroundMode xsi:nil="true" />
39+
</CMakeCommand>
40+
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
41+
<ExportCompileCommands>false</ExportCompileCommands>
42+
<DisableToolchainFile>false</DisableToolchainFile>
43+
<CMakeMakefileType>Ninja</CMakeMakefileType>
44+
<DeployAsRoot>false</DeployAsRoot>
45+
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
46+
<UseCCache>false</UseCCache>
47+
<ProjectModeSettings>
48+
<ProjectItemSettings>
49+
<GroupSourcesByTypes>true</GroupSourcesByTypes>
50+
<GroupSourcesByPaths>true</GroupSourcesByPaths>
51+
<GroupTargetsByPaths>true</GroupTargetsByPaths>
52+
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
53+
<AutoRefreshProject>true</AutoRefreshProject>
54+
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
55+
<SortTargetsByName>true</SortTargetsByName>
56+
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
57+
<SortSourcesByName>true</SortSourcesByName>
58+
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
59+
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
60+
</ProjectItemSettings>
61+
<TargetSpecificSettings />
62+
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
63+
<ProjectGUID>eadcc9ab-72b3-4b51-a838-593e5d80ddf7</ProjectGUID>
64+
<VirtualFolders />
65+
<ConfigurationNameCase>Upper</ConfigurationNameCase>
66+
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
67+
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
68+
<ESPIDFExtension>
69+
<IDFCheckout>
70+
<Version>release/v5.1</Version>
71+
<Subdirectory>esp-idf/v5.1</Subdirectory>
72+
<Type>ESPIDF</Type>
73+
</IDFCheckout>
74+
<COMPort>COM37</COMPort>
75+
<SuppressTestPrerequisiteChecks>false</SuppressTestPrerequisiteChecks>
76+
<UseCCache>false</UseCCache>
77+
<DeviceID>ESP32</DeviceID>
78+
</ESPIDFExtension>
79+
</ProjectModeSettings>
80+
</Build>
81+
<CustomBuild>
82+
<PreSyncActions />
83+
<PreBuildActions />
84+
<PostBuildActions />
85+
<PreCleanActions />
86+
<PostCleanActions />
87+
</CustomBuild>
88+
<CustomDebug>
89+
<PreDebugActions />
90+
<PostDebugActions />
91+
<DebugStopActions />
92+
<BreakMode>Default</BreakMode>
93+
</CustomDebug>
94+
<DeviceTerminalSettings>
95+
<Connection xsi:type="com.sysprogs.terminal.connection.serial">
96+
<ComPortName>COM37</ComPortName>
97+
<AdvancedSettings>
98+
<BaudRate>115200</BaudRate>
99+
<DataBits>8</DataBits>
100+
<Parity>None</Parity>
101+
<StopBits>One</StopBits>
102+
<FlowControl>None</FlowControl>
103+
</AdvancedSettings>
104+
</Connection>
105+
<LastConnectionTime>0</LastConnectionTime>
106+
<EchoTypedCharacters>false</EchoTypedCharacters>
107+
<ClearContentsWhenReconnecting>false</ClearContentsWhenReconnecting>
108+
<ReconnectAutomatically>false</ReconnectAutomatically>
109+
<DisplayMode>ASCII</DisplayMode>
110+
<Colors>
111+
<Background>
112+
<Alpha>255</Alpha>
113+
<Red>0</Red>
114+
<Green>0</Green>
115+
<Blue>0</Blue>
116+
</Background>
117+
<Disconnected>
118+
<Alpha>255</Alpha>
119+
<Red>169</Red>
120+
<Green>169</Green>
121+
<Blue>169</Blue>
122+
</Disconnected>
123+
<Text>
124+
<Alpha>255</Alpha>
125+
<Red>211</Red>
126+
<Green>211</Green>
127+
<Blue>211</Blue>
128+
</Text>
129+
<Echo>
130+
<Alpha>255</Alpha>
131+
<Red>144</Red>
132+
<Green>238</Green>
133+
<Blue>144</Blue>
134+
</Echo>
135+
<Inactive>
136+
<Alpha>255</Alpha>
137+
<Red>169</Red>
138+
<Green>169</Green>
139+
<Blue>169</Blue>
140+
</Inactive>
141+
</Colors>
142+
<HexSettings>
143+
<MaximumBytesPerLine>16</MaximumBytesPerLine>
144+
<ShowTextView>true</ShowTextView>
145+
<BreaksAroundEcho>true</BreaksAroundEcho>
146+
<AutoSend>true</AutoSend>
147+
<SendAsHex>true</SendAsHex>
148+
<TimeoutForAutoBreak>0</TimeoutForAutoBreak>
149+
</HexSettings>
150+
<LineEnding>LF</LineEnding>
151+
<TreatLFAsCRLF>false</TreatLFAsCRLF>
152+
<KeepOpenAfterExit>false</KeepOpenAfterExit>
153+
<ShowAfterProgramming>false</ShowAfterProgramming>
154+
</DeviceTerminalSettings>
155+
<CustomShortcuts>
156+
<Shortcuts />
157+
<ShowMessageAfterExecuting>true</ShowMessageAfterExecuting>
158+
</CustomShortcuts>
159+
<UserDefinedVariables />
160+
<ImportedPropertySheets />
161+
<CodeSense>
162+
<Enabled>Unknown</Enabled>
163+
<ExtraSettings>
164+
<HideErrorsInSystemHeaders>true</HideErrorsInSystemHeaders>
165+
<SupportLightweightReferenceAnalysis>true</SupportLightweightReferenceAnalysis>
166+
<CheckForClangFormatFiles>true</CheckForClangFormatFiles>
167+
<FormattingEngine xsi:nil="true" />
168+
</ExtraSettings>
169+
<CodeAnalyzerSettings>
170+
<Enabled>false</Enabled>
171+
</CodeAnalyzerSettings>
172+
</CodeSense>
173+
<Configurations>
174+
<VisualGDBConfiguration>
175+
<Name>Debug</Name>
176+
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
177+
</VisualGDBConfiguration>
178+
<VisualGDBConfiguration>
179+
<Name>Release</Name>
180+
<BuildSettingsExtension xsi:type="com.visualgdb.build.external.esp-idf.cmake.extension" />
181+
</VisualGDBConfiguration>
182+
</Configurations>
183+
<ProgramArgumentsSuggestions />
184+
<Debug xsi:type="com.visualgdb.debug.embedded">
185+
<AdditionalStartupCommands />
186+
<AdditionalGDBSettings>
187+
<Features>
188+
<DisableAutoDetection>false</DisableAutoDetection>
189+
<UseFrameParameter>false</UseFrameParameter>
190+
<SimpleValuesFlagSupported>false</SimpleValuesFlagSupported>
191+
<ListLocalsSupported>false</ListLocalsSupported>
192+
<ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable>
193+
<ThreadInfoSupported>false</ThreadInfoSupported>
194+
<PendingBreakpointsSupported>false</PendingBreakpointsSupported>
195+
<SupportTargetCommand>false</SupportTargetCommand>
196+
<ReliableBreakpointNotifications>false</ReliableBreakpointNotifications>
197+
</Features>
198+
<EnableSmartStepping>false</EnableSmartStepping>
199+
<FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications>
200+
<ForceSingleThreadedMode>false</ForceSingleThreadedMode>
201+
<UseAppleExtensions>false</UseAppleExtensions>
202+
<CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning>
203+
<MakeLogFile>false</MakeLogFile>
204+
<IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping>
205+
<UseRelativePathsOnly>false</UseRelativePathsOnly>
206+
<ExitAction>None</ExitAction>
207+
<DisableDisassembly>false</DisableDisassembly>
208+
<ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand>
209+
<StepIntoNewInstanceEntry>app_main</StepIntoNewInstanceEntry>
210+
<ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat>
211+
<DisableSignals>false</DisableSignals>
212+
<EnableAsyncExecutionMode>false</EnableAsyncExecutionMode>
213+
<AsyncModeSupportsBreakpoints>true</AsyncModeSupportsBreakpoints>
214+
<TemporaryBreakConsolidationTimeout>0</TemporaryBreakConsolidationTimeout>
215+
<EnableNonStopMode>false</EnableNonStopMode>
216+
<MaxBreakpointLimit>0</MaxBreakpointLimit>
217+
<EnableVerboseMode>true</EnableVerboseMode>
218+
<EnablePrettyPrinters>false</EnablePrettyPrinters>
219+
</AdditionalGDBSettings>
220+
<DebugMethod>
221+
<ID>openocd</ID>
222+
<Configuration xsi:type="com.visualgdb.edp.openocd.settings.esp32">
223+
<CommandLine>-f interface/ftdi/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg</CommandLine>
224+
<ExtraParameters>
225+
<Frequency xsi:nil="true" />
226+
<BoostedFrequency xsi:nil="true" />
227+
<ConnectUnderReset>false</ConnectUnderReset>
228+
</ExtraParameters>
229+
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
230+
<ProgramMode>Enabled</ProgramMode>
231+
<StartupCommands>
232+
<string>set remotetimeout 60</string>
233+
<string>target remote :$$SYS:GDB_PORT$$</string>
234+
<string>mon gdb_breakpoint_override hard</string>
235+
<string>mon reset halt</string>
236+
<string>load</string>
237+
</StartupCommands>
238+
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
239+
<PreferredGDBPort>0</PreferredGDBPort>
240+
<PreferredTelnetPort>0</PreferredTelnetPort>
241+
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
242+
<SelectedCoreIndex xsi:nil="true" />
243+
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
244+
<SuggestionLogicRevision>1</SuggestionLogicRevision>
245+
<CheckFLASHSize>true</CheckFLASHSize>
246+
<FLASHSettings>
247+
<Size>size2MB</Size>
248+
<Frequency>freq40M</Frequency>
249+
<Mode>DIO</Mode>
250+
</FLASHSettings>
251+
<PatchBootloader>true</PatchBootloader>
252+
</Configuration>
253+
</DebugMethod>
254+
<AutoDetectRTOS>true</AutoDetectRTOS>
255+
<SemihostingSupport>Disabled</SemihostingSupport>
256+
<SemihostingPollingDelay>0</SemihostingPollingDelay>
257+
<StepIntoEntryPoint>false</StepIntoEntryPoint>
258+
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
259+
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
260+
<StopAtEntryPoint>false</StopAtEntryPoint>
261+
<EnableVirtualHalts>false</EnableVirtualHalts>
262+
<DynamicAnalysisSettings />
263+
<EndOfStackSymbol>_estack</EndOfStackSymbol>
264+
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
265+
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
266+
<UnusedStackFillPattern xsi:nil="true" />
267+
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
268+
</Debug>
269+
</VisualGDBProjectSettings2>

0 commit comments

Comments
 (0)