Skip to content

Commit 679ed27

Browse files
authored
Merge pull request #828 from rp-rs/move-examples-delete-workspace
Deletes the top-level workspace and moves the examples.
2 parents 103e4fa + fae6b25 commit 679ed27

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+633
-317
lines changed

.github/workflows/build_and_test.yml

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,51 @@ jobs:
55
name: Build rp2040-hal's features
66
runs-on: ubuntu-20.04
77
steps:
8-
- uses: actions/checkout@v3
8+
- uses: actions/checkout@v4
99
- uses: dtolnay/rust-toolchain@stable
1010
with:
1111
target: thumbv6m-none-eabi
1212
- name: Install cargo-hack
1313
run: |
1414
curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin
15-
- name: Build rp2040-hal's workspace (without the examples)
16-
run: cargo hack build --optional-deps --each-feature
17-
- run: cargo clean
18-
- name: Build rp2040-hal's workspace (with the examples)
19-
run: cargo hack build --examples --optional-deps --each-feature
15+
- name: Build rp2040-hal
16+
run: cd rp2040-hal && cargo hack build --optional-deps --each-feature --target=thumbv6m-none-eabi
17+
- name: Build rp2040-hal-macros
18+
run: cd rp2040-hal-macros && cargo hack build --optional-deps --each-feature
19+
- name: Build on-target-tests
20+
run: cd on-target-tests && cargo hack build --optional-deps --each-feature
21+
- name: Build rp2040-hal-examples
22+
run: cd rp2040-hal-examples && cargo hack build --optional-deps --each-feature
23+
- name: Build rp-binary-info
24+
run: cd rp-binary-info && cargo hack build --optional-deps --each-feature
2025
tests:
2126
name: Execute host-runable tests
2227
runs-on: ubuntu-20.04
2328
steps:
24-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
2530
- uses: dtolnay/rust-toolchain@stable
2631
with:
2732
target: thumbv6m-none-eabi
2833
- name: Install cargo-hack
2934
run: |
3035
curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin
31-
- name: Test
32-
run: cargo hack test -p rp2040-hal --target x86_64-unknown-linux-gnu --optional-deps --each-feature --tests --features critical-section-impl
33-
- name: Test docs
34-
run: cargo hack test -p rp2040-hal --target x86_64-unknown-linux-gnu --optional-deps --each-feature --doc --features critical-section-impl
35-
- name: Test macros
36-
run: cargo hack test -p rp2040-hal-macros --target x86_64-unknown-linux-gnu --optional-deps --tests --each-feature
37-
- name: Test macro docs
38-
run: cargo hack test -p rp2040-hal-macros --target x86_64-unknown-linux-gnu --optional-deps --doc --each-feature
39-
- name: Clean
40-
run: cargo clean
36+
- name: Test rp2040-hal
37+
run: cd rp2040-hal && cargo hack test --optional-deps --each-feature --tests --features critical-section-impl
38+
- name: Test rp2040-hal docs
39+
run: cd rp2040-hal && cargo hack test --optional-deps --each-feature --doc --features critical-section-impl
40+
- name: Test rp2040-hal-macros
41+
run: cd rp2040-hal-macros && cargo hack test --optional-deps --tests --each-feature
42+
- name: Test rp2040-hal-macros docs
43+
run: cd rp2040-hal-macros && cargo hack test --optional-deps --doc --each-feature
44+
- name: Test rp-binary-info
45+
run: cd rp-binary-info && cargo hack test --optional-deps --each-feature --tests
46+
- name: Test rp-binary-info docs
47+
run: cd rp-binary-info && cargo hack test --optional-deps --each-feature --doc
4148
udeps:
4249
name: Check rp2040-hal for unused dependencies
4350
runs-on: ubuntu-20.04
4451
steps:
45-
- uses: actions/checkout@v3
52+
- uses: actions/checkout@v4
4653
- uses: dtolnay/rust-toolchain@master
4754
with:
4855
toolchain: nightly-2024-01-30
@@ -53,13 +60,21 @@ jobs:
5360
- name: Install cargo-udeps
5461
run: |
5562
curl -sSL https://github.com/est31/cargo-udeps/releases/download/v0.1.45/cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - --strip-components=2 -C ~/.cargo/bin ./cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu/cargo-udeps
56-
- name: Check unused deps
57-
run: cargo hack udeps --optional-deps --each-feature
63+
- name: Check unused deps in rp2040-hal
64+
run: cd rp2040-hal && cargo hack udeps --optional-deps --each-feature --target=thumbv6m-none-eabi
65+
- name: Check unused deps in rp2040-hal-macros
66+
run: cd rp2040-hal-macros && cargo hack udeps --optional-deps --each-feature
67+
- name: Check unused deps in rp2040-hal-examples
68+
run: cd rp2040-hal-examples && cargo hack udeps --optional-deps --each-feature
69+
- name: Check unused deps in on-target-tests
70+
run: cd on-target-tests && cargo hack udeps --optional-deps --each-feature
71+
- name: Check unused deps in rp-binary-info
72+
run: cd rp-binary-info && cargo hack udeps --optional-deps --each-feature
5873
msrv:
5974
name: Verify build on MSRV
6075
runs-on: ubuntu-20.04
6176
steps:
62-
- uses: actions/checkout@v3
77+
- uses: actions/checkout@v4
6378
- uses: dtolnay/rust-toolchain@master
6479
with:
6580
toolchain: 1.77
@@ -68,6 +83,14 @@ jobs:
6883
run: |
6984
curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin
7085
- name: Use older version of regex
71-
run: cargo update -p regex --precise 1.9.3
72-
- name: Verify MSRV
73-
run: cargo hack build --examples --optional-deps --each-feature
86+
run: cd rp2040-hal-examples && cargo update -p regex --precise 1.9.3
87+
- name: Build rp2040-hal (on MSRV)
88+
run: cd rp2040-hal && cargo hack build --optional-deps --each-feature --target=thumbv6m-none-eabi
89+
- name: Build rp2040-hal-macros (on MSRV)
90+
run: cd rp2040-hal-macros && cargo hack build --optional-deps --each-feature
91+
- name: Build on-target-tests (on MSRV)
92+
run: cd on-target-tests && cargo hack build --optional-deps --each-feature
93+
- name: Build rp2040-hal-examples (on MSRV)
94+
run: cd rp2040-hal-examples && cargo hack build --optional-deps --each-feature
95+
- name: Build rp-binary-info (on MSRV)
96+
run: cd rp-binary-info && cargo hack build --optional-deps --each-feature

.github/workflows/clippy.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@ jobs:
77
env:
88
RUSTFLAGS: "-D warnings"
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111
- uses: dtolnay/rust-toolchain@stable
1212
with:
1313
target: thumbv6m-none-eabi
1414
components: clippy
15-
- run: cargo clippy --workspace --examples
16-
- run: cargo clippy --workspace --examples --all-features
15+
- name: Build rp2040-hal
16+
run: cd rp2040-hal && cargo clippy --target=thumbv6m-none-eabi
17+
- name: Build rp2040-hal (with all features)
18+
run: cd rp2040-hal && cargo clippy --target=thumbv6m-none-eabi --all-features
19+
- name: Build rp2040-hal-macros
20+
run: cd rp2040-hal-macros && cargo clippy
21+
- name: Build on-target-tests
22+
run: cd on-target-tests && cargo clippy
23+
- name: Build rp2040-hal-examples
24+
run: cd rp2040-hal-examples && cargo clippy
25+
- name: Build rp-binary-info
26+
run: cd rp-binary-info && cargo clippy

.github/workflows/rustfmt.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@ jobs:
77
env:
88
RUSTFLAGS: "-D warnings"
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111
- uses: dtolnay/rust-toolchain@stable
1212
with:
1313
target: thumbv6m-none-eabi
1414
components: rustfmt
15-
- run: cargo fmt -- --check
15+
- name: Check format of rp2040-hal
16+
run: cd rp2040-hal && cargo fmt -- --check
17+
- name: Check format of rp2040-hal-macros
18+
run: cd rp2040-hal-macros && cargo fmt -- --check
19+
- name: Check format of on-target-tests
20+
run: cd on-target-tests && cargo fmt -- --check
21+
- name: Check format of rp2040-hal-examples
22+
run: cd rp2040-hal-examples && cargo fmt -- --check
23+
- name: Check format of rp-binary-info
24+
run: cd rp-binary-info && cargo fmt -- --check

Cargo.toml

Lines changed: 0 additions & 23 deletions
This file was deleted.

format.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rem Formats all the files in the repo
2+
3+
cargo fmt --manifest-path rp2040-hal\Cargo.toml -- --check
4+
cargo fmt --manifest-path rp2040-hal-macros\Cargo.toml -- --check
5+
cargo fmt --manifest-path rp2040-hal-examples\Cargo.toml -- --check
6+
cargo fmt --manifest-path on-target-tests\Cargo.toml -- --check

format.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
# Formats all the files in the repo
4+
5+
cargo fmt --manifest-path rp2040-hal/Cargo.toml -- --check
6+
cargo fmt --manifest-path rp2040-hal-macros/Cargo.toml -- --check
7+
cargo fmt --manifest-path rp2040-hal-examples/Cargo.toml -- --check
8+
cargo fmt --manifest-path on-target-tests/Cargo.toml -- --check
File renamed without changes.

on-target-tests/Cargo.toml

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,78 @@
11
[package]
2+
authors = ["The rp-rs Developers"]
3+
description = "Test cases that run on an RP2040"
24
edition = "2021"
5+
license = "MIT OR Apache-2.0"
36
name = "on-target-tests"
4-
version = "0.1.0"
57
publish = false
8+
readme = "README.md"
9+
repository = "https://github.com/rp-rs/rp-hal"
10+
version = "0.1.0"
611

712
[[test]]
8-
name = "dma_m2m_u8"
913
harness = false
14+
name = "dma_m2m_u8"
1015

1116
[[test]]
12-
name = "dma_m2m_u16"
1317
harness = false
18+
name = "dma_m2m_u16"
1419

1520
[[test]]
16-
name = "dma_m2m_u32"
1721
harness = false
22+
name = "dma_m2m_u32"
1823

1924
[[test]]
20-
name = "dma_spi_loopback_u8"
2125
harness = false
26+
name = "dma_spi_loopback_u8"
2227

2328
[[test]]
24-
name = "dma_spi_loopback_u16"
2529
harness = false
30+
name = "dma_spi_loopback_u16"
2631

2732
[[test]]
28-
name = "dma_dyn"
2933
harness = false
34+
name = "dma_dyn"
3035

3136
[[test]]
32-
name = "i2c_loopback"
3337
harness = false
38+
name = "i2c_loopback"
3439

3540
[[test]]
36-
name = "i2c_loopback_async"
3741
harness = false
42+
name = "i2c_loopback_async"
3843

3944
[[test]]
40-
name = "gpio"
4145
harness = false
46+
name = "gpio"
4247

4348
[dependencies]
4449
cortex-m = "0.7"
4550
cortex-m-rt = "0.7"
46-
embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = [
47-
"unproven",
48-
] }
49-
embedded-hal = "1.0.0"
50-
embedded-hal-async = "1.0.0"
51-
51+
critical-section = "1.0.0"
5252
defmt = "0.3"
5353
defmt-rtt = "0.4"
5454
defmt-test = "0.3.1"
55-
panic-probe = { version = "0.3", features = ["print-defmt"] }
56-
57-
rp2040-hal = { path = "../rp2040-hal", features = [
58-
"critical-section-impl",
59-
"defmt",
60-
"rt",
61-
"i2c-write-iter",
62-
] }
63-
# Needed to set spi frequencies
55+
embedded-hal = "1.0.0"
56+
embedded-hal-async = "1.0.0"
57+
embedded_hal_0_2 = {package = "embedded-hal", version = "0.2.5", features = ["unproven"]}
6458
fugit = "0.3.6"
65-
59+
futures = {version = "0.3.30", default-features = false, features = ["async-await"]}
60+
heapless = {version = "0.8.0", features = ["portable-atomic-critical-section", "defmt-03"]}
61+
i2c-write-iter = {version = "1.0.0", features = ["async"]}
62+
itertools = {version = "0.12.0", default-features = false}
63+
nostd_async = {version = "0.6.1", features = ["wfe"]}
64+
panic-probe = {version = "0.3", features = ["print-defmt"]}
6665
rp2040-boot2 = "0.3.0"
67-
critical-section = "1.0.0"
68-
heapless = { version = "0.8.0", features = [
69-
"portable-atomic-critical-section",
70-
"defmt-03",
71-
] }
72-
# - `wfe`: we may want to signal between cores with sev
73-
# - `wfe` implies `cortex-m`
74-
nostd_async = { version = "0.6.1", features = ["wfe"] }
75-
futures = { version = "0.3.30", default-features = false, features = [
76-
"async-await",
77-
] }
78-
i2c-write-iter = { version = "1.0.0", features = ["async"] }
79-
itertools = { version = "0.12.0", default-features = false }
66+
rp2040-hal = {path = "../rp2040-hal", features = ["critical-section-impl", "defmt", "rt", "i2c-write-iter"]}
67+
68+
[profile.dev]
69+
codegen-units = 1
70+
incremental = false
71+
lto = 'fat'
72+
opt-level = 's'
73+
74+
[profile.test]
75+
codegen-units = 1
76+
incremental = false
77+
lto = 'fat'
78+
opt-level = 's'

on-target-tests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ Adding a test:
99
Running all tests:
1010
Linux (and any other Unix-likes where probe-rs are supported):
1111
```system
12+
cd on-target-tests
1213
./run_tests.sh
1314
```
1415
Windows
1516
```system
17+
cd on-target-tests
1618
run_tests.bat
1719
```
1820

run_tests.bat renamed to on-target-tests/run_tests.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
@SET "CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=probe-rs run"
55

6-
cargo test -p on-target-tests --no-fail-fast -- --chip rp2040
6+
cargo test --no-fail-fast -- --chip rp2040

0 commit comments

Comments
 (0)