aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-02-18 15:09:33 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-02-18 16:10:00 +0100
commit6ef3740665e3b0ec4e466dc2e4b23900700b2ab3 (patch)
treeb8f884f0de88060c236909a7d25b942165904b92
parenta754aea27f208bab0b1badc0d85f2dd161e6eae7 (diff)
downloadntw-6ef3740665e3b0ec4e466dc2e4b23900700b2ab3.tar.gz
ntw-6ef3740665e3b0ec4e466dc2e4b23900700b2ab3.tar.bz2
Add usage example to readme
-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