Skip to content

Commit 3a9cec8

Browse files
bors[bot]mike-kfedAfoHT
authored
Merge #112
112: Rtic v2 blinky example r=AfoHT a=mike-kfed I also updated v1 to work with my board and its dependencies, I hope that is okay. Co-authored-by: Michael Kefeder <m.kefeder@gmail.com> Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
2 parents 15d6a22 + 45cac4b commit 3a9cec8

File tree

20 files changed

+1754
-43
lines changed

20 files changed

+1754
-43
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,13 @@ updates:
8585
schedule:
8686
interval: "weekly"
8787
rebase-strategy: "disabled"
88+
- package-ecosystem: "cargo"
89+
directory: "/rtic_v2/rp2040_local_i2c_init"
90+
schedule:
91+
interval: "weekly"
92+
rebase-strategy: "disabled"
93+
- package-ecosystem: "cargo"
94+
directory: "/rtic_v2/stm32f3_blinky"
95+
schedule:
96+
interval: "weekly"
97+
rebase-strategy: "disabled"

.github/workflows/build.yml

Lines changed: 86 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ jobs:
1919
- name: Checkout
2020
uses: actions/checkout@v3
2121

22-
- name: Install all Rust targets
23-
run: rustup target install thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabihf
22+
- name: Configure Rust target (v6, v7, v8.b v8.m)
23+
run: |
24+
rustup target add thumbv6m-none-eabi
25+
rustup target add thumbv7m-none-eabi
26+
rustup target add thumbv7em-none-eabihf
27+
rustup target add thumbv8m.base-none-eabi
28+
rustup target add thumbv8m.main-none-eabi
2429
2530
- name: cargo fmt --check
2631
run: find . -type f -name Cargo.toml -execdir cargo fmt --check --manifest-path {} +
@@ -29,76 +34,124 @@ jobs:
2934
check:
3035
name: check
3136
runs-on: ubuntu-22.04
37+
strategy:
38+
matrix:
39+
rticversion:
40+
- v0.5
41+
- v1
42+
- v2
3243
steps:
3344
- name: Checkout
3445
uses: actions/checkout@v3
3546

3647
- name: Cache Dependencies
3748
uses: Swatinem/rust-cache@v2
3849

39-
- name: Install all Rust targets
40-
run: rustup target install thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabihf
50+
- name: Install Rust nightly
51+
run: |
52+
rustup toolchain install nightly
53+
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
54+
55+
- name: Configure Rust target (v6, v7, v8.b v8.m)
56+
run: |
57+
rustup target add thumbv6m-none-eabi
58+
rustup target add thumbv7m-none-eabi
59+
rustup target add thumbv7em-none-eabihf
60+
rustup target add thumbv8m.base-none-eabi
61+
rustup target add thumbv8m.main-none-eabi
62+
63+
- name: Install flip-link
64+
run: cargo install flip-link
4165

4266
- name: cargo check
43-
run: find . -type f -name Cargo.toml -execdir cargo check --target-dir /tmp/build --manifest-path {} +
67+
if: ${{ matrix.rticversion != 'v2' }}
68+
run: find rtic_${{ matrix.rticversion }} -type f -name Cargo.toml -execdir cargo build --release --manifest-path {} +
69+
70+
- name: cargo check
71+
if: ${{ matrix.rticversion == 'v2' }}
72+
run: find rtic_${{ matrix.rticversion }} -type f -name Cargo.toml -execdir cargo +nightly build --release --manifest-path {} +
4473

4574
# Clippy
4675
clippy:
4776
name: Cargo clippy
4877
runs-on: ubuntu-22.04
78+
strategy:
79+
matrix:
80+
rticversion:
81+
- v0.5
82+
- v1
83+
- v2
84+
4985
steps:
5086
- name: Checkout
5187
uses: actions/checkout@v3
5288

5389
- name: Cache Dependencies
5490
uses: Swatinem/rust-cache@v2
5591

56-
- name: Install all Rust targets
57-
run: rustup target install thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabihf
58-
59-
- name: cargo clippy
60-
run: find . -type f -name Cargo.toml -execdir cargo clippy --target-dir /tmp/build --manifest-path {} +
92+
- name: Install Rust nightly
93+
run: |
94+
rustup toolchain install nightly
95+
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
96+
rustup component add clippy --toolchain nightly-x86_64-unknown-linux-gnu
6197
98+
- name: Configure Rust target (v6, v7, v8.b v8.m)
99+
run: |
100+
rustup target add thumbv6m-none-eabi
101+
rustup target add thumbv7m-none-eabi
102+
rustup target add thumbv7em-none-eabihf
103+
rustup target add thumbv8m.base-none-eabi
104+
rustup target add thumbv8m.main-none-eabi
62105
63-
# Compilation
64-
buildv0_5:
65-
name: build v0.5
66-
runs-on: ubuntu-22.04
67-
steps:
68-
- name: Checkout
69-
uses: actions/checkout@v3
70-
71-
- name: Cache Dependencies
72-
uses: Swatinem/rust-cache@v2
106+
- name: cargo clippy
107+
if: ${{ matrix.rticversion != 'v2' }}
108+
run: find rtic_${{ matrix.rticversion }} -type f -name Cargo.toml -execdir cargo clippy --target-dir /tmp/build --manifest-path {} +
73109

74-
- name: Install all Rust targets
75-
run: rustup target install thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabihf
76-
77-
- name: Install flip-link
78-
run: cargo install flip-link
110+
- name: cargo clippy
111+
if: ${{ matrix.rticversion == 'v2' }}
112+
run: find rtic_${{ matrix.rticversion }} -type f -name Cargo.toml -execdir cargo +nightly clippy --target-dir /tmp/build --manifest-path {} +
79113

80-
- name: cargo build
81-
run: find rtic_v0.5 -type f -name Cargo.toml -execdir cargo build --release --manifest-path {} +
82114

83115
# Compilation
84-
buildv1:
85-
name: build v1
116+
build:
117+
name: build
86118
runs-on: ubuntu-22.04
119+
strategy:
120+
matrix:
121+
rticversion:
122+
- v0.5
123+
- v1
124+
- v2
87125
steps:
88126
- name: Checkout
89127
uses: actions/checkout@v3
90128

91129
- name: Cache Dependencies
92130
uses: Swatinem/rust-cache@v2
93131

94-
- name: Install all Rust targets
95-
run: rustup target install thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabihf
132+
- name: Install Rust nightly
133+
run: |
134+
rustup toolchain install nightly
135+
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
136+
137+
- name: Configure Rust target (v6, v7, v8.b v8.m)
138+
run: |
139+
rustup target add thumbv6m-none-eabi
140+
rustup target add thumbv7m-none-eabi
141+
rustup target add thumbv7em-none-eabihf
142+
rustup target add thumbv8m.base-none-eabi
143+
rustup target add thumbv8m.main-none-eabi
96144
97145
- name: Install flip-link
98146
run: cargo install flip-link
99147

100148
- name: cargo build
101-
run: find rtic_v1 -type f -name Cargo.toml -execdir cargo build --release --manifest-path {} +
149+
if: ${{ matrix.rticversion != 'v2' }}
150+
run: find rtic_${{ matrix.rticversion }} -type f -name Cargo.toml -execdir cargo build --release --manifest-path {} +
151+
152+
- name: cargo build
153+
if: ${{ matrix.rticversion == 'v2' }}
154+
run: find rtic_${{ matrix.rticversion }} -type f -name Cargo.toml -execdir cargo +nightly build --release --manifest-path {} +
102155

103156
check-dependabot-config:
104157
name: Ensure that `dependabot.yml` is up to date
@@ -122,8 +175,7 @@ jobs:
122175
- style
123176
- check
124177
- clippy
125-
- buildv0_5
126-
- buildv1
178+
- build
127179
- check-dependabot-config
128180
runs-on: ubuntu-22.04
129181
steps:

rtic_v1/stm32f3_blinky/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ name = "stm32f3-blinky"
66
version = "0.1.0"
77

88
[dependencies]
9-
embedded-hal = "0.2.6"
9+
embedded-hal = "0.2.7"
1010
cortex-m-rtic = "1.1.4"
11-
systick-monotonic = "1.0.0"
11+
systick-monotonic = "1.0.1"
1212
panic-rtt-target = { version = "0.1.2", features = ["cortex-m"] }
1313
rtt-target = { version = "0.3.1", features = ["cortex-m"] }
1414

rtic_v1/stm32f3_blinky/Embed.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[default.general]
2+
chip = "stm32f303re"
3+
4+
5+
[default.rtt]
6+
enabled = true
7+
8+
[default.gdb]
9+
enabled = false

rtic_v1/stm32f3_blinky/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# STM32F3 RTIC Blink example
22

3-
Working example of simple LED blinking application for STM32 F3 Discovery boards based on the STM32F303VC chip. Example uses schedule API and peripherials access. This example is based on blue-pill blinky example.
3+
Working example of simple LED blinking application for STM32 F303 Nucleo-64 board based on the STM32F303RE chip. Example uses schedule API and peripherials access. This example is based on blue-pill blinky example.
44

55
## How-to
66

rtic_v1/stm32f3_blinky/src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use panic_rtt_target as _;
77
use rtic::app;
88
use rtt_target::{rprintln, rtt_init_print};
9-
use stm32f3xx_hal::gpio::{Output, PushPull, PE10};
9+
use stm32f3xx_hal::gpio::{Output, PushPull, PA5};
1010
use stm32f3xx_hal::prelude::*;
1111
use systick_monotonic::{fugit::Duration, Systick};
1212

@@ -19,7 +19,7 @@ mod app {
1919

2020
#[local]
2121
struct Local {
22-
led: PE10<Output<PushPull>>,
22+
led: PA5<Output<PushPull>>,
2323
state: bool,
2424
}
2525

@@ -45,10 +45,10 @@ mod app {
4545
.freeze(&mut flash.acr);
4646

4747
// Setup LED
48-
let mut gpioe = cx.device.GPIOE.split(&mut rcc.ahb);
49-
let mut led = gpioe
50-
.pe10
51-
.into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper);
48+
let mut gpioa = cx.device.GPIOA.split(&mut rcc.ahb);
49+
let mut led = gpioa
50+
.pa5
51+
.into_push_pull_output(&mut gpioa.moder, &mut gpioa.otyper);
5252
led.set_high().unwrap();
5353

5454
// Schedule the blinking task
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[target.thumbv6m-none-eabi]
2+
# uncomment this to make `cargo run` execute programs on QEMU
3+
# runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
4+
5+
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
6+
# uncomment ONE of these three option to make `cargo run` start a GDB session
7+
# which option to pick depends on your system
8+
# runner = "arm-none-eabi-gdb -q -x openocd.gdb"
9+
# runner = "gdb-multiarch -q -x openocd.gdb"
10+
# runner = "gdb -q -x openocd.gdb"
11+
12+
rustflags = [
13+
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
14+
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95
15+
"-C", "link-arg=--nmagic",
16+
17+
# LLD (shipped with the Rust toolchain) is used as the default linker
18+
"-C", "link-arg=-Tlink.x",
19+
20+
# if you run into problems with LLD switch to the GNU linker by commenting out
21+
# this line
22+
# "-C", "linker=arm-none-eabi-ld",
23+
24+
# if you need to link to pre-compiled C libraries provided by a C toolchain
25+
# use GCC as the linker by commenting out both lines above and then
26+
# uncommenting the three lines below
27+
# "-C", "linker=arm-none-eabi-gcc",
28+
# "-C", "link-arg=-Wl,-Tlink.x",
29+
# "-C", "link-arg=-nostartfiles",
30+
]
31+
32+
[build]
33+
# Pick ONE of these compilation targets
34+
target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
35+
# target = "thumbv7m-none-eabi" # Cortex-M3
36+
# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU)
37+
# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
38+
# target = "thumbv8m.base-none-eabi" # Cortex-M23
39+
# target = "thumbv8m.main-none-eabi" # Cortex-M33 (no FPU)
40+
# target = "thumbv8m.main-none-eabihf" # Cortex-M33 (with FPU)
41+
42+
# thumbv7m-none-eabi is not coming with core and alloc, compile myself
43+
[unstable]
44+
mtime-on-use = true
45+
build-std = ["core", "alloc"]

0 commit comments

Comments
 (0)