nrf-hal
dstep
Our great sponsors
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.
nrf-hal
-
Rust newcomers are 70x less likely to create vulnerabilities than C++ newcomers [pdf]
You should try again. I think that code is verbose because of the borrowing and because you're trying to do a one-liner. I use the nrf-hal library with the nrf52840, and the code reads pretty nicely. Here's an example:
https://github.com/nrf-rs/nrf-hal/blob/master/examples/blink...
-
Any good examples of using embedded Rust with an existing embedded C codebase?
Reading nrf-hal source, unfortunately new does re-configure the UARTE, and there is not a new_unchecked. The solution I can think of is to duplicate the write code with nrf52833_hal::pac::UARTE0. The Uarte type does not contain any metadata, it exists purely to guard the init of UARTE.
- Rust on the MOS 6502: Beyond Fibonacci
-
First steps with Embedded Rust: Selecting a board
Really good. Check out the examples in the nrf-hal repo. Also, if you don't mind forking out for some extra components the Knurling sessions by Ferrous Systems are ace.
-
I rewrote my Rust keyboard firmware in Zig: consistency, mastery, and fun
The embedded HAL crates do this with extensive use of macros, for example: https://github.com/nrf-rs/nrf-hal/blob/aae17943efc24baffe30b...
This solution makes sense given the constraints of Rust, but there's quite a cost in terms of compiler time and cognitive overhead to understand what is going on.
(Aside: I didn't use the HAL in my Rust firmware, that's a higher layer of abstraction; I only used the PAC crates.)
dstep
-
I want to install a package globally
You might also be interested in dstep, a tool that can generate D bindings from C header files.
-
Maintain It with Zig
- C, Objective-C = https://github.com/jacob-carlborg/dstep
> its test blocks make unit testing trivial to integrate.
Again, D also has this:
https://tour.dlang.org/tour/en/gems/unittesting
void main() {
-
Raylib, a simple and easy-to-use library to enjoy videogames programming
It's a C lib, generating bindings is super easy https://github.com/jacob-carlborg/dstep
There is no need to maintain bindings that can be automatically generated, wich can easily get outdated if the C project is actively developped
Anyways, someone went a ahead and updated it: https://github.com/Soaku/raylib-d
-
I rewrote my Rust keyboard firmware in Zig: consistency, mastery, and fun
Not quite as seamless as Zig, but dstep is an external program that leverages libclang to do the same thing (and generates a D module for you), as well as e.g., smartly convert #define macros to inlineable templates functions :)
https://github.com/jacob-carlborg/dstep
What are some alternatives?
embassy - Modern embedded framework, using Rust and async.
arocc - A C compiler written in Zig.
ziglings - Learn the Zig programming language by fixing tiny broken programs.
utfcpp - UTF-8 with C++ in a Portable Way
zig - General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
raylib - A simple and easy-to-use library to enjoy videogames programming
zephyr - Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
RIIR - why not Rewrite It In Rust
nrf-softdevice
mach - zig game engine & graphics toolkit
drogue-device - A distribution of tools and examples for building embedded IoT applications in Rust
jotai-benchmarks - Collection of executable benchmarks