Update Arduino IDE README.md

This commit is contained in:
gojimmypi 2024-02-07 13:52:18 -08:00
parent 538ade105c
commit e078e74011

View File

@ -1,52 +1,72 @@
### wolfSSL with Arduino # wolfSSL with Arduino
Many of the supported devices are natively built-in to the [Arduino IDE Board Manager](https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-board-manager/) Many of the supported boards are natively built-in to the [Arduino IDE Board Manager](https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-board-manager/)
and by adding [additional cores](https://docs.arduino.cc/learn/starting-guide/cores/) as needed. and by adding [additional cores](https://docs.arduino.cc/learn/starting-guide/cores/) as needed.
STM32 Support can be added by including this link in the "Additional Boards Managers URLs" field: STM32 Support can be added by including this link in the "Additional Boards Managers URLs" field
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
from [stm32duino/Arduino_Core_STM32](https://github.com/stm32duino/Arduino_Core_STM32?tab=readme-ov-file#getting-started) . from [stm32duino/Arduino_Core_STM32](https://github.com/stm32duino/Arduino_Core_STM32?tab=readme-ov-file#getting-started) .
```
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
```
## Using wolfSSL from the Arduino IDE
##### Reformatting wolfSSL as a compatible Arduino Library Coming soon! https://github.com/wolfSSL/arduino-wolfSSL See [PR #1](https://github.com/wolfSSL/Arduino-wolfSSL/pull/1).
This is a shell script that will re-organize the wolfSSL library to be
compatible with Arduino projects that use Arduino IDE 1.5.0 or newer.
The Arduino IDE requires a library's source files to be in the library's root
directory with a header file in the name of the library. This script moves all
src/ files to the `IDE/ARDUINO/wolfSSL/src` directory and creates a stub header
file called `wolfssl.h` inside that directory.
Step 1: To configure wolfSSL with Arduino, enter one of the following commands This option will allow wolfSSL to be installed directly using the native Arduino tools.
## Manually Reformatting wolfSSL as a Compatible Arduino Library
Use [this](./wolfssl-arduino.sh) shell script that will re-organize the wolfSSL library to be
compatible with [Arduino Library Specification](https://arduino.github.io/arduino-cli/0.35/library-specification/)
for projects that use Arduino IDE 1.5.0 or newer.
The Arduino IDE requires a library's source files to be in the library's root directory with a
header file in the name of the library. This script moves all `src/` files to the `IDE/ARDUINO/wolfSSL/src`
directory and creates a stub header file called `wolfssl.h` inside that directory.
### Step 1:
To configure wolfSSL with Arduino, enter one of the following commands
from within the `wolfssl/IDE/ARDUINO` directory: from within the `wolfssl/IDE/ARDUINO` directory:
1. `./wolfssl-arduino.sh` 1. `./wolfssl-arduino.sh`
- Creates an Arduino Library in `wolfSSL` directory - Creates an Arduino Library directory structure in the local `wolfSSL` directory of `IDE/ARDUINO`.
2 `./wolfssl-arduino.sh INSTALL` - You can add your own `user_settings.h`, or copy/rename the [default](../../examples/configs/user_settings_arduino.h).
- Creates an Arduino Library in `wolfSSL` directory
2. `./wolfssl-arduino.sh INSTALL` (The most common option)
- Creates an Arduino Library in the local `wolfSSL` directory
- Moves that directory to the Arduino library directory: - Moves that directory to the Arduino library directory:
- `$HOME/Arduino/libraries` for most bash environments - `$HOME/Arduino/libraries` for most bash environments
- `/mnt/c/Users/$USER/Documents/Arduino/libraries` (for WSL) - `/mnt/c/Users/$USER/Documents/Arduino/libraries` (for WSL)
3. `./wolfssl-arduino.sh INSTALL /path/to/repository` - Adds the [default](../../examples/configs/user_settings_arduino.h) as `user_settings.h`.
- The wolfSSL library is now available from the Arduino IDE.
3. `./wolfssl-arduino.sh INSTALL /path/to/repository` (Used to update [arduino-wolfSSL](https://github.com/wolfSSL/arduino-wolfSSL))
- Creates an Arduino Library in `wolfSSL` directory - Creates an Arduino Library in `wolfSSL` directory
- Copies that directory contents to the specified `/path/to/repository` - Copies that directory contents to the specified `/path/to/repository`
- Adds the [default](../../examples/configs/user_settings_arduino.h) as `user_settings.h`.
4. `./wolfssl-arduino.sh INSTALL /path/to/any/other/directory` 4. `./wolfssl-arduino.sh INSTALL /path/to/any/other/directory`
- Creates an Arduino Library in `wolfSSL` directory - Creates an Arduino Library in `wolfSSL` directory
- Copies that directory contents to the specified `/path/to/repository` - Copies that directory contents to the specified `/path/to/any/other/directory`
Step 2: Edit `<arduino-libraries>/wolfSSL/src/user_settings.h` ### Step 2:
Edit `<arduino-libraries>/wolfSSL/src/user_settings.h`
If building for Intel Galileo platform add: `#define INTEL_GALILEO`. If building for Intel Galileo platform add: `#define INTEL_GALILEO`.
Add any other custom settings, for a good start see the examples in wolfssl root Add any other custom settings. For a good start see the examples in wolfssl root
"/examples/configs/user_settings_*.h" "[/examples/configs/user_settings_*.h](https://github.com/wolfssl/wolfssl/tree/master/examples/configs)"
Step 3: If you experience any issues with custom user_settings.h see the wolfssl ### Step 3:
If you experience any issues with custom `user_settings.h` see the wolfssl
porting guide here for more assistance: https://www.wolfssl.com/docs/porting-guide/ porting guide here for more assistance: https://www.wolfssl.com/docs/porting-guide/
If you have any issues contact support@wolfssl.com for help. If you have any issues contact support@wolfssl.com for help.
##### Including wolfSSL in Arduino Libraries (for Arduino version 2.0 or greater) # Including wolfSSL in Arduino Libraries (for Arduino version 2.0 or greater)
1. In the Arduino IDE: 1. In the Arduino IDE:
@ -67,9 +87,9 @@ directory.
Open an example Arduino sketch for wolfSSL: Open an example Arduino sketch for wolfSSL:
- wolfSSL Client INO sketch: `sketches/wolfssl_client/wolfssl_client.ino` - wolfSSL [Client INO sketch](./sketches/wolfssl_client/README.md): `sketches/wolfssl_client/wolfssl_client.ino`
- wolfSSL Server INO sketch: `sketches/wolfssl_server/wolfssl_server.ino` - wolfSSL [Server INO sketch](./sketches/wolfssl_server/README.md): `sketches/wolfssl_server/wolfssl_server.ino`
#### Script Examples #### Script Examples
@ -96,13 +116,14 @@ cd /mnt/c/workspace/wolfssl-$USER
./examples/client/client -h 192.168.1.43 -p 11111 -v 3 ./examples/client/client -h 192.168.1.43 -p 11111 -v 3
``` ```
Build wolfSSL to include wolfSSH support, but to an alternate development directory. Build wolfSSL to include wolfSSH support to an alternate development directory.
```bash ```bash
cd /mnt/c/workspace/wolfssl-$USER cd /mnt/c/workspace/wolfssl-$USER
./configure --prefix=/mnt/c/workspace/wolfssh-$USER/wolfssl_install --enable-ssh ./configure --prefix=/mnt/c/workspace/wolfssh-$USER/wolfssl_install --enable-ssh
make make
make install make install
``` ```
Build wolfSSH with wolfSSL not installed to default directory. Build wolfSSH with wolfSSL not installed to default directory.
@ -125,7 +146,7 @@ make clean
make && make test make && make test
``` ```
Build and run `testwolfcrypt` Build and run `testwolfcrypt`.
```bash ```bash
./autogen.sh ./autogen.sh