-
Notifications
You must be signed in to change notification settings - Fork 133
Add note about pico-sdk-tools to README.md #146
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 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
307f705
Add note about pico-sdk-tools to README.md
will-v-pi ce1e6b9
Separate out BUILDING.md
will-v-pi e033a43
Remove references to `picotool sign`
will-v-pi 1e709e6
Review fixups
will-v-pi d705b9d
Review fixup
will-v-pi 295306d
Update README.md
will-v-pi 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
## Building | ||
|
||
You need to set PICO_SDK_PATH in the environment, or pass it to cmake with `-DPICO_SDK_PATH=/path/to/pico-sdk`. To use features such as signing or hashing, you will need to make sure the mbedtls submodule in the SDK is checked out - this can be done by running this from your SDK directory. | ||
|
||
```console | ||
git submodule update --init lib/mbedtls | ||
``` | ||
|
||
You also need to install `libusb-1.0` if you want to use the USB functionality. | ||
|
||
> If libusb-1.0 is not installed, picotool still builds, but it omits all options that deal with managing a pico via USB (load, save, erase, verify, reboot). Builds that do not include USB support can be recognized because these commands won't appear in the output of the help command. The build output message 'libUSB is not found - no USB support will be built' also appears in the build logs. | ||
|
||
### Linux / macOS | ||
|
||
Use your favorite package tool to install dependencies. For example, on Ubuntu: | ||
|
||
```console | ||
sudo apt install build-essential pkg-config libusb-1.0-0-dev cmake | ||
lurch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
Then simply build like a normal CMake project: | ||
|
||
```console | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make | ||
``` | ||
|
||
On Linux you can add udev rules in order to run picotool without sudo: | ||
|
||
```console | ||
sudo cp udev/99-picotool.rules /etc/udev/rules.d/ | ||
``` | ||
|
||
### Windows | ||
|
||
##### For Windows without MinGW | ||
|
||
Download libUSB from here https://libusb.info/ | ||
|
||
Set LIBUSB_ROOT environment variable to the install directory. | ||
```console | ||
mkdir build | ||
cd build | ||
cmake -G "NMake Makefiles" .. | ||
nmake | ||
``` | ||
|
||
##### For Windows with MinGW in WSL | ||
|
||
Download libUSB from here https://libusb.info/ | ||
|
||
Set LIBUSB_ROOT environment variable to the install directory. | ||
|
||
```console | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make | ||
``` | ||
|
||
##### For Windows with MinGW in MSYS2: | ||
|
||
No need to download libusb separately or set `LIBUSB_ROOT`. | ||
|
||
```console | ||
pacman -S $MINGW_PACKAGE_PREFIX-{toolchain,cmake,libusb} | ||
mkdir build | ||
cd build | ||
cmake .. -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX | ||
cmake --build . | ||
``` | ||
|
||
## Installing (so the Pico SDK can find it) | ||
|
||
The Raspberry Pi Pico SDK ([pico-sdk](https://github.com/raspberrypi/pico-sdk)) version 2.0.0 and above uses `picotool` to do the ELF-to-UF2 conversion previously handled by the `elf2uf2` tool in the SDK. The SDK also uses `picotool` to hash and sign binaries. | ||
|
||
Whilst the SDK can download picotool on its own per project, if you have multiple projects or build configurations, it is preferable to install a single copy of `picotool` locally. This can be done most simply with `make install` or `cmake --install .`, using `sudo` if required; the SDK will use this installed version by default. | ||
|
||
> On some Linux systems, the `~/.local` prefix may be used for an install without `sudo`; from your build directory simply run | ||
> ```console | ||
> cmake -DCMAKE_INSTALL_PREFIX=~/.local .. | ||
> make install | ||
> ``` | ||
> This will only work if `~/.local/bin` is included in your `PATH` | ||
|
||
### Custom Path Installation (eg if you can't use `sudo`) | ||
|
||
Alternatively, you can install to a custom path via: | ||
|
||
```console | ||
cmake -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR -DPICOTOOL_FLAT_INSTALL=1 .. | ||
make install | ||
``` | ||
|
||
In order for the SDK to find `picotool` in this custom folder, you will usually need to set the `picotool_DIR` variable in your project. This can be achieved either by setting the `picotool_DIR` environment variable to `$MY_INSTALL_DIR/picotool`, by passing `-Dpicotool_DIR=$MY_INSTALL_DIR/picotool` to your `cmake` command, or by adding `set(picotool_DIR $MY_INSTALL_DIR/picotool)` to your CMakeLists.txt file. | ||
|
||
> See the [find_package documentation](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure) for more details |
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
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.