Get a handle on bare-metal Rust
Knurling-rs is a project by Ferrous Systems. Our mission is to improve the embedded Rust experience. To achieve this, we build and improve tools and create learning materials.
We believe that developing for embedded systems should be no more difficult than developing for hosted platforms.
It should be possible to use the same workflows and equally powerful tooling to develop applications and libraries for tiny embedded systems as well as powerful server-class hardware.
To that end we have created following tools:
defmtdefmt
is a highly efficient logging framework that targets resource-constrained devices, like microcontrollers. defmt
stands for "deferred formatting".
Rather than performing formatting input like 255u8
into "The temperature is 255°C"
on the embedded device, the formatting is deferred to the host that will output the logs. This way, only the relevant data needs to be sent to the host instead of the entire format string. Additionally the transmitted data is compressed, for example by compressing several booleans into one byte.
This means that defmt
:
255u8
to "255"
happens on the host that displays the logging output, not the targetFor more details on how it works, check out the defmt
book.
flip-link
adds zero-cost stack overflow protection for your embedded programs – no MPU or stack probe support needed!
It does this by flipping the standard memory layout of ARM Cortex-M programs.
With this inverted memory layout, the stack "overflows" instead of corrupting memory when it hits the boundary of the RAM region. This boundary collision raises a hardware exception (usually the "hard fault" exception), which by default halts the program.
For more details, check out our blog post introducing flip-link
.
The app-template
is a Cargo project template, so you can hit the ground running with probe-run
, defmt
and flip-link
. Using the knurling app-template
, and cargo-generate
, you can start your embedded project by just running
$ cargo generate \ --git https://github.com/knurling-rs/app-template \ --branch main \ --name my-app
and specifying your desired HAL and compilation target.
defmt-testdefmt-test
is an embedded test harness that lets you write and run unit tests as if you were using the built-in #[test]
attribute, but they'll run on your embedded target.
Of course, defmt-test
also gives you an #[init]
attribute for initialization functions needed to set up your peripherals etc.
For more details, check out our blog post introducing defmt-test
. Also check our blog post series on testing embedded Rust code.
nrdfdu
is a CLI tool for loading firmware onto an nRF52840 microcontroller running Nordic Semi's USB DFU bootloader.
derive-mmio
is a macro for auto-generating MMIO access methods for a structure. You can see an example of how to use it in the Ferrous Systems training material.
Sometimes we create learning resources to help newcomers to embedded Rust to get their hands dirty
You can find some project updates and behind the scenes insights in the Ferrous Systems Blog.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4