commonsense-sw/README.md

65 lines
2.0 KiB
Markdown

# CommonSense_SW
Firmware for the CommonSense project.
## Compile and Run
The firmware depends on the S132 softdevice. Before running the firmware, the
softdevice has to flashed to the chip.
### Flashing the Softdevice
1. Erase the chip
```bash
$ probe-rs erase --chip nRF52832_xxAA
```
2. Flash the softdevice
```bash
$ probe-rs download --verify --binary-format hex --chip nRF52832_xxAA s132_nrf52_7.3.0_softdevice.hex
```
### Compile and Run
1. Install the required tools. Consult `Dockerfile` for specifics
2. Build the firmware
```bash
$ cargo build --release
```
3. Flash / run the firmware
```bash
$ cargo fr
$ # OR
$ cargo run --release
```
### Compile and Run using Docker
1. Build the docker image
```bash
$ docker build . -t commonsense
```
2. Build the firmware
```bash
$ docker run --rm -v $PWD:$PWD -w $PWD -u $(id -u):$(id -g) commonsense cargo build --release
```
3. Flash / run the firmware
```bash
$ docker run --privileged -v /dev/bus/usb/:/dev/bus/usb --rm -v $PWD:$PWD -w $PWD -u $(id -u):$(id -g) commonsense cargo fr
$ # OR
$ docker run --privileged -v /dev/bus/usb/:/dev/bus/usb --rm -v $PWD:$PWD -w $PWD -u $(id -u):$(id -g) commonsense cargo run --release
```
## Notes
- If flashing fails after being successful the first time, take a look at this:
https://users.rust-lang.org/t/probe-rs-fails-to-work-after-first-time-use-successful/103234
- This may be useful for unit testing: https://crates.io/crates/embedded-test
- Currently this project is being developed on the nrf52-dk board with the
nrf52832 chip. What mature enough, it will be ported to the nrf52810 to run
on the actual hardware. Locations to modify:
- `memory.x` - consult the
[nrf-softdevice](https://github.com/embassy-rs/nrf-softdevice)
documentation for more information
- `Cargo.toml` - change the `nrf52832` feature to `nrf52810`
- `.cargo/config.toml` - change the `nrf52832` chip to `nrf52810`