🦅 rp2350-linker
Zero-config linker and boot support for the RP2350 (Raspberry Pi Pico 2) in Rust.
Stop fighting with memory.x and custom linker scripts. rp2350-linker provides an automated, transparent way to boot your no_std Rust applications on the RP2350 (Pico 2) with correct memory mapping and boot blocks.
🚀 Key Features
- Zero-Setup: Automatically injects the correct
memory.xfor the RP2350. - Boot-Ready: Includes the required
.start_blockand.boot_infofor the RP2350 BootROM. - Picotool Compatible: Maps
.bi_entriessopicotoolcan identify your binary. - Invisible Overhead: Uses
INSERT AFTERto work seamlessly withcortex-m-rtandembassy. - Optimized: Pre-configured for 4MB Flash and 512K RAM.
📦 Installation
Add this to your Cargo.toml:
[]
= "0.2.3"
🛠 Usage
In your main.rs, simply import the crate to activate the linker automation:
// 🦅 The Magic Line: This handles memory layout and boot blocks
use rp2350_linker as _;
use entry;
!
Recommended .cargo/config.toml To take full advantage of the Pico 2, use these flags:
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "elf2uf2-rs -d"
rustflags = [
"-C", "linker=flip-link",
"-C", "link-arg=-Tlink.x", # This triggers the cortex-m-rt link process
"-C", "link-arg=--nmagic",
]
[build]
target = "thumbv8m.main-none-eabihf"
🚀 Pro Tips: Workflow Automation
For those who prefer a manual control or have permission issues with direct runners, you can use this flash.sh script. It automates the compilation, conversion to UF2 (specific to RP2350 ARM-S), and flashing using picotool.
📄 flash.sh Create a file named flash.sh in your project root:
#!/bin/bash
# Ensure Cargo is in the PATH (especially for sudo environments)
|| { ; ; }
BINARY_NAME="yourse"
TARGET_PATH="target/thumbv8m.main-none-eabihf/release/"
🛠️ How to use it: Make the script executable: chmod +x flash.sh
Run it: ./flash.sh
Note: This script uses picotool. Make sure you have it installed on your system. The --family rp2350-arm-s flag is mandatory for the new Raspberry Pi Pico 2 architecture.
🛡 License
This project is licensed under the GPL-2.0-or-later. Protecting open-source infrastructure for the community.
🦅 About
Developed by Jorge Andre Castro.