Skip to content

Commit

Permalink
new ESP32 and tls examples using VisualGDB
Browse files Browse the repository at this point in the history
  • Loading branch information
gojimmypi committed Mar 24, 2022
1 parent e7e9083 commit c325718
Show file tree
Hide file tree
Showing 302 changed files with 42,591 additions and 5 deletions.
68 changes: 63 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# user sensitive config files
**/my_private_config.h

# Object files
*.o
*.ko
Expand Down Expand Up @@ -73,17 +76,23 @@ android/wolfssljni-ndk-sample/proguard-project.txt

/tls/client-tcp
/tls/client-tls
/tls/client-tls13
/tls/client-tls13-resume
/tls/client-tls-bio
/tls/client-tls-cacb
/tls/client-tls-callback
/tls/client-tls-ecdhe
/tls/client-tls-nonblocking
/tls/client-tls-perf
/tls/client-tls-resume
/tls/client-tls-uart
/tls/client-tls-writedup

/tls/memory-tls

/tls/server-tcp
/tls/server-tls
/tls/server-tls13
/tls/server-tls-callback
/tls/server-tls-ecdhe
/tls/server-tls-epoll-perf
Expand All @@ -94,9 +103,10 @@ android/wolfssljni-ndk-sample/proguard-project.txt
/tls/client-tls-cryptocb
/tls/server-tls-pkcallback
/tls/client-tls-pkcallback
/tls/server-tls-uart
/tls/server-tls-verifycallback


tls/client-tls-uart
tls/server-tls-uart

crypto/3des/3des-file-encrypt
crypto/aes/aes-file-encrypt
Expand Down Expand Up @@ -202,6 +212,7 @@ pk/ecc/ecc_verify
pk/ecc/ecc_sign
pk/ecc/ecc_pub
pk/ecc/ecc_keys

#Example der and x963 files
pk/ecc/*.der
pk/ecc/*.x963
Expand Down Expand Up @@ -233,11 +244,58 @@ embedded/tls-sock-server
embedded/tls-sock-server-ca
embedded/tls-sock-threaded
embedded/tls-threaded
server-tls-verifycallback

hash/sha256-hash
sslkeylog.log
server-tls13
client-tls13

tpm/evp_tpm

# Visual Studio / VisualGDB

/tls/VisualGDB-tls/.visualgdb/*
/tls/VisualGDB-tls/.vs
/tls/VisualGDB-tls/*/.vs/*
/tls/VisualGDB-tls/*/Debug/*
/tls/VisualGDB-tls/*/Release/*
/tls/VisualGDB-tls/*/VisualGDB/Debug/*
/tls/VisualGDB-tls/*/VisualGDB/Release/*
/tls/VisualGDB-tls/*/x64/Debug
/tls/VisualGDB-tls/*/x64/Release
/tls/VisualGDB-tls/*/Makefile.old
/tls/VisualGDB-tls/*/debug.mak.old
/tls/VisualGDB-tls/*/release.mak.old
/tls/VisualGDB-tls/*/*.vgdbsettings.*.user

/tls/build/VisualGDB/Debug

# vscode user directories
**/.vs/*

# Visual Studio / VisualGDB

**/.visualgdb/*
**/*/Makefile.old
**/*/debug.mak.old
**/*/release.mak.old
**/*.vgdbsettings.*.user
**/*.vgdbproj.*.user

**/*/Debug/*
**/*/Release/*
**/*/x64/Debug
**/*/x64/Release
**/out/build/x64-Debug
**/out/build/x64-Release
**/build/VisualGDB/Debug
**/build/VisualGDB/Release

# VisualGDB auto-generated files
**/*/gcc_Debug.h
**/*/gcc_Release.h
**/*/*.vcxproj.filters
**/*/*.vcxproj.user

# EDP-IDF
**/main/build/CMakeFiles/*
**/build/*

1 change: 1 addition & 0 deletions ESP32/ESP32-hello-world/ESP32_hello_world.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
esptool.exe --chip esp32 --port COM5 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 boot_app0.bin 0x1000 bootloader_qio_80m.bin 0x10000 hello_world.ino.bin 0x8000 hello_world.ino.partitions.bin
43 changes: 43 additions & 0 deletions ESP32/ESP32-hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ESP32 Hello World

When JTAG doesn't work, often for infinite-loop failing app,
this simple "Hello World" app, programmed via serial port can help.

The file size for the enclosed `esptool.exe` 3,491,344 bytes and the SHA-256 value is:

`1B-EB-B7-CA-09-F0-4F-98-A7-93-DC-EE-F6-19-C4-78-78-7F-08-9E-DA-14-E4-74-76-B6-5A-B6-13-4D-25-9D`



Here's a sample SHA-256 file calculation in C#

```
using System.Security.Cryptography;
using System.Text;
using System.IO;
namespace TestdriveSHA256
{
class Program
{
static void Main(string[] args)
{
using (SHA256 mySHA256 = SHA256.Create())
{
byte[] stringBytes = Encoding.ASCII.GetBytes("Hello World");
stringBytes = File.ReadAllBytes(@"C:\workspace\wolfssl-examples\ESP32\ESP32-hello-world\esptool.exe");
byte[] hashValue = mySHA256.ComputeHash(stringBytes);
string resultValue = System.BitConverter.ToString(hashValue);
System.Console.WriteLine(resultValue);
}
}
}
}
```

<br />

## Support

Please contact wolfSSL at [email protected] with any questions, bug fixes,
or suggested feature additions.
Binary file added ESP32/ESP32-hello-world/boot_app0.bin
Binary file not shown.
Binary file added ESP32/ESP32-hello-world/bootloader_qio_80m.bin
Binary file not shown.
12 changes: 12 additions & 0 deletions ESP32/ESP32-hello-world/hello_world.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial) {
delay(250);
}
}

void loop() {
// put your main code here, to run repeatedly:
Serial.println(F("Hello World!"));
}
Binary file added ESP32/ESP32-hello-world/hello_world.ino.bin
Binary file not shown.
Binary file not shown.
98 changes: 98 additions & 0 deletions ESP32/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# wolfSSL ESP32 Examples

## ESP32 TLS 1.3 Server

- [Wireless STA server](./TLS13-wifi_station-server/README.md)
- [Wired ENC28J60 server](./TLS13-ENC28J60-server/README.md)

coming soon:
- Wireless AP client
- Arduino client

## ESP32 TLS 1.3 Client

- [Wireless STA client](./TLS13-wifi_station-client/README.md)
- [Wired ENC28J60 client](./TLS13-ENC28J60-client/README.md)

coming soon:
- Wireless AP server
- Arduino server

<br />

## Creating VisualGDB Projects

![VisualGDB-create-new-project.png](./images/VisualGDB-create-new-project.png)

![VisualGDB-configure-new-project.png](./images/VisualGDB-configure-new-project.png)

![VisualGDB-new-espressif-project.png](./images/VisualGDB-new-espressif-project.png)

![VisualGDB-new-espressif-project-toolchain.png](./images/VisualGDB-new-espressif-project-toolchain.png)

![VisualGDB-new-espressif-project-eth_enc28j60.png](./images/VisualGDB-new-espressif-project-eth_enc28j60.png)

![VisualGDB-new-espressif-project-debug.png](./images/VisualGDB-new-espressif-project-debug.png)

<br />

## ESP-IDF

Although the examples were created using VisualGDB extension for Visual Studio, the
examples can be compiled using the ESP-IDF.

Once the EDP-IDF is installed, use the [setp_win.bat]() to copy wolfSSL files to
the `esp-idf\components` directory, typically in
`C:\Users\%username%\esp\esp-idf\components` or `C:\Users\%username%\Desktop\esp-idf\components`.
Be sure to run the `ESP-IDY X.Y CMD` command prompt that has `%IDF_PATH%` defined.


```
cd \workspace\
git clone https://github.com/wolfSSL/wolfssl.git
cd wolfssl\IDE\Espressif\ESP-IDF\
.\setup_win.bat
```

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


## See also:

- [wolfSSL](https://www.wolfssl.com/)
- [Espressif](https://www.espressif.com/)

- [wolfSSL Quick Start Guide](https://www.wolfssl.com/docs/quickstart/)
- [github.com/wolfSSL/wolfssl](https://github.com/wolfSSL/wolfssl)
- [wolfSSL blog: ESP32 Hardware Acceleration Support](https://www.wolfssl.com/wolfssl-esp32-hardware-acceleration-support/)
- [wolfSSL blog: Support for ESP-IDF and ESP32-WROOM-32](https://www.wolfssl.com/wolfssl-support-esp-idf-esp32-wroom-32/)
- [wolfSSL Context and Session Set Up](https://www.wolfssl.com/doxygen/group__Setup.html)
- [wolfSSL Certificates and Keys](https://www.wolfssl.com/doxygen/group__CertsKeys.html)
- [wolfSSL Error Handling and Reporting](https://www.wolfssl.com/doxygen/group__Debug.html)
- [wolfSSL Espressif Support Docs](https://www.wolfssl.com/docs/espressif/)
- [wolfSSL Licensing](https://www.wolfssl.com/license/)
- [wolfssl/IDE/Espressif/ESP-IDF](https://github.com/wolfSSL/wolfssl/tree/master/IDE/Espressif/ESP-IDF) (will be migrating to [wolfSSL/wolfssl-examples](https://github.com/wolfSSL/wolfssl-examples/) )
- [wolfssl/error-ssl.h](https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/error-ssl.h)
- [wolfssl/certs_test.h](https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h)
- [Espressif ESP32 Series of Modules](https://www.espressif.com/en/products/modules/esp32)
- [Espressif ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/index.html)
- [Espressif System Time API](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html)
- [Espressif Networking API](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_eth.html)
- [linux socket](https://linux.die.net/man/3/socket)
- [linux socket connect](https://linux.die.net/man/3/connect)
- [stackoverflow: What are the differences between .pem, .cer and .der?](https://stackoverflow.com/questions/22743415/what-are-the-differences-between-pem-cer-and-der)
- [esp32.com: How to check cip version](https://www.esp32.com/viewtopic.php?t=16103)
- [VisualGDB Extension for Visual Studio](https://visualgdb.com/)
- [Wireshark](https://www.wireshark.org/)
- [WSL](https://docs.microsoft.com/en-us/windows/wsl/)

<br />

## Support

Please contact wolfSSL at [email protected] with any questions, bug fixes,
or suggested feature additions.
7 changes: 7 additions & 0 deletions ESP32/TLS13-ENC28J60-client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# include(/SysGCC/esp32/esp-idf/v4.4/tools/cmake/project.cmake)
project(ESP32-TLS13-enc28j60-client)
8 changes: 8 additions & 0 deletions ESP32/TLS13-ENC28J60-client/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#

PROJECT_NAME := enc28j60

include $(IDF_PATH)/make/project.mk
Loading

0 comments on commit c325718

Please sign in to comment.