You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If it exists, the `stm32f4xx-hal` crate should be already included, so you can
54
+
use the bsp as BSP for your project.
55
+
56
+
Otherwise, create a new Rust project as you usually do with `cargo init`. The
57
+
"hello world" of embedded development is usually to blink a LED. The code to do
58
+
so is available in [examples/delay-blinky.rs](examples/delay-blinky.rs).
59
+
Copy that file to the `main.rs` of your project.
60
+
61
+
You also need to add some dependencies to your `Cargo.toml`:
62
+
63
+
```toml
64
+
[dependencies]
65
+
embedded-hal = "0.2.3"
66
+
nb = "0.1.2"
67
+
cortex-m = "0.6.2"
68
+
cortex-m-rt = "0.6.11"
69
+
# Panic behaviour, see https://crates.io/keywords/panic-impl for alternatives
70
+
panic-halt = "0.2.0"
71
+
72
+
[dependencies.stm32f4xx-hal]
73
+
version = "0.7"
74
+
features = ["rt", "stm32f407"] # replace the model of your microcontroller here
75
+
```
76
+
77
+
We also need to tell Rust how to link our executable and how to lay out the
78
+
result in memory. To accomplish all this, copy [.cargo/config](.cargo/config)
79
+
and [memory.x](memory.x) from the `stm32f4xx-hal` repository to your project and make sure the sizes match up with the datasheet. Also note that there might be different kinds of memory which are not equal; to be on the safe side only specify the size of the first block at the specified address.
0 commit comments