diff options
| author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-11 20:41:49 +0000 |
|---|---|---|
| committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-11 20:41:49 +0000 |
| commit | 672886a67a80136f5620115772ceec1a628d8ee6 (patch) | |
| tree | 98361d6d3dfced4b068771c31163b324573294b7 /book/en/src/by-example/new.md | |
| parent | 1d52964df7abf9fba09933470d5c3dcce96760c4 (diff) | |
| parent | 0007a35a274ab2d07eb937e41971ea5e2c1cb5ff (diff) | |
Merge #139
139: russian translation r=japaric a=japaric
Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Co-authored-by: Andrey Zgarbul <zgarbul.andrey@gmail.com>
Diffstat (limited to 'book/en/src/by-example/new.md')
| -rw-r--r-- | book/en/src/by-example/new.md | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/book/en/src/by-example/new.md b/book/en/src/by-example/new.md new file mode 100644 index 0000000..ae49ef2 --- /dev/null +++ b/book/en/src/by-example/new.md @@ -0,0 +1,67 @@ +# Starting a new project + +Now that you have learned about the main features of the RTFM framework you can +try it out on your hardware by following these instructions. + +1. Instantiate the [`cortex-m-quickstart`] template. + +[`cortex-m-quickstart`]: https://github.com/rust-embedded/cortex-m-quickstart#cortex-m-quickstart + +``` console +$ # for example using `cargo-generate` +$ cargo generate \ + --git https://github.com/rust-embedded/cortex-m-quickstart \ + --name app + +$ # follow the rest of the instructions +``` + +2. Add a peripheral access crate (PAC) that was generated using [`svd2rust`] + **v0.14.x**, or a board support crate that depends on one such PAC as a + dependency. Make sure that the `rt` feature of the crate is enabled. + +[`svd2rust`]: https://crates.io/crates/svd2rust + +In this example, I'll use the [`lm3s6965`] device crate. This device crate +doesn't have an `rt` Cargo feature; that feature is always enabled. + +[`lm3s6965`]: https://crates.io/crates/lm3s6965 + +This device crate provides a linker script with the memory layout of the target +device so `memory.x` and `build.rs` need to be removed. + +``` console +$ cargo add lm3s6965 --vers 0.1.3 + +$ rm memory.x build.rs +``` + +3. Add the `cortex-m-rtfm` crate as a dependency and, if you need it, enable the + `timer-queue` feature. + +``` console +$ cargo add cortex-m-rtfm +``` + +4. Write your RTFM application. + +Here I'll use the `init` example from the `cortex-m-rtfm` crate. + +``` console +$ curl \ + -L https://github.com/japaric/cortex-m-rtfm/raw/v0.4.0/examples/init.rs \ + > src/main.rs +``` + +That example depends on the `panic-semihosting` crate: + +``` console +$ cargo add panic-semihosting +``` + +5. Build it, flash it and run it. + +``` console +$ # NOTE: I have uncommented the `runner` option in `.cargo/config` +$ cargo run +{{#include ../../../../ci/expected/init.run}}``` |
