-
Notifications
You must be signed in to change notification settings - Fork 48
Switch to Ninja and add README #53
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
base: master
Are you sure you want to change the base?
Conversation
Also build for W picos as well
Adds some simple command line instructions, along with basic setup instructions for other OSes that can't use this script
|
||
> If you're not using one of the default boards (pico, pico_w, pico2, or pico2_w), you'll need to create a new build directory for your board - you can do this with: | ||
> ``` | ||
> cmake -S . -B build_$board -GNinja -DPICO_BOARD=$board -DCMAKE_BUILD_TYPE=Debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like people might just copy/paste this which won't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might just be explicit about replacing $board, and ppl who get shells will get that it is a var too
|
||
> If you're not using one of the default boards (pico, pico_w, pico2, or pico2_w), you'll need to create a new build directory for your board - you can do this with: | ||
> ``` | ||
> cmake -S . -B build_$board -GNinja -DPICO_BOARD=$board -DCMAKE_BUILD_TYPE=Debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might just be explicit about replacing $board, and ppl who get shells will get that it is a var too
|
||
Put your board in bootsel mode and use `picotool` to load the blink example: | ||
```bash | ||
picotool load build/blink/blink.uf2 -x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to like -vx
and above
@@ -0,0 +1,182 @@ | |||
# Pico Command Line Setup | |||
|
|||
This script gives you an easy way to setup your Raspberry Pi to be able to build and run programs on your Pico from the command line. Compatibility with any systems not running Raspberry Pi OS or Raspberry Pi OS Lite is not guaranteed or maintained. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever the group noun is in the datasheet (Pico-series microcontroller)
``` | ||
You should now have a blinking Pico! For more info on the `picotool` command which is used to load and query binaries on the device, see its [README](https://github.com/raspberrypi/picotool?tab=readme-ov-file#readme) | ||
|
||
## Input/Output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console Input/Output perhaps
> cmake -S . -B build_$board -GNinja -DPICO_BOARD=$board -DCMAKE_BUILD_TYPE=Debug | ||
> ``` | ||
|
||
To build & run the blink example, first attach a Pico in bootsel mode, and run the following commands: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly split between build/run and a little sentence on what each does
|
||
## Input/Output | ||
|
||
To view console output, you can either connect the UART output to a [Debug Probe](https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html#getting-started) (or similar) and use stdio_uart (see the hello_serial example), or you can use stdio_usb (see the hello_usb example). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stdio_uart
etc.
cmake --build build | ||
``` | ||
|
||
Put your board in bootsel mode and use `picotool` to load the blink example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe bootsel is always BOOTSEL
```bash | ||
picotool load build/blink/blink.uf2 -x | ||
``` | ||
You should now have a blinking board |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arguably the board doesn't blink ;-)
|
||
For more details on debugging with GDB, see the [GDB docs](https://sourceware.org/gdb/current/onlinedocs/gdb.html/) | ||
|
||
## Multiple Terminals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really something we should include? won't most people just open multiple terminal instances?
|
||
If you have `apt`, then running the [pico_setup.sh](./pico_setup.sh) script should hopefully work for you, and you won't need to do any manual setup. | ||
|
||
If it doesn't work, or you don't have `apt`, then you can manually install the `GIT_DEPS` and `SDK_DEPS` from the script. Then follow the [manual setup instructions](#setup-sdk--picotool). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should list the dependencies (and also add a note about newlib for certain distros - see that a lot on the forums)
Note that i think the new openocd will download its own dependencies so that might be a help, but yeah i don't much care about telling people how to build that - it has instructions
cd pico/pico-examples | ||
``` | ||
|
||
Depending on the board you're using (eg pico2), replace `build_pico` with the relevant build directory (eg `build_pico2`) in the following commands. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this advice to create a board-specific build
directory - IIRC we've never done that elsewhere in any of our other documentation?
(also, I suspect the vast majority of people will only have a single board and/or single type of board?)
> cmake -S . -B build_$board -GNinja -DPICO_BOARD=$board -DCMAKE_BUILD_TYPE=Debug | ||
> ``` | ||
|
||
To build & run the blink example, first attach a Pico in bootsel mode, and run the following commands: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC we generally write BOOTSEL in uppercase rather than lowercase?
This expanded documentation is great; but in order to avoid duplication of effort, I wonder if it might be better to add it to https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf instead and then have this README.md point people to that? 🤔 |
Install Ninja and switch the pico-examples build over to that, so you get automatic multithreading without
-j
giving simpler command line instructions, and a shorter build output.Add a README which:
apt
should work with the script)