From a34f0205b383a72a0c4f826657930f7ec29d6b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Fri, 21 Jan 2022 13:28:14 +0100 Subject: [PATCH] Highlight how to run examples locally --- book/en/src/by-example.md | 15 +++++++++++++++ book/en/src/by-example/resources.md | 2 ++ 2 files changed, 17 insertions(+) diff --git a/book/en/src/by-example.md b/book/en/src/by-example.md index 84f00193ae..3a523e51bb 100644 --- a/book/en/src/by-example.md +++ b/book/en/src/by-example.md @@ -15,3 +15,18 @@ Check [the embedded Rust book] for instructions on how to set up an embedded development environment that includes QEMU. [the embedded Rust book]: https://rust-embedded.github.io/book/intro/install.html + +To run the examples found in `examples/` locally, cargo needs a supported `target` and +either `--examples` (run all examples) or `--example NAME` to run a specific example. + +Assuming dependencies in place, running: + +``` console +$ cargo run --target thumbv7m-none-eabi --example locals +``` + +Yields this output: + +``` console +{{#include ../../../ci/expected/locals.run}} +``` diff --git a/book/en/src/by-example/resources.md b/book/en/src/by-example/resources.md index 0b69c4dba4..6426913289 100644 --- a/book/en/src/by-example/resources.md +++ b/book/en/src/by-example/resources.md @@ -37,6 +37,8 @@ The example application shown below contains two tasks where each task has acces {{#include ../../../../examples/locals.rs}} ``` +Running the example: + ``` console $ cargo run --target thumbv7m-none-eabi --example locals {{#include ../../../../ci/expected/locals.run}}