Skip to content

Commit

Permalink
Merge #193
Browse files Browse the repository at this point in the history
193: Qemu md changes r=therealprof a=stefaneicher



Co-authored-by: Stefan Eicher <[email protected]>
  • Loading branch information
bors[bot] and Stefan Eicher committed Jun 3, 2019
2 parents 9858872 + b003f33 commit f0c75b7
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/start/qemu.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,25 @@ the tooling and the development process.

[LM3S6965]: http://www.ti.com/product/LM3S6965

**IMPORTANT**
We'll use the name "app" for the project name in this tutorial.
Whenever you see the word "app" you should replace it with the name you selected
for your project. Or, you could also name your project "app" and avoid the
substitutions.

## Creating a non standard Rust program

We'll use the [`cortex-m-quickstart`] project template to generate a new
project from it.

[`cortex-m-quickstart`]: https://github.com/rust-embedded/cortex-m-quickstart

- Using `cargo-generate`

### Using `cargo-generate`
First install cargo-generate
```console
cargo install cargo-generate
```
Then generate a new project
```console
cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart
```
Expand All @@ -30,7 +40,7 @@ cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart
cd app
```

- Using `git`
### Using `git`

Clone the repository

Expand All @@ -56,12 +66,10 @@ test = false
bench = false
```

- Using neither
### Using neither

Grab the latest snapshot of the `cortex-m-quickstart` template and extract it.

Using the command line:

```console
curl -LO https://github.com/rust-embedded/cortex-m-quickstart/archive/master.zip
unzip master.zip
Expand All @@ -75,10 +83,7 @@ download" button and then click "Download ZIP".
Then fill in the placeholders in the `Cargo.toml` file as done in the second
part of the "Using `git`" version.

**IMPORTANT** We'll use the name "app" for the project name in this tutorial.
Whenever you see the word "app" you should replace it with the name you selected
for your project. Or, you could also name your project "app" and avoid the
substitutions.
## Program Overview

For convenience here are the most important parts of the source code in `src/main.rs`:

Expand Down Expand Up @@ -125,7 +130,7 @@ that'd be `#[entry]`.
hardware so we don't want it to end! We use a [divergent function](https://doc.rust-lang.org/rust-by-example/fn/diverging.html) (the `-> !`
bit in the function signature) to ensure at compile time that'll be the case.

### Cross compiling
## Cross compiling

The next step is to *cross* compile the program for the Cortex-M3 architecture.
That's as simple as running `cargo build --target $TRIPLE` if you know what the
Expand Down Expand Up @@ -154,7 +159,7 @@ cargo build --target thumbv7m-none-eabi
cargo build
```

### Inspecting
## Inspecting

Now we have a non-native ELF binary in `target/thumbv7m-none-eabi/debug/app`. We
can inspect it using `cargo-binutils`.
Expand Down Expand Up @@ -293,7 +298,7 @@ HardFault:
663: <unknown>
```

### Running
## Running

Next, let's see how to run an embedded program on QEMU! This time we'll use the
`hello` example which actually does something.
Expand Down Expand Up @@ -414,7 +419,7 @@ cargo run --example hello --release
Hello, world!
```

### Debugging
## Debugging

Debugging is critical to embedded development. Let's see how it's done.

Expand Down

0 comments on commit f0c75b7

Please sign in to comment.