-
Notifications
You must be signed in to change notification settings - Fork 198
Improved Raspberry Pi Pico support #468
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,89 @@ | ||
| ## Getting Started | ||
|
|
||
| 1. Put wolfSSL source files under this directory. | ||
| RPi-Pico/wolfssl | ||
| Details of the Pi Pico support in wolfSSL can be found in the | ||
| `wolfcrypt/src/port/pi_pico/README.md`. | ||
|
|
||
| 2. Setup pico-sdk and set PICO_SDK_PATH | ||
| export PICO_SDK_PATH=/your/pico-sdk/path | ||
| This demonstration compiles several different utilities, including the wolfCrypt | ||
| benchmark and test suite. | ||
|
|
||
| 3. cmake and make | ||
| $ cd RPi-Pico | ||
| $ mkdir build | ||
| $ cd build | ||
| $ cmake -DPICO_BOARD=pico_w .. | ||
| $ make | ||
| ### Prerequisites | ||
|
|
||
| 4. Output is to USB serial | ||
| You of course need a Pi Pico based board. Any RP2040 / RP2350 based board should | ||
| work, as long as it has a USB port to upload firmware to. | ||
|
|
||
|
|
||
| You need to have the [Raspberry Pi Pico SDK GitHub repository](https://github.com/raspberrypi/pico-sdk) | ||
| somewhere on your system. You also need the ARM compiler and CMake installed, | ||
| in Debian / Ubuntu you can do this using: | ||
|
|
||
| ``` | ||
| sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib | ||
| ``` | ||
|
|
||
| If you wish to use RISC-V with the RP2350 (ARM mode is default), you will need a | ||
| `riscv32-unknown-elf-gcc` compiler. You can search for binaries for this, or | ||
| compile the [RISC-V GNU Toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain) | ||
| in multilib mode. You will also need to add symlinks from `riscv64-unknown-*` to | ||
| `riscv32-unknown-elf-*` if you build the toolchain from source. This is because | ||
| the multilib mode compiler is both 32bit and 64bit. | ||
|
|
||
| ### 1. Set an export to the wolfSSL source directory. | ||
|
|
||
| ``` | ||
| export WOLFSSL_ROOT=/path/to/wolfssl/source | ||
| ``` | ||
|
|
||
| ### 2. Setup pico-sdk and set `PICO_SDK_PATH` | ||
|
|
||
| ``` | ||
| export PICO_SDK_PATH=/path/to/pico-sdk | ||
| ``` | ||
|
|
||
| ### 3. cmake and make | ||
|
|
||
| The following CMAKE options are available: | ||
|
|
||
| * `PICO_BOARD` - This should be set to `pico` for a Pi Pico, `pico_w` for a Pi Pico with WiFi or `pico2` for a Pi Pico 2. A full list of boards for this option can be found [here](https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards), just ignore the `.h` at the end. | ||
| * `USE_WIFI` - Build the tests that use WiFi, only works when `PICO_BOARD` defined has a CYW43 WiFi chip. | ||
| * `USE_UART` - Output to UART instead of USB, for the Pi Debug Probe. | ||
| * `WIFI_SSID` - The SSID to connect to (if `USE_WIFI` is set). | ||
| * `WIFI_PASSWORD` - The password used for the WiFi network (if `USE_WIFI` is set). | ||
| * `TEST_TCP_SERVER_IP` - The test server to connect to for the TCP client test (if `USE_WIFI` is set). | ||
|
|
||
| To use the RP2350 in RISC-V mode, add `-DPICO_PLATFORM=rp2350-riscv`. | ||
|
|
||
| ``` | ||
| $ cd RPi-Pico | ||
| $ mkdir build | ||
| $ cd build | ||
| $ cmake -DPICO_BOARD=pico_w .. | ||
| $ make | ||
| ``` | ||
|
|
||
| ### 4. Upload to the Pico | ||
|
|
||
| Hold the boot button and plug the Pico into your computer, you can then | ||
| drag/drop a `.uf2` to the Pico. It will stop becoming a USB mass storage device | ||
| and run immediately once the upload is complete. Alternatively, you can use | ||
| [picotool](https://github.com/raspberrypi/picotool) to upload a file: | ||
|
|
||
| ``` | ||
| sudo picotool load benchmark.uf2 | ||
| sudo picotool reboot | ||
| ``` | ||
|
|
||
| ### 5. Serial output | ||
|
|
||
| If you have not set `USE_UART`, once rebooted the USB port will turn into an | ||
| "Abstract Control Module" serial port. On Linux this will likely be | ||
| `/dev/ttyACM0`, or a number higher than `0` if you already have one. On macOS | ||
| this will be something like `/dev/cu.usbmodemXXXX`. The baud rate of this port | ||
| is 115200. | ||
|
|
||
| In Linux, most repositories have `minicom`. Install this using your package | ||
| manager and run: | ||
|
|
||
| ``` | ||
| minicom -b 115200 -o -D /dev/ttyACM0 | ||
| ``` | ||
|
|
||
| If you need to exit at any time, it is CTRL-A followed by CTRL-X. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.