This repository contains the source code for the Maker Advent Calendar 2022. The main objectif of this project is to reproduce the Python code in rust.
- Disconnect the board
- Press the button near the usb port
- Plug the board
- Congratulation, the board is reset
- Ensure that the board is reset
- Download the firmware from here
- put the .uf2 file in the drive that seems to be your board (it might contains two file)
- Enjoy!
In this case, you will have different firmware each time you want to burn your project.
- Ensure that the board is reset
- Build and run your rust project
cargo build --release && cargo run --release
- Copy paste the .uf2 file (mostly in ./target/thumbv6m-none-eabi/release/) in the drive that seems to be your board (it might contains two file)
- Vscode
- Create a project with the PyMakr extension
- write some code
- Connect to the board through the PyMakr extension
- Push your code to the board
This project work with the Rp-hal rust crate. It provide almost everything you need to work with the pico board.
/!\ Starting from day 4, the project include the serial workflow. You will need a serial terminal like Putty to see the output of the program.
You can either start with a blank project or by using one of the example folder like day2-rust
.
If you want to start with a blank project, you can do the following:
- Create a new project
cargo init
in a blank folder. - Add the following to your
Cargo.toml
file under dependencies:
[dependencies]
rp-pico = "0.5.0"
cortex-m = "0.7.2"
embedded-hal = "0.2.7"
cortex-m-rt = "0.7.2"
panic-halt = "0.2.0"
- Add the configuration to your .cargo/config.toml file (you can copy paste the one from the example folder). This will allow you to build and package your project in a .uf2 file.
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "elf2uf2-rs"
rustflags = [
"-C", "link-arg=-Tlink.x",
]
[build]
target = "thumbv6m-none-eabi"
[env]
DEFMT_LOG = "debug"
- You can use the following code in your main.rs:
#![no_std]
#![no_main]
use panic_halt as _;
use rp_pico::entry;
#[entry]
fn main() -> ! {
}
- Enjoy!