Skip to content

Commit

Permalink
Merge pull request #6682 from gojimmypi/Espressif-template
Browse files Browse the repository at this point in the history
Add Espressif ESP-IDF template project
  • Loading branch information
JacobBarthelmeh authored Aug 15, 2023
2 parents 45bcb65 + a957f0e commit ec818e5
Show file tree
Hide file tree
Showing 9 changed files with 1,217 additions and 0 deletions.
43 changes: 43 additions & 0 deletions IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

# set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")

# This tag is used to include this file in the ESP Component Registry:
# __ESP_COMPONENT_SOURCE__

# Optional WOLFSSL_CMAKE_SYSTEM_NAME detection to find
# USE_MY_PRIVATE_CONFIG path for my_private_config.h
#
if(WIN32)
# Windows-specific configuration here
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
message("Detected Windows")
endif()
if(CMAKE_HOST_UNIX)
message("Detected UNIX")
endif()
if(APPLE)
message("Detected APPLE")
endif()
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
# Windows-specific configuration here
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
message("Detected WSL")
endif()
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
# Windows-specific configuration here
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
message("Detected Linux")
endif()
if(APPLE)
# Windows-specific configuration here
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
message("Detected Apple")
endif()
# End optional WOLFSSL_CMAKE_SYSTEM_NAME

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

project(wolfssl_template)
64 changes: 64 additions & 0 deletions IDE/Espressif/ESP-IDF/examples/template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# wolfSSL Template Project

This is an example minimally viable wolfSSL template to get started with your own project.

### Prerequisites

It is assumed the [ESP-IDF environment](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) has been installed.

### Files Included

- [main.c](./main/main.c) with a simple call to an Espressif library (`ESP_LOGI`) and a call to a wolfSSL library (`esp_ShowExtendedSystemInfo`) .

- See [components/wolfssl/include](./components/wolfssl/include/user_settings.h) directory to edit the wolfSSL `user_settings.h`.

- Edit [main/CMakeLists.txt](./main/CMakeLists.txt) to add/remove source files.

- The [components/wolfssl/CMakeLists.txt](./components/wolfssl/CMakeLists.txt) typically does not need to be changed.

- Optional [VisualGDB Project](./VisualGDB/wolfssl_template_IDF_v5.1_ESP32.vgdbproj) for Visual Studio using ESP32 and ESP-IDF v5.1.

- Edit the project [CMakeLists.txt](./CMakeLists.txt) to optionally point this project's wolfSSL component source code at a different directory:

```
set(WOLFSSL_ROOT "~/workspace/wolfssl-other-source")
```


## Getting Started:

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).

Edit your `WRK_IDF_PATH`to point to your ESP-IDF install directory.

```
WRK_IDF_PATH=/mnt/c/SysGCC/esp32/esp-idf/v5.1
echo "Run export.sh from ${WRK_IDF_PATH}"
. ${WRK_IDF_PATH}/export.sh
# build the example:
idf.py build
# flash the code onto the serial device at /dev/ttyS19
idf.py flash -p /dev/ttyS19 -b 115200
# build, flash, and view UART output with one command:
idf.py flash -p /dev/ttyS19 -b 115200 monitor
```

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).

## Other Examples:

For examples, see:

- [TLS Client](../wolfssl_client/README.md)
- [TLS Server](../wolfssl_server/README.md)
- [Benchmark](../wolfssl_benchmark/README.md)
- [Test](../wolfssl_test/README.md)
- [wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/tree/master/ESP32)
- [wolfssh-examples](https://github.com/wolfSSL/wolfssh-examples/tree/main/Espressif)



Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
<?xml version="1.0"?>
<VisualGDBProjectSettings2 xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Project xsi:type="com.visualgdb.project.external.esp-idf">
<CustomSourceDirectories>
<Directories />
<PathStyle>Unknown</PathStyle>
</CustomSourceDirectories>
<AutoProgramSPIFFSPartition>true</AutoProgramSPIFFSPartition>
<ProjectModeSettings>
<ProjectGUID>7bbd1486-d457-4e49-92ba-0cfc9d80849e</ProjectGUID>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<HeaderScanMode>SourceDirs</HeaderScanMode>
</ProjectModeSettings>
</Project>
<Build xsi:type="com.visualgdb.build.cmake">
<BuildLogMode xsi:nil="true" />
<ToolchainID>
<ID>com.visualgdb.xtensa-esp32-elf</ID>
<Version>
<GCC>12.2.0</GCC>
<GDB>12.1</GDB>
<Revision>1</Revision>
</Version>
</ToolchainID>
<RelativeSourceDirectory>..</RelativeSourceDirectory>
<ConfigurationType>DEBUG</ConfigurationType>
<BinaryDirectory>build/$(PlatformName)/$(ConfigurationName)</BinaryDirectory>
<MakeCommandTemplate>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(ToolchainNinja)</Command>
<WorkingDirectory>$(BuildDir)</WorkingDirectory>
<BackgroundMode xsi:nil="true" />
</MakeCommandTemplate>
<CMakeCommand>
<SkipWhenRunningCommandList>false</SkipWhenRunningCommandList>
<Command>$(SYSPROGS_CMAKE_PATH)</Command>
<BackgroundMode xsi:nil="true" />
</CMakeCommand>
<UpdateSourcesInCMakeFile>true</UpdateSourcesInCMakeFile>
<ExportCompileCommands>false</ExportCompileCommands>
<DisableToolchainFile>false</DisableToolchainFile>
<CMakeMakefileType>Ninja</CMakeMakefileType>
<DeployAsRoot>false</DeployAsRoot>
<CMakeCleanMode>RemoveBuildDirectory</CMakeCleanMode>
<UseCCache>false</UseCCache>
<ProjectModeSettings>
<ProjectItemSettings>
<GroupSourcesByTypes>true</GroupSourcesByTypes>
<GroupSourcesByPaths>true</GroupSourcesByPaths>
<GroupTargetsByPaths>true</GroupTargetsByPaths>
<FollowCMakeSourceGroups>false</FollowCMakeSourceGroups>
<AutoRefreshProject>true</AutoRefreshProject>
<AlwaysConsiderOutdated>false</AlwaysConsiderOutdated>
<SortTargetsByName>true</SortTargetsByName>
<RedundantTargetMode>HideOuterProjectTargets</RedundantTargetMode>
<SortSourcesByName>true</SortSourcesByName>
<BuildAllTargetsInSubdir>false</BuildAllTargetsInSubdir>
<FoldSingleItemPathLevels>true</FoldSingleItemPathLevels>
</ProjectItemSettings>
<TargetSpecificSettings />
<SetLDLibraryPathFromDependentArtifacts>true</SetLDLibraryPathFromDependentArtifacts>
<ProjectGUID>eadcc9ab-72b3-4b51-a838-593e5d80ddf7</ProjectGUID>
<VirtualFolders />
<ConfigurationNameCase>Upper</ConfigurationNameCase>
<DefaultHeaderDiscoveryMode>HeaderDirectoryAndSubdirectories</DefaultHeaderDiscoveryMode>
<EnableFastUpToDateCheck>true</EnableFastUpToDateCheck>
<ESPIDFExtension>
<IDFCheckout>
<Version>release/v5.1</Version>
<Subdirectory>esp-idf/v5.1</Subdirectory>
<Type>ESPIDF</Type>
</IDFCheckout>
<COMPort>COM37</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>COM37</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/ftdi/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg</CommandLine>
<ExtraParameters>
<Frequency xsi:nil="true" />
<BoostedFrequency xsi:nil="true" />
<ConnectUnderReset>false</ConnectUnderReset>
</ExtraParameters>
<LoadProgressGUIThreshold>131072</LoadProgressGUIThreshold>
<ProgramMode>Enabled</ProgramMode>
<StartupCommands>
<string>set remotetimeout 60</string>
<string>target remote :$$SYS:GDB_PORT$$</string>
<string>mon gdb_breakpoint_override hard</string>
<string>mon reset halt</string>
<string>load</string>
</StartupCommands>
<ProgramFLASHUsingExternalTool>false</ProgramFLASHUsingExternalTool>
<PreferredGDBPort>0</PreferredGDBPort>
<PreferredTelnetPort>0</PreferredTelnetPort>
<AlwaysPassSerialNumber>false</AlwaysPassSerialNumber>
<SelectedCoreIndex xsi:nil="true" />
<LiveMemoryTimeout>5000</LiveMemoryTimeout>
<SuggestionLogicRevision>1</SuggestionLogicRevision>
<CheckFLASHSize>true</CheckFLASHSize>
<FLASHSettings>
<Size>size2MB</Size>
<Frequency>freq40M</Frequency>
<Mode>DIO</Mode>
</FLASHSettings>
<PatchBootloader>true</PatchBootloader>
</Configuration>
</DebugMethod>
<AutoDetectRTOS>true</AutoDetectRTOS>
<SemihostingSupport>Disabled</SemihostingSupport>
<SemihostingPollingDelay>0</SemihostingPollingDelay>
<StepIntoEntryPoint>false</StepIntoEntryPoint>
<ReloadFirmwareOnReset>false</ReloadFirmwareOnReset>
<ValidateEndOfStackAddress>true</ValidateEndOfStackAddress>
<StopAtEntryPoint>false</StopAtEntryPoint>
<EnableVirtualHalts>false</EnableVirtualHalts>
<DynamicAnalysisSettings />
<EndOfStackSymbol>_estack</EndOfStackSymbol>
<TimestampProviderTicksPerSecond>0</TimestampProviderTicksPerSecond>
<KeepConsoleAfterExit>false</KeepConsoleAfterExit>
<UnusedStackFillPattern xsi:nil="true" />
<CheckInterfaceDrivers>true</CheckInterfaceDrivers>
</Debug>
</VisualGDBProjectSettings2>
Loading

0 comments on commit ec818e5

Please sign in to comment.