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.
-`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 generated 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).
-`bare2`, and `bare3` introduces some simple constructs for looping and iterations, and covers simple types and operations.
-`bare4`, 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).
-`bare5`, here we develop a `C` like API (similar to what you may have seen in `.h` device headers) 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). Here we well take the first steps towards an *abstraction* for safe(er) bare metal progromamning.
-`bare6`, 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). The example code outputs the system clock (SYSCLK) on a pin which you can observe on an oscilloscope, and we will see the effect of jitter and clock drift.
-`bare7`, to be announced (serial communication)
-`bare8`, to be announced (serial with dma)
# Requirements for debugging
- 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`
-`vscode` integration:
- Task configurations: `ctrl-shift-b` for building (Debug/Release)
- Launch configurations: `ctrl-shift-d` for entering Debug. Select (Debug/Release) and press arrow to start.
- a file `r` demonstrating `gdb` automation.
## arm-none-eabi-gdb from terminal
- A running `gdb` server (e.g., `openocd`), acception connections on port 3333.
- A running `ITM` tracing tools such as `itmdump` listening on the (FIFO) file `/tmp/itm.log`.
- Access to `arm-none-eabi-gdb`.
# Requirements
> `xargo run --example <name>` for running an example.
- The `Native Debug` extension.
- A running `gdb` server (e.g., `openocd`), connecting on port 3333.
-`ITM` tracing truogh the file `/tmp/itm.log`.
## Vscode using the `Native Debug` extension.
- A running `gdb` server (e.g., `openocd`), acception connections on port 3333.
-A running `ITM` tracing tools such as `itmdump` listening on the (FIFO) file `/tmp/itm.log`.
- Access to `arm-none-eabi-gdb`.
## Vscode using the `Cortex Debug` extension.
- Access to `openocd` and `arm-none-eabi-gdb`.
(`Cortex Debug` starts `openocd` so the gdb server should NOT be running in the background. It also has built in ITM tracing so no need to start `itmdump` in the background.)
### General vscode integration.
- Task configurations: `ctrl-shift-b` for building (Debug/Release)
- Launch configurations: `ctrl-shift-d` for entering Debug. Select (Debug/Release) and press arrow to start.