aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/README.md b/README.md
index a31e315..91def3a 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,54 @@ development and supports:
- `GET_STATUS`
- `READ_SLOT_NAME`
+## Usage Example
+
+To be able to compile `ntw`, you have to add the thumbv7m-none-eabi target to
+your Rust installation, for example by running:
+
+```
+$ rustup target add thumbv7m-none-eabi
+```
+
+Now you can compile `ntw`:
+
+```
+$ cargo build --release
+```
+
+To communicate with an MCU connected using an ST-Link debugger, start `openocd`
+using the provided configuration file:
+
+```
+$ openocd --file etc/openocd.cfg
+```
+
+Now you can use `gdb` to flash `ntw` to the MCU and to start a debugging
+session. `cargo run` is configured to execute `gdb`, flash the MCU and add
+breakpoints at the beginning of the program and at the panic handlers. Once
+you see the `gdb` prompt, type `c` to continue the program execution.
+
+```
+$ cargo run --release
+```
+
+Depending on your operating system, you might have to change the name of the
+`gdb` executable in `.cargo/config`.
+
+To verify that everything works as expected, you can try to access the device:
+
+```
+$ nitrocli status
+Status:
+ model: Pro
+ serial number: 0x00000000
+ firmware version: 0.1
+ user retry count: 0
+ admin retry count: 0
+```
+
+If this does not work, check the output of `dmesg`, `lsusb` and `usbhid-dump`.
+
## Resources
### Development Setup