Skip to content

Move Arduino examples, add GitHub workflow #499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 6, 2025

Conversation

gojimmypi
Copy link
Contributor

Overview

This pull request adds a comprehensive set of Arduino examples to the wolfssl-examples repository, along with GitHub workflows for continuous integration testing. The examples demonstrate how to use wolfSSL in various Arduino environments and provide templates for developers to build upon.

The new and updated examples were originally in wolfssl/IDE/ARDUINO, but moved here as noted in wolfSSL/wolfssl#8514 (comment)

Note there's a bit of a chicken-and-egg problem of:

As such, follow-up pull requests will be needed both here and in wolfssl

Changes

Arduino Examples

Added five Arduino example sketches:

  1. wolfssl_version: A bare-bones example that simply displays the current wolfSSL version. Ideal for verifying library installation and compatibility.
  2. template: A reference template with multiple files demonstrating proper project structure for Arduino projects using wolfSSL. Includes VisualGDB project files for developers using that IDE.
  3. wolfssl_AES_CTR: Demonstrates AES Counter mode encryption and decryption using wolfSSL. Shows proper key setup, encryption/decryption workflow, and error handling.
  4. wolfssl_client: A TLS client implementation that connects to a wolfSSL server. Includes support for various Arduino boards with both WiFi and Ethernet connectivity options.
  5. wolfssl_server: A TLS server implementation that listens for connections from wolfSSL clients. Includes detailed documentation on connecting with both Arduino clients and command-line clients.

Documentation

  • Added comprehensive README files for each example with setup instructions, board compatibility information, and troubleshooting tips
  • Included detailed code comments explaining wolfSSL usage patterns and best practices
  • Added cross-references between related examples (e.g., client and server)

GitHub Workflow and Templates

  • Added GitHub workflow for automated testing of Arduino examples across multiple board types
  • Added issue templates for bug reports and general issues (copied from wolfssl/.github).
  • Updated .gitignore to exclude Arduino-specific temporary files

CI/CD Integration

  • Implemented Arduino CI build workflow that tests compilation across various Arduino boards:
    • Arduino UNO, Mega, Nano, Zero
    • ESP32 and ESP8266
    • Teensy 4.0
    • Due and other supported boards

Benefits

  • Provides ready-to-use examples for developers integrating wolfSSL with Arduino
  • Demonstrates proper wolfSSL usage patterns in Arduino environments
  • Ensures examples remain compatible with various Arduino boards through CI testing
  • Improves developer experience with detailed documentation and troubleshooting guides

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 14 out of 26 changed files in this pull request and generated 2 comments.

Files not reviewed (12)
  • Arduino/sketches/template/template.adeps: Language not supported
  • Arduino/sketches/template/template.ino: Language not supported
  • Arduino/sketches/template/template.sln: Language not supported
  • Arduino/sketches/template/template.vgdbproj: Language not supported
  • Arduino/sketches/template/wolfssl_helper.c: Language not supported
  • Arduino/sketches/template/wolfssl_helper.h: Language not supported
  • Arduino/sketches/template/wolfssl_library/src/wolfssl_library.cpp: Language not supported
  • Arduino/sketches/template/wolfssl_library/wolfssl_library.h: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.adeps: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.ino: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.sln: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.vgdbproj: Language not supported
Comments suppressed due to low confidence (3)

Arduino/sketches/template/README.md:1

  • The title in the template README seems incorrect; consider renaming it to indicate that it is a template example rather than an AES CTR example.
# Arduino AES CTR Example

Arduino/README.md:141

  • Fix the typo 'ARDUNIO' to 'Arduino' in the library folder path.
    - In `Sketch -> Include Library -> Add .ZIP Library...` and choose the `IDE/ARDUNIO/wolfSSL` folder.

Arduino/sketches/README.md:26

  • Correct 'configh.h' to 'config.h' for the proper filename reference.
 * Do not edit wolfSSL `settings.h` or `configh.h` files.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 14 out of 26 changed files in this pull request and generated 2 comments.

Files not reviewed (12)
  • Arduino/sketches/template/template.adeps: Language not supported
  • Arduino/sketches/template/template.ino: Language not supported
  • Arduino/sketches/template/template.sln: Language not supported
  • Arduino/sketches/template/template.vgdbproj: Language not supported
  • Arduino/sketches/template/wolfssl_helper.c: Language not supported
  • Arduino/sketches/template/wolfssl_helper.h: Language not supported
  • Arduino/sketches/template/wolfssl_library/src/wolfssl_library.cpp: Language not supported
  • Arduino/sketches/template/wolfssl_library/wolfssl_library.h: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.adeps: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.ino: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.sln: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.vgdbproj: Language not supported
Comments suppressed due to low confidence (1)

.github/workflows/arduino.yml:79

  • The pattern matching for boards uses the pipe character ('|') incorrectly, which may cause the condition to evaluate unexpectedly. Consider using a proper regular expression with grouping (e.g., "arduino:avr:(uno|mega|nano)") to ensure accurate matching.
if [[ "$BOARD" =~ "arduino:avr:uno"|"arduino:avr:mega"|"arduino:avr:nano"|"arduino:sam:arduino_zero_native" && ( "$EXAMPLE" =~ "wolfssl_server" || "$EXAMPLE" =~ "wolfssl_client" || "$EXAMPLE" =~ "test" ) ]]; then

@gojimmypi gojimmypi force-pushed the pr-arduino-examples branch from 5623f7f to 9ccbdb9 Compare April 6, 2025 10:10
@gojimmypi gojimmypi requested a review from Copilot April 6, 2025 10:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 14 out of 26 changed files in this pull request and generated no comments.

Files not reviewed (12)
  • Arduino/sketches/template/template.adeps: Language not supported
  • Arduino/sketches/template/template.ino: Language not supported
  • Arduino/sketches/template/template.sln: Language not supported
  • Arduino/sketches/template/template.vgdbproj: Language not supported
  • Arduino/sketches/template/wolfssl_helper.c: Language not supported
  • Arduino/sketches/template/wolfssl_helper.h: Language not supported
  • Arduino/sketches/template/wolfssl_library/src/wolfssl_library.cpp: Language not supported
  • Arduino/sketches/template/wolfssl_library/wolfssl_library.h: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.adeps: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.ino: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.sln: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.vgdbproj: Language not supported
Comments suppressed due to low confidence (1)

.github/workflows/arduino.yml:5

  • Typo in comment: 'om push/ branches' should be corrected to 'on push/ branches'.
# TODO remove '*' om push/ branches, and uncomment github.repository_owner == 'wolfssl'

@gojimmypi gojimmypi requested a review from Copilot April 6, 2025 10:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 14 out of 26 changed files in this pull request and generated no comments.

Files not reviewed (12)
  • Arduino/sketches/template/template.adeps: Language not supported
  • Arduino/sketches/template/template.ino: Language not supported
  • Arduino/sketches/template/template.sln: Language not supported
  • Arduino/sketches/template/template.vgdbproj: Language not supported
  • Arduino/sketches/template/wolfssl_helper.c: Language not supported
  • Arduino/sketches/template/wolfssl_helper.h: Language not supported
  • Arduino/sketches/template/wolfssl_library/src/wolfssl_library.cpp: Language not supported
  • Arduino/sketches/template/wolfssl_library/wolfssl_library.h: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.adeps: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.ino: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.sln: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.vgdbproj: Language not supported
Comments suppressed due to low confidence (1)

.github/workflows/arduino.yml:5

  • There appears to be a typo in the comment on line 5 ('om' should be 'on' or corrected to 'from').
# TODO remove '*' om push/ branches, and uncomment github.repository_owner == 'wolfssl'

@gojimmypi gojimmypi force-pushed the pr-arduino-examples branch from 6982a10 to 638297a Compare April 6, 2025 11:01
@gojimmypi gojimmypi requested a review from Copilot April 6, 2025 11:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 14 out of 26 changed files in this pull request and generated no comments.

Files not reviewed (12)
  • Arduino/sketches/template/template.adeps: Language not supported
  • Arduino/sketches/template/template.ino: Language not supported
  • Arduino/sketches/template/template.sln: Language not supported
  • Arduino/sketches/template/template.vgdbproj: Language not supported
  • Arduino/sketches/template/wolfssl_helper.c: Language not supported
  • Arduino/sketches/template/wolfssl_helper.h: Language not supported
  • Arduino/sketches/template/wolfssl_library/src/wolfssl_library.cpp: Language not supported
  • Arduino/sketches/template/wolfssl_library/wolfssl_library.h: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.adeps: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.ino: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.sln: Language not supported
  • Arduino/sketches/wolfssl_AES_CTR/wolfssl_AES_CTR.vgdbproj: Language not supported
Comments suppressed due to low confidence (2)

.github/workflows/arduino.yml:5

  • Typo in comment: 'om push/ branches' should be corrected to 'on push/branches'.
# TODO remove '*' om push/ branches, and uncomment github.repository_owner == 'wolfssl'

Arduino/sketches/wolfssl_client/README.md:9

  • [nitpick] Consider rephrasing for clarity, for example: 'Refer to the definition of WOLFSSL_TLS_SERVER_HOST to configure your server address.'
See the `#define WOLFSSL_TLS_SERVER_HOST` to set your own server address.

@gojimmypi
Copy link
Contributor Author

gojimmypi commented Apr 6, 2025

See example workflow output.

Many workflow items are disabled due to either known memory limitations (e.g. server on Arduino UNO) and/or issues fixed in wolfSSL/wolfssl#8514

@dgarske dgarske removed their assignment Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants