Skip to content

Commit

Permalink
Try #452:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Oct 12, 2021
2 parents 2dfaa8d + d284abe commit fb6c400
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto

mosquitto.conf text eol=lf
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/dsp/target
/dsp/target
vpy/
7 changes: 3 additions & 4 deletions book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ cargo install mdbook-linkcheck
```

To build the user manual locally, build docs for the firmware, copy them into the book source
directory, and then sere the book:
directory, and then serve the book:
```
cargo doc --no-deps -p miniconf -p stabilizer -p dsp -p ad9959
cargo doc --no-deps -p miniconf -p stabilizer -p idsp -p ad9959
mv target/thumbv7em-none-eabihf/doc book/src/firmware
cd book
mdbook serve
mdbook serve book
```

Once the `mdbook serve` command is run, the manual can be found on a web browser at
Expand Down
41 changes: 28 additions & 13 deletions book/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ desired application.
```bash
git clone https://github.com/quartiq/stabilizer
```
1. Get [rustup](https://rustup.rs/)
2. Get [rustup](https://rustup.rs/)
* The minimum supported Rust version (MSRV) is 1.52.0
1. Install target support

3. Install target support
```bash
rustup target add thumbv7em-none-eabihf
```
1. Build Firmware with an optionally-specified MQTT broker IP.
4. Build Firmware with an optionally-specified MQTT broker IP.
```bash
# Bash
BROKER="10.34.16.10" cargo build --release

# Powershell
# Note: This sets the broker for all future builds as well.
$env:BROKER='10.34.16.10'; cargo build --release
```

## Uploading Firmware
Expand All @@ -51,12 +57,16 @@ cargo install cargo-binutils
rustup component add llvm-tools-preview
```

1. Generate the binary file
2. Generate the binary file
```bash
cargo objcopy --release --bin dual-iir -- -O binary dual-iir.bin`
# Bash
BROKER="10.34.16.10" cargo objcopy --release --bin dual-iir -- -O binary dual-iir.bin

# Powershell
$env:BROKER='10.34.16.10'; cargo objcopy --release --bin dual-iir -- -O binary dual-iir.bin
```

1. Copy `dual-iir.bin` into the ST-Link drive on your computer.
3. Copy `dual-iir.bin` into the ST-Link drive on your computer.


### Alternative: Using USB
Expand All @@ -82,11 +92,15 @@ For an interactive flash experience with live logging, utilize `probe-run` as fo
```bash
cargo install probe-run
```
1. Build and run firmware on the device
2. Build and run firmware on the device
```bash
cargo run --release --bin dual-iir
# Bash
BROKER="10.34.16.10" cargo run --release --bin dual-iir

# Powershell
$Env:BROKER='10.34.16.10'; cargo run --release --bin dual-iir
```
1. When using debug (non `--release`) mode, decrease the sampling frequency significantly.
3. When using debug (non `--release`) mode, decrease the sampling frequency significantly.
The added error checking code and missing optimizations may lead to the code
missing deadlines and panicing.

Expand All @@ -105,12 +119,13 @@ Stabilizer utilizes a static IP address for broker configuration. Ensure the IP
We recommend running Mosquitto through [Docker](https://docker.com) to easily run Mosquitto on
Windows, Linux, and OSX. After docker has been installed, run the following command from
the `stabilizer` repository:
```
```bash
# Bash
docker run -p 1883:1883 --name mosquitto -v `pwd`/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /mosquitto/data -v /mosquitto/log eclipse-mosquitto:2
```

> _Note_: The above command assumes a bash shell. If using powershell, replace `` `pwd` `` with
> `${pwd}`
# Powershell
docker run -p 1883:1883 --name mosquitto -v ${pwd}/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /mosquitto/data -v /mosquitto/log eclipse-mosquitto:2
```

This command will create a container named `mosquitto` that can be stopped and started easily via
docker.
Expand Down
13 changes: 11 additions & 2 deletions book/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ Settings are specific to an application. If two identical settings exist for two
applications, each application maintains its own independent value.

## Installation
Install the Miniconf configuration utilities:
Install the Miniconf configuration utilities using a virtual environment:
```
python -m pip install git+https://github.com/quartiq/miniconf#subdirectory=miniconf-py
python -m venv --system-site-packages vpy
# Refer to https://docs.python.org/3/tutorial/venv.html for more information on activating the
# virtual environment. This command is different on different platforms.
./vpy/Scripts/activate
```

Next, install prerequisite packages
```
python -m pip install -r scripts/requirements.txt
```

To use `miniconf`, execute it as follows:
Expand Down
4 changes: 2 additions & 2 deletions hitl/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
set -eux

# Set up python for testing
python3 -m venv --system-site-packages py-venv
. py-venv/bin/activate
python3 -m venv --system-site-packages vpy
. vpy/bin/activate

# Install Miniconf utilities for configuring stabilizer.
python3 -m pip install -e py/
Expand Down
3 changes: 2 additions & 1 deletion py/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from setuptools import setup
from setuptools import setup, find_packages

setup(name='stabilizer',
packages=find_packages(),
version='0.1',
description='Stabilizer Utilities',
author='QUARTIQ GmbH',
Expand Down
3 changes: 3 additions & 0 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
py/
git+https://github.com/quartiq/miniconf#subdirectory=py/miniconf-mqtt
gmqtt

0 comments on commit fb6c400

Please sign in to comment.