Skip to content

Commit 569c339

Browse files
bors[bot]wpd
andauthored
Merge #289
289: Make it easier to copy and paste example commands. r=eldruin a=wpd Remove $ prompt for commands that could be copied & pasted. Change ``` console to ``` text for command examples that include output. Co-authored-by: Patrick Doyle <wpdster@gmail.com>
2 parents d3f2ace + 4ddbf15 commit 569c339

File tree

10 files changed

+41
-41
lines changed

10 files changed

+41
-41
lines changed

src/intro/install.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Install rustup by following the instructions at [https://rustup.rs](https://rust
99
**NOTE** Make sure you have a compiler version equal to or newer than `1.31`. `rustc
1010
-V` should return a date newer than the one shown below.
1111

12-
``` console
12+
``` text
1313
$ rustc -V
1414
rustc 1.31.1 (b6c32da9b 2018-12-18)
1515
```
@@ -21,43 +21,43 @@ board used for the examples in this book, use the `thumbv7em-none-eabihf` target
2121

2222
Cortex-M0, M0+, and M1 (ARMv6-M architecture):
2323
``` console
24-
$ rustup target add thumbv6m-none-eabi
24+
rustup target add thumbv6m-none-eabi
2525
```
2626

2727
Cortex-M3 (ARMv7-M architecture):
2828
``` console
29-
$ rustup target add thumbv7m-none-eabi
29+
rustup target add thumbv7m-none-eabi
3030
```
3131

3232
Cortex-M4 and M7 without hardware floating point (ARMv7E-M architecture):
3333
``` console
34-
$ rustup target add thumbv7em-none-eabi
34+
rustup target add thumbv7em-none-eabi
3535
```
3636

3737
Cortex-M4F and M7F with hardware floating point (ARMv7E-M architecture):
3838
``` console
39-
$ rustup target add thumbv7em-none-eabihf
39+
rustup target add thumbv7em-none-eabihf
4040
```
4141

4242
Cortex-M23 (ARMv8-M architecture):
4343
``` console
44-
$ rustup target add thumbv8m.base-none-eabi
44+
rustup target add thumbv8m.base-none-eabi
4545
```
4646

4747
Cortex-M33 and M35P (ARMv8-M architecture):
4848
``` console
49-
$ rustup target add thumbv8m.main-none-eabi
49+
rustup target add thumbv8m.main-none-eabi
5050
```
5151

5252
Cortex-M33F and M35PF with hardware floating point (ARMv8-M architecture):
5353
``` console
54-
$ rustup target add thumbv8m.main-none-eabihf
54+
rustup target add thumbv8m.main-none-eabihf
5555
```
5656

5757

5858
### `cargo-binutils`
5959

60-
``` console
60+
``` text
6161
$ cargo install cargo-binutils
6262
6363
$ rustup component add llvm-tools-preview
@@ -68,7 +68,7 @@ $ rustup component add llvm-tools-preview
6868
We'll use this later to generate a project from a template.
6969

7070
``` console
71-
$ cargo install cargo-generate
71+
cargo install cargo-generate
7272
```
7373

7474
### OS-Specific Instructions

src/intro/install/macos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All the tools can be install using [Homebrew]:
44

55
[Homebrew]: http://brew.sh/
66

7-
``` console
7+
``` text
88
$ # GDB
99
$ brew install armmbed/formulae/arm-none-eabi-gcc
1010

src/intro/install/verify.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ST-LINK header is circled in red.
1717
Now run the following command:
1818

1919
``` console
20-
$ openocd -f interface/stlink.cfg -f target/stm32f3x.cfg
20+
openocd -f interface/stlink.cfg -f target/stm32f3x.cfg
2121
```
2222

2323
> **NOTE**: Old versions of openocd, including the 0.10.0 release from 2017, do
@@ -54,11 +54,11 @@ and move to the [next section].
5454
If you didn't get the "breakpoints" line then try one of the following commands.
5555

5656
``` console
57-
$ openocd -f interface/stlink-v2.cfg -f target/stm32f3x.cfg
57+
openocd -f interface/stlink-v2.cfg -f target/stm32f3x.cfg
5858
```
5959

6060
``` console
61-
$ openocd -f interface/stlink-v2-1.cfg -f target/stm32f3x.cfg
61+
openocd -f interface/stlink-v2-1.cfg -f target/stm32f3x.cfg
6262
```
6363

6464
If one of those commands works it means you got an old hardware revision of the

src/intro/install/windows.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARM provides `.exe` installers for Windows. Grab one from [here][gcc], and follo
66
Just before the installation process finishes tick/select the "Add path to environment variable"
77
option. Then verify that the tools are in your `%PATH%`:
88

9-
``` console
9+
``` text
1010
$ arm-none-eabi-gdb -v
1111
GNU gdb (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 8.1.0.20180315-git
1212
(..)
@@ -26,7 +26,7 @@ if you've been using the easy install)
2626

2727
Verify that OpenOCD is in your `%PATH%` with:
2828

29-
``` console
29+
``` text
3030
$ openocd -v
3131
Open On-Chip Debugger 0.10.0
3232
(..)

src/start/exceptions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn SysTick() {
121121
```
122122

123123
``` console
124-
$ tail -n5 Cargo.toml
124+
tail -n5 Cargo.toml
125125
```
126126

127127
``` toml
@@ -132,7 +132,7 @@ panic-halt = "0.2.0"
132132
cortex-m-semihosting = "0.3.1"
133133
```
134134

135-
``` console
135+
``` text
136136
$ cargo run --release
137137
Running `qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb (..)
138138
123456789
@@ -227,7 +227,7 @@ fn HardFault(ef: &ExceptionFrame) -> ! {
227227
The `HardFault` handler prints the `ExceptionFrame` value. If you run this
228228
you'll see something like this on the OpenOCD console.
229229

230-
``` console
230+
``` text
231231
$ openocd
232232
(..)
233233
ExceptionFrame {
@@ -248,7 +248,7 @@ and it points to the instruction that triggered the exception.
248248
If you look at the disassembly of the program:
249249

250250

251-
``` console
251+
``` text
252252
$ cargo objdump --bin app --release -- -d --no-show-raw-insn --print-imm-hex
253253
(..)
254254
ResetTrampoline:

src/start/hardware.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ We'll start from scratch with a fresh template instance. Refer to the
4040

4141
[previous section on QEMU]: qemu.md
4242

43-
``` console
43+
``` text
4444
$ cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart
4545
Project Name: app
4646
Creating project called `app`...
4747
Done! New project created /tmp/app
4848
49-
$ cd app
49+
$ cd app
5050
```
5151

5252
Step number one is to set a default compilation target in `.cargo/config`.
5353

5454
``` console
55-
$ tail -n5 .cargo/config
55+
tail -n5 .cargo/config
5656
```
5757

5858
``` toml
@@ -68,7 +68,7 @@ We'll use `thumbv7em-none-eabihf` as that covers the Cortex-M4F core.
6868
The second step is to enter the memory region information into the `memory.x`
6969
file.
7070

71-
``` console
71+
``` text
7272
$ cat memory.x
7373
/* Linker script for the STM32F303VCT6 */
7474
MEMORY
@@ -107,7 +107,7 @@ and inspect the binaries using `cargo-binutils` as you did before. The
107107
as helpfully, pretty much all Cortex-M CPUs boot in the same fashion.
108108

109109
``` console
110-
$ cargo build --example hello
110+
cargo build --example hello
111111
```
112112

113113
## Debugging
@@ -131,7 +131,7 @@ Run this command from the root of the template; `openocd` will pick up the
131131
`openocd.cfg` file which indicates which interface file and target file to use.
132132

133133
``` console
134-
$ cat openocd.cfg
134+
cat openocd.cfg
135135
```
136136

137137
``` text
@@ -153,7 +153,7 @@ source [find target/stm32f3x.cfg]
153153
> board during the [verify] section then you should modify the `openocd.cfg`
154154
> file at this point to use `interface/stlink-v2.cfg`.
155155
156-
``` console
156+
``` text
157157
$ openocd
158158
Open On-Chip Debugger 0.10.0
159159
Licensed under GNU GPL v2
@@ -175,7 +175,7 @@ Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
175175

176176
On another terminal run GDB, also from the root of the template.
177177

178-
``` console
178+
``` text
179179
$ <gdb> -q target/thumbv7em-none-eabihf/debug/examples/hello
180180
```
181181

@@ -243,7 +243,7 @@ Advancing the program with `next` should produce the same results as before.
243243
At this point you should see "Hello, world!" printed on the OpenOCD console,
244244
among other stuff.
245245

246-
``` console
246+
``` text
247247
$ openocd
248248
(..)
249249
Info : halted: PC: 0x08000e6c
@@ -269,7 +269,7 @@ Program received signal SIGTRAP, Trace/breakpoint trap.
269269

270270
It also causes this to be printed to the OpenOCD console:
271271

272-
``` console
272+
``` text
273273
$ openocd
274274
(..)
275275
Info : halted: PC: 0x08001188
@@ -293,7 +293,7 @@ Debugging now requires a few more steps so we have packed all those steps into a
293293
single GDB script named `openocd.gdb`. The file was created during the `cargo generate` step, and should work without any modifications. Let's have a peak:
294294

295295
``` console
296-
$ cat openocd.gdb
296+
cat openocd.gdb
297297
```
298298

299299
``` text
@@ -323,7 +323,7 @@ Alternatively, you can turn `<gdb> -x openocd.gdb` into a custom runner to make
323323
in `.cargo/config` but it's commented out.
324324

325325
``` console
326-
$ head -n10 .cargo/config
326+
head -n10 .cargo/config
327327
```
328328

329329
``` toml
@@ -339,7 +339,7 @@ runner = "arm-none-eabi-gdb -x openocd.gdb"
339339
# runner = "gdb -x openocd.gdb"
340340
```
341341

342-
``` console
342+
``` text
343343
$ cargo run --example hello
344344
(..)
345345
Loading section .vector_table, size 0x400 lma 0x8000000

src/start/panicking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fn main() -> ! {
9797
This example chose the `panic-semihosting` behavior which prints the panic
9898
message to the host console using semihosting.
9999

100-
``` console
100+
``` text
101101
$ cargo run
102102
Running `qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb (..)
103103
panicked at 'index out of bounds: the len is 3 but the index is 4', src/main.rs:12:13

src/start/qemu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ To cross compile for the Cortex-M3 architecture we have to use
158158
the Rust toolchain, it would now be a good time to add that target to the toolchain,
159159
if you haven't done it yet:
160160
``` console
161-
$ rustup target add thumbv7m-none-eabi
161+
rustup target add thumbv7m-none-eabi
162162
```
163163
Since the `thumbv7m-none-eabi` compilation target has been set as the default in
164164
your `.cargo/config` file, the two commands below do the same:

src/start/semihosting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn main() -> ! {
3232
If you run this program on hardware you'll see the "Hello, world!" message
3333
within the OpenOCD logs.
3434

35-
``` console
35+
``` text
3636
$ openocd
3737
(..)
3838
Hello, world!
@@ -51,7 +51,7 @@ need to pass the `-semihosting-config` flag to QEMU to enable semihosting
5151
support; these flags are already included in the `.cargo/config` file of the
5252
template.
5353

54-
``` console
54+
``` text
5555
$ # this program will block the terminal
5656
$ cargo run
5757
Running `qemu-system-arm (..)
@@ -86,7 +86,7 @@ fn main() -> ! {
8686
}
8787
```
8888

89-
``` console
89+
``` text
9090
$ cargo run
9191
Running `qemu-system-arm (..)
9292
@@ -120,7 +120,7 @@ fn main() -> ! {
120120
}
121121
```
122122

123-
``` console
123+
``` text
124124
$ cargo run
125125
Running `qemu-system-arm (..)
126126
panicked at 'assertion failed: `(left == right)`

src/unsorted/speed-vs-size.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ opt-level = "z" # +
5858

5959
Without the override:
6060

61-
``` console
61+
``` text
6262
$ cargo size --bin app -- -A
6363
app :
6464
section size addr
@@ -71,7 +71,7 @@ section size addr
7171

7272
With the override:
7373

74-
``` console
74+
``` text
7575
$ cargo size --bin app -- -A
7676
app :
7777
section size addr

0 commit comments

Comments
 (0)