README: Update the README to explain how to get started Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
diff --git a/README.md b/README.md index 3f7e7f8..36be4b0 100644 --- a/README.md +++ b/README.md
@@ -28,35 +28,25 @@ 1. Clone the repository: - ```bash + ```shell git clone https://github.com/tock/libtock-rs cd libtock-rs ``` -1. Install `elf2tab`: +1. Install the dependencies: - ```bash - cargo install -f elf2tab --version 0.4.0 + ```shell + make setup ``` -1. Add dependencies for cross-compilation. Currently, only few platforms have been configured, e.g.: +1. Use `make` to compile and run an example app. - ```bash - rustup target add thumbv7em-none-eabi # For an nRF52 DK board + ```shell + make nrf52 # Builds all examples for the nrf52 platform ``` ```bash - rustup target add riscv32imc-unknown-none-elf # For an OpenTitan board - ``` - -1. Use `cargo r<arch>` to compile and run an example app. The full command is platform dependent and looks as follows for the `blink` example: - - ```bash - PLATFORM=nrf52 cargo rthumbv7em blink # For an nRF52 DK board - ``` - - ```bash - PLATFORM=opentitan cargo rriscv32imc blink # For an OpenTitan board + make opentitan # Builds all examples for the OpenTitan platform ``` ```bash @@ -91,8 +81,14 @@ To run on the code on your board you can use -```bash -PLATFORM=<platform> cargo r<arch> <your_app> [--features=alloc] +```shell +make <platform> [FEATURES=alloc] +``` + +The example can also be flashed to the board by running: + +```shell +make flash-<platform> EXAMPLE=<example> ``` This script does the following steps for you: @@ -101,11 +97,6 @@ - create a TAB (tock application bundle) - if you have a J-Link compatible board connected: flash this TAB to your board (using tockloader) -Instead of specifying an environment variable each time you can permanently configure your platform by writing its name into a file named `platform`, e.g. - -```bash -echo nrf52 > platform -``` ## License