-
-
Notifications
You must be signed in to change notification settings - Fork 39
Examples for RP2040-Zero Microcontroller #186
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hey @orhun
I recently started working with Rust on the RP2040-Zero microcontroller and I noticed that there were no examples for this board in the examples/ directory.
I have a minimal example ready with me. It displays text using ratatui on the 1.54 inch E-Paper Display by Waveshare.
For the user's convenience I have added a Justfile which does the jobs of mounting, copying and umounting the drive.
It contains sudo commands. I did try alternatives without sudo but it was not as smooth as the one I have right now.
For your reference I am dropping the Justfile here
# Match the exact binary name from Cargo.toml
BIN_NAME := "rp2040-1in54-epd-example"
# Go up two directories to reach the workspace root target folder
TARGET_DIR := "../../target/thumbv6m-none-eabi/release"
build:
@cargo build --release
run: build
@echo "Converting ELF to UF2..."
@elf2uf2-rs convert {{TARGET_DIR}}/{{BIN_NAME}} flash.uf2
@echo "Mounting RP2040 synchronously (requires sudo)..."
@sudo mount -t vfat -o sync /dev/sda1 /mnt/rp2
@echo "Flashing memory..."
@sudo cp flash.uf2 /mnt/rp2/
@echo "Done! Program has been flashed"
@sudo umount /mnt/rp2/ || true
nuke:
@echo "Nuking RP2040 flash memory..."
@if mountpoint -q /mnt/rp2; then \
echo "✓ Drive already mounted at /mnt/rp2"; \
else \
echo "Mounting RP2040..."; \
sudo mount -t vfat -o sync /dev/sda1 /mnt/rp2; \
fi
@echo "Copying flash_nuke.uf2..."
@sudo cp flash_nuke.uf2 /mnt/rp2/
@echo "Waiting for flash erase to complete..."
@sleep 2
@sudo umount /mnt/rp2/ || true
@echo "Flash memory nuked! Board will reboot."
clean:
@cargo clean
@rm -f flash.uf2
If you prefer the commands to be without sudo please let me know and I shall make the required changes.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request