#How to setup rust on pi pico w?

74 messages · Page 1 of 1 (latest)

cloud oriole
#

(I haven't personally use rust on a pico just Arduinos)

#

It's a set of crates

wary mauve
#

@waxen stratus yes, it is a hardware abstraction layer (take a look at definition)

cloud oriole
#

Go through the getting started section

#

Yep

wary mauve
#

you probably will cargo build like on any other platform (I have experience with stm32 and esp32)

cloud oriole
#

You have to install all the tools before you can get to programming the pico

wary mauve
#

yes

#

if you have RP2040 (seems like it is the case) you can even drag and drop image after converting as stated in a readme

cloud oriole
#

I feel like we have skipped over the "install all the tools for compiling for arm" step

wary mauve
#

Also what is the main goal? Learn embedded Rust or just embedded?

#

If second, I would suggest to try micropython first, it has much faster iteration and even REPL, which give you an opportunity to run commands on the fly

cloud oriole
#

Run the cargo install and rustup update. You will want to clone the ro-hal repo and try the example projects first

#

Before making your own project

#

Yes

#

That installs the backend for rustc that can make arm machine code

#

Yes

#

You can't install for just a project

#

That's for dependancies

#

This is a command line tool not a library

wary mauve
#

toolchain is a global "thing" which compiles your project, technically you can do this per-environment but not per-project

cloud oriole
#

No

wary mauve
#

you can choose target explicitly in cargo.toml

#

if you clone or create project [with cargo] it will be there

cloud oriole
#

Yep, just let if keep going

wary mauve
cloud oriole
#

You should try the example project first to see if it works

#

Git clone, cargo build, cargo run

#

Clone the rp-hal repository itself

#

Before running the last command cargo run ...

#

Yes

#

So git clone https://github.com/rp-rs/rp-hal.git

#

cargo build --release --example <name>

#

You can, but it's not needed yet

#

Well if you say no you can't continue, so...

#

Replace <name> with the example you want to try

#

They are listed on the page

#

Cd into the folder

#

boards/rp-pico

#

You cloned the wrong thing

#

git clone https://github.com/rp-rs/rp-hal.git

#

You can just leave it for later

#

You can use it for your first solo project

#

You just go into your file explorer and click the folder and press delete

#

A git repository is just a normal folder with files in it

#

K, it all compiled good?

#

K cargo run --release --example <name> same thing replace <name>

#

And it should program the pico and start flashing the LED if you chose the blink example

#

No blink?

#

It says it uploaded fine

wary mauve
#

try to reconnect, maybe reset didn't work properly

cloud oriole
#

Hmm, did you hold the button when you plugged it in? Seems like that is needed from what I see online

wary mauve
cloud oriole
wary mauve
#

what I see in terminal output is that you are converting binary to uf2 and copying it to pico

wary mauve
cloud oriole
#

Oh wait, this is a W

#

Which has the LED on a different pin

#

Probably so it's probably working you just can't see it

#

Looks like it's connected to the wifi chip instead of the main CPU

#

You would need to wire up an external LED for easy blinking

#

As the Rust wifi chip driver is still under development

#

But you should be able to use it as is just fine

lyric obsidian
#

I could just go out and get an external led if that is the main difference but i do want to use the bluetooth capabilities