Skip to content

Commit

Permalink
add docs for setting up binary crate
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Jun 25, 2024
1 parent cc49535 commit a5dafa1
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion va416xx-hal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,35 @@ to conveniently flash with `cargo run`.

## Setting up your own binary crate

TODO
If you have a custom board, you might be interested in setting up a new binary crate for your
project. These steps aim to provide a complete list to get a binary crate working to flash
your custom board.

The hello world of embedded development is usually to blinky a LED. This example
is contained within the
[examples folder](https://egit.irs.uni-stuttgart.de/rust/va416xx-rs/src/branch/main/examples/simple/examples/blinky.rs).

1. Set up your Rust cross-compiler if you have not done so yet. See more in the [build chapter](#Building)
2. Create a new binary crate with `cargo init`
3. To ensure that `cargo build` cross-compiles, it is recommended to create a `.cargo/config.toml`
file. A sample `.cargo/config.toml` file is provided in this repository as well
4. Copy the `memory.x` file into your project. This file contains information required by the linker.
5. Copy the `blinky.rs` file to the `src/main.rs` file in your binary crate
6. You need to add some dependencies to your `Cargo.toml` file

```toml
[dependencies]
cortex-m = "<Compatible Version>"
cortex-m-rt = "<Compatible Version>"
panic-halt = "<Compatible Version>"
embedded-hal = "<Compatible Version>"

[dependencies.va416xx-hal]
version = "<Most Recent Version>"
features = ["rt"]
```

6. Build the application with `cargo build`

7. Flashing the board might work differently for different boards and there is usually
more than one way. You can find example instructions in primary README.

0 comments on commit a5dafa1

Please sign in to comment.