Skip to content

Commit 55f2449

Browse files
committed
add example for STM32F4 chips
note that this is not part of the main `Cargo.toml` as it has to build against a different target, which isn't supported if they are in the same workspace.
1 parent 58353bf commit 55f2449

File tree

14 files changed

+885
-7
lines changed

14 files changed

+885
-7
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ updates:
88
directory: "/"
99
schedule:
1010
interval: "weekly"
11+
- package-ecosystem: "cargo"
12+
directory: "/examples/stm32f4-event-printer"
13+
schedule:
14+
interval: "weekly"

.github/workflows/CI.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ on:
55
branches: [ "master" ]
66
pull_request:
77

8-
env:
9-
CARGO_TERM_COLOR: always
10-
118
jobs:
12-
build:
9+
lib:
1310
strategy:
1411
fail-fast: false
1512
matrix:
@@ -35,3 +32,31 @@ jobs:
3532
run: cargo clippy ${{ matrix.features }}
3633
- name: audit
3734
run: cargo audit
35+
36+
stm32f4-event-printer:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v3
40+
- name: install rust toolchain
41+
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
targets: thumbv7em-none-eabihf
44+
components: rustfmt clippy
45+
- name: Install flip-link
46+
run: cargo install flip-link
47+
- name: build
48+
run: cargo build
49+
working-directory: examples/stm32f4-event-printer
50+
- name: check
51+
run: cargo check
52+
working-directory: examples/stm32f4-event-printer
53+
# no tests available for now => no test step as it'd fail otherwise
54+
- name: check formatting
55+
run: cargo fmt --all -- --check
56+
working-directory: examples/stm32f4-event-printer
57+
- name: clippy
58+
run: cargo clippy
59+
working-directory: examples/stm32f4-event-printer
60+
- name: audit
61+
run: cargo audit
62+
working-directory: examples/stm32f4-event-printer

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/target
1+
**/target
22
/Cargo.lock
33

4-
.idea
5-
.vscode
4+
**/.idea
5+
**/.vscode

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Note that this work is not affiliated with Adafruit.
1717
but you can opt to only select the event(s) you are interested in which will result in a small binary size.
1818
If other events are received, a `ProtocolParseError::DisabledControllerDataPackageType` will be returned.
1919

20+
## Examples
21+
A simple example for the STM32F4 microcontrollers is [available](examples/stm32f4-event-printer/README.md).
22+
2023
## Changelog
2124
For the changelog please see the dedicated [CHANGELOG.md](CHANGELOG.md).
2225

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[target.thumbv7em-none-eabihf]
2+
runner = 'probe-run --chip STM32F401RE'
3+
rustflags = [
4+
"-C", "link-arg=-Tlink.x",
5+
"-C", "link-arg=-Tdefmt.x",
6+
"-C", "linker=flip-link",
7+
]
8+
9+
[build]
10+
target = "thumbv7em-none-eabihf"
11+
12+
[env]
13+
DEFMT_LOG = "info"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Install target
18+
run: rustup target add thumbv7em-none-eabihf
19+
- name: Install flip-link
20+
run: cargo install flip-link
21+
- uses: actions/checkout@v3
22+
- name: Build
23+
run: cargo build
24+
# no tests available for now => no test step as it'd fail otherwise
25+
- uses: actions-rs/cargo@v1
26+
with:
27+
command: fmt
28+
args: --all -- --check
29+
- uses: actions-rs/cargo@v1
30+
with:
31+
command: clippy

0 commit comments

Comments
 (0)