Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on:
pull_request:
merge_group:

name: example-simple

# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: thumbv7em-none-eabihf
override: true

- name: Format
working-directory: ./examples/simple
run: cargo fmt
- name: Regular build
working-directory: ./examples/simple
run: cargo check
- name: Clippy
working-directory: ./examples/simple
run: cargo clippy
35 changes: 35 additions & 0 deletions .github/workflows/macros.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
pull_request:
merge_group:

name: macros

# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true

- name: Format
working-directory: ./macros
run: cargo fmt
- name: Regular build
working-directory: ./macros
run: cargo check
- name: Clippy
working-directory: ./macros
run: cargo clippy
40 changes: 40 additions & 0 deletions .github/workflows/probe-plotter-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
pull_request:
merge_group:

name: probe-plotter-tools

# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true

- name: Install libudev (linux)
run: |
sudo apt update
sudo apt install -y libudev-dev

- name: Format
working-directory: ./probe-plotter-tools
run: cargo fmt
- name: Regular build
working-directory: ./probe-plotter-tools
run: cargo check
- name: Clippy
working-directory: ./probe-plotter-tools
run: cargo clippy
36 changes: 36 additions & 0 deletions .github/workflows/probe-plotter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on:
pull_request:
merge_group:

name: probe-plotter

# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: thumbv7em-none-eabihf
override: true

- name: Format
working-directory: ./probe-plotter
run: cargo fmt
- name: Regular build
working-directory: ./probe-plotter
run: cargo check
- name: Clippy
working-directory: ./probe-plotter
run: cargo clippy
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# probe-plotter

A set of tools to plot values from the target to graph in rerun with minimal performance impact. This project is based on code from `defmt` and `cortex_m`'s `singleton` macro. It also uses rerun for visualization.

* probe-plotter - The target side library
* probe-plotter-tools - The host side application

```rust
#![no_std]
#![no_main]

use cortex_m_rt::entry;
use panic_halt as _;

#[entry]
fn main() -> ! {
use probe_plotter::make_metric;
let mut sawtooth = make_metric!(SAWTOOTH: i32 = 42, "(x / 10) % 100").unwrap();
let mut sine = make_metric!(SINE: i32 = 42, "100 * sin(2 * pi * x / 4000)").unwrap();
loop {
for i in 0..i32::MAX {
sawtooth.set(i);
sine.set(i);
cortex_m::asm::delay(100_000);
}
}
}
```

The formulas seen in the `make_metric` macro invocation are computed by the host and will thus have zero impact on the targets performance. The `set` method on the metrics object is simply a volatile store which is quite cheap. The host will then read that value using the debug probe at regular intervals and update the graph on any changes.

##### Prerequisits
probe-plotter uses the Rerun viewer for visualizing the graphs. Please [make sure to have that installed](https://rerun.io/docs/getting-started/installing-viewer#installing-the-viewer). Also make sure to have libudev installed.

##### To run the tool

```
cd probe-plotter-host
cargo run /path/to/elf chip_name
```

So for example plotting the example in examples/simple on a Nucleo-G474RE

```
cd examples/simple
cargo run # Let it flash and then cancel (Ctrl+C) to let the target continue running in the background while giving up access to the probe

cd ../probe-plotter-tools
cargo run ../examples/simple/target/thumbv7em-none-eabihf/debug/simple stm32g474retx
# Rerun will open with a graph showing all created metrics objects
```

<img width="2880" height="1920" alt="Screenshot" src="https://github.com/user-attachments/assets/5f7f20c9-009d-42c7-9613-789ae26afe54" />
Binary file added Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions examples/simple/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[target.thumbv7em-none-eabihf]
runner = 'probe-rs run --connect-under-reset'

[build]
target = "thumbv7em-none-eabihf"

rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=-Tdefmt.x"
]
1 change: 1 addition & 0 deletions examples/simple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
Loading
Loading