1
1
Examples
2
2
======
3
3
4
- ## Getting started
4
+ ## Starting your own project
5
5
6
- You can compile the provided examples directly, but it is recommended to create
7
- a new binary crate or one based on existing board specficic example or BSP crates.
8
- This is because most examples will require tweaks to work for your particular board.
9
- You then can copy the examples into your binary crate and make any necessary adjustments.
6
+ Although you can compile the provided examples directly, for your own project it
7
+ is recommended to make a new binary crate or start one based on existing board
8
+ specific examples / BSPs. Most examples will require tweaks to work for your
9
+ particular board. You should copy the examples into your binary crate and make
10
+ any necessary adjustments.
10
11
11
- These board specific crates usually also supply files which make
12
- development on the board easier. They might also contain board specific code or adaptions that
13
- might be required to make the examples work for your particular board.
12
+ If you can find a suitable BSP, these usually also supply files which make
13
+ development easier. They might also contain board specific code or adaptions
14
+ required to make the examples work for your particular board.
14
15
15
- The hello world of embedded development is usually to blinky a LED. This example
16
+ The hello world of embedded development is usually to blink a LED. This example
16
17
is contained within the [ examples folder] ( https://github.com/stm32-rs/stm32h7xx-hal/blob/master/examples/blinky.rs ) .
17
18
18
19
1 . Make sure you have the required Rust cross-compiler installed. If you have not
@@ -24,18 +25,15 @@ is contained within the [examples folder](https://github.com/stm32-rs/stm32h7xx-
24
25
25
26
2 . Create a new binary crate with ` cargo init `
26
27
3 . To ensure that ` cargo build ` cross-compiles, it is recommended to create
27
- a ` .cargo/config.toml ` file. You can use the ` config.toml ` provided
28
- in the [ ` cortex-m-quickstart ` ] ( https://github.com/rust-embedded/cortex-m-quickstart/blob/master/.cargo/config.toml )
28
+ a ` .cargo/config.toml ` file. You can use the [ ` config.toml ` provided
29
+ in the cortex-m-quickstart] ( https://github.com/rust-embedded/cortex-m-quickstart/blob/master/.cargo/config.toml )
29
30
repository and uncomment ` target = "thumbv7em-none-eabihf" ` .
30
- 4 . Copy the ` memory.x ` file into your project. This file contains information
31
- required by the linker.
32
- 5 . Copy the ` blinky.rs ` file to the ` src/main.rs ` in your binaray crate and copy the ` utilities `
33
- folder to your ` src ` folder as well. The utilities
34
- folder contains common code used by all examples, e.g. for logger initialization.
35
- 6 . For ` blinky.rs ` , you also need to add some dependencies to your ` Cargo.toml ` . If
36
- you are doing this for another example or you'd like to use another logger, you
37
- might need different dependencies. Make sure to replace the configuration
38
- feature ` stm32h743v ` according to your used board:
31
+ 4 . Copy ` memory.x ` into your project. This file contains information required by
32
+ the linker.
33
+ 5 . Copy ` blinky.rs ` to the ` src/main.rs ` in your binary crate and remove
34
+ references to the ` utilities ` module.
35
+ 6 . Add a dependency on the HAL in ` Cargo.toml ` . Make sure to replace
36
+ the configuration feature ` stm32h743v ` to match the part you are using:
39
37
40
38
``` toml
41
39
[dependencies ]
@@ -57,8 +55,8 @@ is contained within the [examples folder](https://github.com/stm32-rs/stm32h7xx-
57
55
cargo build
58
56
```
59
57
60
- 8 . Flashing the board might work differently for different boards and there is usually
61
- more than one way. You can usually find instructions in the board specific crates or BSPs.
58
+ 8 . Flashing the MCU typically works differently for different boards. You can
59
+ usually find instructions in the board specific crates or BSPs.
62
60
63
61
## Logging
64
62
0 commit comments