Skip to content
Snippets Groups Projects
Commit 9b412043 authored by Per Lindgren's avatar Per Lindgren
Browse files

Merge branch 'master' of gitlab.henriktjader.com:pln/rtfm-app

parents eedc19ee 8839e1ee
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,7 @@ version = "0.3.3" ...@@ -28,7 +28,7 @@ version = "0.3.3"
[dependencies.stm32f40x] [dependencies.stm32f40x]
git = "https://gitlab.henriktjader.com/pln/STM32F40x.git" git = "https://gitlab.henriktjader.com/pln/STM32F40x.git"
features = ["rt"] features = ["rt"]
version = "0.1.0" version = "0.2.0"
[dependencies.f4] [dependencies.f4]
git = "https://github.com/jsjolund/f4" git = "https://github.com/jsjolund/f4"
......
...@@ -8,8 +8,16 @@ ...@@ -8,8 +8,16 @@
# [Documentation](https://docs.rs/cortex-m-rtfm) # [Documentation](https://docs.rs/cortex-m-rtfm)
# Features # Features
This is a minimalistic crate useful as a template for your own projects. This is a crate useful as an introduction for bare metal programming. It targets the STM32F401re/STM32F11re Nucleo platform, but examples are mostly generic to any STMF4xx.
It comprises:
The set of examples covers.
- `bare0`, a minimal bare metal application in Rust. Here we will discuss in detail how the code is compiled into a binary, and how the genertad binary actually looks like in detail. We will also look at how the binary can be loaded onto the target MCU, and executed/debugged.
- `bare1`, extends the minimal example by *tracing* printouts to the host (over both `semihosting` and `ITM`).
- `bare2`, shows how raw access to *peripherals* is possible, and blink a LED. The problemen here is that its easy to make mistakes (and hard to find errors).
- `bare3`, here we develop a `C` like API for accessing register blocks in a structured way. Even though the programming API is offers some help to the progrmammer, it is still easy to make mistakes, (like writing to the wrong bit-field, or writing an illegal value).
- `bare4`, here we look at an API, machine generated from the vendors discription of the MCU. Using this API, bare metal programming becomes less error prone (fields are correctly aligned and values always in range).
- an `app!` system configuration with three task with two shared resources. - an `app!` system configuration with three task with two shared resources.
- the use of the `cortex-m-debug` crate for simple tracing over `itm` and `semihosting` - the use of the `cortex-m-debug` crate for simple tracing over `itm` and `semihosting`
......
//! bare3.rs
//! Simple bare metal application
#![no_std]
extern crate cortex_m;
extern crate stm32f40x;
#[macro_use]
extern crate cortex_m_debug;
fn main() {
let s = "ABCD";
ipln!("s = {:?}", s);
// iterate over the byte repr. of s
for c in s.as_bytes() {
ip!("{},", c)
}
ipln!();
loop {}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment