- MCU : Raspbery pi pico
- Debug probe (another Pico)
- LEDSTRIP: Adafruit neopixel ledstrip (144 LEDs)
- LLV: logic level converter 3.3 <-> 5V (no name)
- 100 ΓΉF capacitor
- Basic electronic stuff (breadboard, cable, connectors ...)
βββRP2040ββββ
ββββββ€VSYS β
β β β
β βββ€GND IO8 β
β β βββββββββββ¬ββ
βββββββ ββββββ β β βββββββββββ΄ββ ββββββββ
β +5Vββ>ββ€ C1 ββββ¬ββ΄βββΌββ€ βββ€+3.3V β
βββΊ β β100 β β β β TTL LLV β β βββ
β GNDββ>ββ€ΓΉF ββββΌββββ¬β΄ββ€ 3.3 -> 5V βββ€GND β
βββββββ ββββββ β β βββββββββββ¬ββ ββββββββ
β β ββββββββββ
βββ΄ββ¬ββ΄ββ¬ββ΄ββ
β+5VβGNDβDinβ
βββ¬ββββββββΌββββΌββββΌββββΌββββββββ
β ββΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβ€βΌβ
ββΌββΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβ β
β ββΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβ€βΌβ
ββΌββΌβΌβΌβΌβΌβΌβΌββββΌββββββΌβΌβΌβΌβΌβΌβΌβΌβΌβ β
β ββΌβΌβΌβΌβΌβΌβLEDβSTRIPββΌβΌβΌβΌβΌβΌβΌβΌβ€βΌβ
ββΌββΌβΌβΌβΌβΌβΌβΌββββΌββββββΌβΌβΌβΌβΌβΌβΌβΌβΌβ β
β ββΌβΌβΌβΌβΌβΌβΌβΌβββββΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβ€βΌβ
ββΌββΌβΌβΌβΌβΌβΌβΌβ8*18ββΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβ β
β ββΌβΌβΌβΌβΌβΌβΌβΌβββββΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβΌβ β
βββ΄ββββββββββββββββββββββββββ΄ββ
source : rp-rs github project requirements
- The standard Rust tooling (cargo, rustup) : eg.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Toolchain support for the cortex-m0+ processors in the rp2040 (thumbv6m-none-eabi) : eg.
rustup target add thumbv6m-none-eabi
- flip-link - this allows you to detect stack-overflows on the first core, which is the only supported target for now. : eg.
cargo install flip-link
- probe-run. Upstream support for RP2040 was added with version 0.3.1. eg.
cargo install probe-run
- A CMSIS-DAP probe. (J-Link and other probes will not work with probe-run)
- I use a second Pico as a CMSIS-DAP debug probe.
To develop with async (embedded) Rust π¦ with embassy framwework
graph TD
loop{{for each cell}}--> living_or_not{{is cell alive ?}}
living_or_not-->|yes|should_survive{{if N < 2 or N >3}}
should_survive--> |yes|cell_die[cell die <br/><i>loneliness or overpopulation]
should_survive--> |no|cell_live[cell stay alive]
living_or_not-->|no|should_born{{if N == 3}}
should_born-->|yes|born[living cell born]
should_born-->|no|dead[cell still dead]
-
The boilerplate to develop on RP2040 is here : https://github.com/SupImDos/embassy-rp-skeleton
-
Section about how to use a second Pico as probe : https://github.com/SupImDos/embassy-rp-skeleton#hardware-setup
-
Write tests. See below discussion about how to ...
-
Use nightly :
rustup override set nightly
-
Me
...would you tell me how do you implement test (mainly unit testing, but why not integ too) in your embassy based projects?
-
dirbaio
if it's hardware-independent logic, so you can run the tests in the host, it's easiest to separate that code into its own crate, and use regular Rust tests if it's hardware-dependent then there's defmt-test. defmt-test has some limitations though (can't have tests in multiple modules, can't reinitialize hardware between tests) so for some I've ended up doing one binary for each test, and scripting something to flash+run them in succession