From 8839e1ee6370570319a09b04f1fb09e31c74ce8f Mon Sep 17 00:00:00 2001
From: Per Lindgren <per.lindgren@ltu.se>
Date: Thu, 11 Jan 2018 10:14:36 +0100
Subject: [PATCH] tmp

---
 Cargo.toml          |  2 +-
 README.md           | 12 ++++++++++--
 examples/bare3.1.rs | 22 ++++++++++++++++++++++
 3 files changed, 33 insertions(+), 3 deletions(-)
 create mode 100644 examples/bare3.1.rs

diff --git a/Cargo.toml b/Cargo.toml
index 22657d4..4fa2c4f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,7 +28,7 @@ version = "0.3.3"
 [dependencies.stm32f40x]
 git = "https://gitlab.henriktjader.com/pln/STM32F40x.git"
 features = ["rt"]
-version = "0.1.0"
+version = "0.2.0"
 
 [dependencies.f4]
 git = "https://github.com/jsjolund/f4"
diff --git a/README.md b/README.md
index 3a2449d..8a7e2e6 100644
--- a/README.md
+++ b/README.md
@@ -8,8 +8,16 @@
 # [Documentation](https://docs.rs/cortex-m-rtfm)
 
 # Features
-This is a minimalistic crate useful as a template for your own projects.
-It comprises:
+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.
+
+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.
 - the use of the `cortex-m-debug` crate for simple tracing over `itm` and `semihosting`
diff --git a/examples/bare3.1.rs b/examples/bare3.1.rs
new file mode 100644
index 0000000..3013d87
--- /dev/null
+++ b/examples/bare3.1.rs
@@ -0,0 +1,22 @@
+//! 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 {}
+}
-- 
GitLab