stm32f4xx-hal
stm32-rs
stm32f4xx-hal | stm32-rs | |
---|---|---|
11 | 8 | |
506 | 1,174 | |
2.8% | 2.2% | |
8.4 | 8.7 | |
7 days ago | 7 days ago | |
Rust | Python | |
BSD Zero Clause License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
stm32f4xx-hal
- Rust newcomers are 70x less likely to create vulnerabilities than C++ newcomers [pdf]
-
1.5st project: Rusty Stopwatch
I would personally use the abstractions provided by the stm32f4xx-hal crate more. See https://github.com/stm32-rs/stm32f4xx-hal/tree/master/examples/ for examples.
-
[Media] To get familiar with embedded Rust, I wrote a Tetris clone! It's running on an STM32. I repurposed a board I designed for another project
For this project, the audio ended up being the biggest challenge. I spent a few days on-and-off working on it because it would stop working as I modified the PWM frequency. I was eventually able to track it down to a bug in the HAL and opened a PR accordingly: https://github.com/stm32-rs/stm32f4xx-hal/pull/555
-
Hey Rustaceans! Got a question? Ask here! (30/2022)!
For my specific issue, I'm using the stm32f4xx-hal library to control a bunch of RGB leds, each with a pwm output. Since I have to get pins and timers where I can find them, each component of the led is made by something like
-
STM32F4 Embedded Rust at the HAL: PWM Buzzer
At the time of writing this post, I noticed that if going with option 1 stated earlier that returns a PWMChannel can prove to be quite problematic. In navigating the documentation, the PWMChannel implementations do not include methods that allow to get and set the period of the peripheral. There is an issue that I submitted here for that.
-
blink sketch for stm32f411?
Maybe check out this example from the stm324xx-hal repo?
- How to setup CLion for programming AVR microcontrollers?
-
can u reccommend a microcontroller for my protorypes needs?
Here is an example for stm32f407 (trivial to change to stm32f411) that gets random numbers from the rng peripheral and displays them on an ssd1306 display: https://github.com/stm32-rs/stm32f4xx-hal/blob/master/examples/rng-display.rs although this uses Rust, which you may or may not like. Arduino will have you covered as well, obviously.
- Huge binary size when using usbd_device SerialPort on stm32
-
Learn a new language after C. Rust or C++?
A major benefit of Rust in embedded is how easy it is to use libraries. This example implements USB serial communication on an STM32 in under 80 lines. You add some libs and if it compiles it works.
stm32-rs
-
STM32F4 Embedded Rust at the PAC: svd2rust
Developing code at the PAC, well, requires a PAC crate for the targeted controller. For the STM32 there exists a repo for all the supported PACs. These PACs are all generated using a command line tool called svd2rust. svd2rust grabs what is called an svd file and converts it into a PAC exposing API allowing access to peripheral registers. An SVD file is an Extensible Markup Language (XML) formatted file describing the hardware features of a device, listing all the peripherals and the registers associated with them. SVD files typically are released by microcontroller manufacturers.
-
Next Rust Compiler
In real world software, 99% of code is gluing preexisting lower-level functions together. In C/C++, the unsafe is implicit and needlessly covers everything. In Rust, the unsafe is only needed for the 1%.
You can safely implement a doubly-linked list in Rust, using unsafe, and that list can offer a safe interface so that the next higher level of code does not need to use unsafe. In fact, one doubly-linked list implementation that provides a safe interface is in the Rust standard library: https://doc.rust-lang.org/std/collections/struct.LinkedList.... . Most people do not rewrite std::list in C++ either.
Much of the Linux kernel really is the same: normal C code (maybe slightly more complicate than average userspace code, and definitely more carefully reviewed, but definitely not magic), that depends on extra carefully written lower level primitives that are _much_ more complicated internally than they appear from the outside (like the memory allocator, printk, RCU, etc.).
Rust is powerful enough to have libraries for register level access to micro-controllers (e.g. https://github.com/stm32-rs/stm32-rs), that encode moderately complex access rules safely in the type system (e.g. which specific set of bits is read-only or write-only, with which particular values (with nice human-readable names, even!), in which particular states of a state machine depending on other bits), all while allowing bypassing the restrictions with a simple unsafe keyword without even giving up on the nice API.
On the C/C++ side, I've used libopencm3, MBED, CMSIS, and everyone's favorite toy, Arduino. They're, in different ways, all much more mature and complete than anything Rust has today, but nothing comes even remotely close to Rust in terms of safety and long term potential.
-
NVIDIA Security Team: “What if we just stopped…
Packages: Where would I start with e.g. running Ada on a stm32? Resources are just a bit tough to find, and there's only a single stm32 package on Alire (which was inspired by cargo). But Rust has easy to find PACs and HALs for everything in the family, plus an official guide to setting up a project, including HIL debugging and unit testing on qemu, that takes about 15 minutes.
-
Cloning a Rare ISA Card to Use a Rare CD Drive
> (I threw out all my C/C++ books about 15 years ago - oops!).
The future is here for STM32: https://github.com/stm32-rs/stm32-rs
- Is there a database of peripheral implementations for different STM32 MCU parts?
-
Writing embedded firmware using Rust
Specifically these Rust register definitions are being auto-generated using SVD files published by the chip vendors (https://www.keil.com/pack/doc/CMSIS/SVD/html/index.html). For stm32 for example there are the auto-generated register definitions: https://github.com/stm32-rs/stm32-rs and then the HAL layers on top that try to build easy to use tools on top of the registers (e.g. an SPI or USART type with write and read functions). e.g. https://github.com/stm32-rs/stm32f4xx-hal for the stm32f4xx line
-
Any frameworks in Rust for developing on SiFive / ST / NXP boards?
For STM32, check out the Peripheral Access Crates by the stm32-rs ream. For higher-level access, I wrote This HAL library for STM32. Works on most newer variants, and includes examples for specific peripherals, and simple applications.
-
CMSIS libraries
Patches: https://github.com/stm32-rs/stm32-rs/tree/master/devices
What are some alternatives?
meta-raspberrypi - Yocto/OE BSP layer for the Raspberry Pi boards
libopencm3 - Open source ARM Cortex-M microcontroller library
embassy - Modern embedded framework, using Rust and async.
stm32-hal - This library provides access to STM32 peripherals in Rust.
cargo-binutils - Cargo subcommands to invoke the LLVM tools shipped with the Rust toolchain
probe-run - Run embedded programs just like native ones
bare-metal-stopwatch-rust - Bare-metal interrupt-driven stopwatch on STM32F439ZI, written in Rust
hubris - A lightweight, memory-protected, message-passing kernel for deeply embedded systems.
esp32 - Peripheral access crate for the ESP32
Arduino - Arduino IDE 1.x
cortex-m - Low level access to Cortex-M processors