Difference between revisions of "Rust"
m (Rust Embassy crate to convey debug messages over USB) |
m (Create section q Linker Flags q) |
||
| Line 77: | Line 77: | ||
* https://github.com/charlesmuchene/minimal-rust-microbit-starter/tree/main | * https://github.com/charlesmuchene/minimal-rust-microbit-starter/tree/main | ||
| − | === Crate Microbit-V2 === | + | === [[#top|^]] Crate Microbit-V2 === |
| − | * | + | * https://crates.io/crates/microbit-v2 |
== [[#top|^]] Panic Handling == | == [[#top|^]] Panic Handling == | ||
| Line 110: | Line 110: | ||
* https://crates.io/crates/defmt-embassy-usbserial | * https://crates.io/crates/defmt-embassy-usbserial | ||
| + | |||
| + | == [[#top|^]] Linker Flags == | ||
| + | |||
| + | * https://users.rust-lang.org/t/no-loadable-segments-were-found-in-the-elf-file-cargo-embed/117714/6 | ||
== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - == | == - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - == | ||
Revision as of 07:04, 31 January 2026
Notes on Rust programming language
Overview
This local page about the programming language of Rust aims to answer among other questions: How suitable is Rust for embedded development?
Rust By Example (RBE) home page here:
MIT mirror of Rust introduction by chapters:
^ Organizations for Rust
^ Installation and Other Specific Notes
Install Rust on Ubuntu:
Adoption and popularity of Rust:
2025-12-16
Rust crates
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
^ Rust for Embedded Systems
Books on Rust language for embedded systems, and a link to a specific topic regarding memory:
Note as well that Rust Embedded Discovery-mb2 has its code repository at:
Rust crates for STM32:
^ Specific development boards and Rust
Rust Embassy project has board support crates for certain MCU families. Ted found a crate or sub-project named `stm32f0` which is adaptable to support STMicro's stm32f401re. Needed only to change the MCU name from something other than `stm32f401re` to this MCU name in the Cargo.toml file.
(Thought the Cargo.toml file referenced an STM part with "7" in the name but see https://github.com/embassy-rs/embassy/blob/main/examples/stm32f0/Cargo.toml which is similar to the starting point Ted found.)
Charles Muchene is a software developer working in Rust and other languages. He shares an article on Medium dot com and a github project which presents a minimal start-up program in Rust for the Microbit V2:
^ Crate Microbit-V2
^ Panic Handling
When setting panic compilation to 'abort' on panic, may be necessary to write one's own panic function:
How Rust panic is implemented . . . in crates core and std:
^ Rust General Topics
Following sections touch on Rust language features, use and practice. These notes are not specific to embedded development.
^ Crates versus Modules
Excellent article at MIT explaining Rust crates and modules, and how to organize them:
^ Potentially Useful Crates
Rust Embassy crate to convey debug messages over USB . . .
^ Linker Flags
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
^ Questions to Answer
(1) For what is Rust language 'derive' keyword used?
#[derive(Clone)]
#[derive(Default)]
(2) How is the `.await` method working, and is this kind of element called a method in Rust?
(3) Rust `match` construct, is this equal to C switch statement?
(4) what does at or near top of source file `use defmt::*;` mean?
(5) Rust `impl` a keyword? Seeing this in lines like `impl CanTxChannel`.
(6) `.await.unwrap()` versus `.await`?
(7) What is the following forward arrow operator in this context?:
pub async fn <function_name>(var declarations) -> () { ... }
(8) What mean the following top of file lines?:
#![no_std] #![no_main]