Commit 6deb811a authored by Per's avatar Per

bare 6 (polish)

parent 19426850
......@@ -11,29 +11,37 @@
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.
# ITMDump
Install via
......@@ -92,7 +100,7 @@ hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b
- Enable debug during low power modes (uses more power).
- Stop watchdog counters during halt.
# Launch configuration
# Launch configuration (native debug)
``` txt
......
......@@ -2,7 +2,6 @@
//! Simple bare metal application
//!
#![feature(used)]
#![feature(use_nested_groups)]
#![no_std]
extern crate stm32f40x;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment