Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deletes the top-level workspace and moves the examples. #828

Merged
merged 3 commits into from
Aug 17, 2024
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
71 changes: 47 additions & 24 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,51 @@ jobs:
name: Build rp2040-hal's features
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
- name: Install cargo-hack
run: |
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
- name: Build rp2040-hal's workspace (without the examples)
run: cargo hack build --optional-deps --each-feature
- run: cargo clean
- name: Build rp2040-hal's workspace (with the examples)
run: cargo hack build --examples --optional-deps --each-feature
- name: Build rp2040-hal
run: cd rp2040-hal && cargo hack build --optional-deps --each-feature --target=thumbv6m-none-eabi
- name: Build rp2040-hal-macros
run: cd rp2040-hal-macros && cargo hack build --optional-deps --each-feature
- name: Build on-target-tests
run: cd on-target-tests && cargo hack build --optional-deps --each-feature
- name: Build rp2040-hal-examples
run: cd rp2040-hal-examples && cargo hack build --optional-deps --each-feature
- name: Build rp-binary-info
run: cd rp-binary-info && cargo hack build --optional-deps --each-feature
tests:
name: Execute host-runable tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
- name: Install cargo-hack
run: |
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
- name: Test
run: cargo hack test -p rp2040-hal --target x86_64-unknown-linux-gnu --optional-deps --each-feature --tests --features critical-section-impl
- name: Test docs
run: cargo hack test -p rp2040-hal --target x86_64-unknown-linux-gnu --optional-deps --each-feature --doc --features critical-section-impl
- name: Test macros
run: cargo hack test -p rp2040-hal-macros --target x86_64-unknown-linux-gnu --optional-deps --tests --each-feature
- name: Test macro docs
run: cargo hack test -p rp2040-hal-macros --target x86_64-unknown-linux-gnu --optional-deps --doc --each-feature
- name: Clean
run: cargo clean
- name: Test rp2040-hal
run: cd rp2040-hal && cargo hack test --optional-deps --each-feature --tests --features critical-section-impl
- name: Test rp2040-hal docs
run: cd rp2040-hal && cargo hack test --optional-deps --each-feature --doc --features critical-section-impl
- name: Test rp2040-hal-macros
run: cd rp2040-hal-macros && cargo hack test --optional-deps --tests --each-feature
- name: Test rp2040-hal-macros docs
run: cd rp2040-hal-macros && cargo hack test --optional-deps --doc --each-feature
- name: Test rp-binary-info
run: cd rp-binary-info && cargo hack test --optional-deps --each-feature --tests
- name: Test rp-binary-info docs
run: cd rp-binary-info && cargo hack test --optional-deps --each-feature --doc
udeps:
name: Check rp2040-hal for unused dependencies
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-01-30
Expand All @@ -53,13 +60,21 @@ jobs:
- name: Install cargo-udeps
run: |
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
- name: Check unused deps
run: cargo hack udeps --optional-deps --each-feature
- name: Check unused deps in rp2040-hal
run: cd rp2040-hal && cargo hack udeps --optional-deps --each-feature --target=thumbv6m-none-eabi
- name: Check unused deps in rp2040-hal-macros
run: cd rp2040-hal-macros && cargo hack udeps --optional-deps --each-feature
- name: Check unused deps in rp2040-hal-examples
run: cd rp2040-hal-examples && cargo hack udeps --optional-deps --each-feature
- name: Check unused deps in on-target-tests
run: cd on-target-tests && cargo hack udeps --optional-deps --each-feature
- name: Check unused deps in rp-binary-info
run: cd rp-binary-info && cargo hack udeps --optional-deps --each-feature
msrv:
name: Verify build on MSRV
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.77
Expand All @@ -68,6 +83,14 @@ jobs:
run: |
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
- name: Use older version of regex
run: cargo update -p regex --precise 1.9.3
- name: Verify MSRV
run: cargo hack build --examples --optional-deps --each-feature
run: cd rp2040-hal-examples && cargo update -p regex --precise 1.9.3
- name: Build rp2040-hal (on MSRV)
run: cd rp2040-hal && cargo hack build --optional-deps --each-feature --target=thumbv6m-none-eabi
- name: Build rp2040-hal-macros (on MSRV)
run: cd rp2040-hal-macros && cargo hack build --optional-deps --each-feature
- name: Build on-target-tests (on MSRV)
run: cd on-target-tests && cargo hack build --optional-deps --each-feature
- name: Build rp2040-hal-examples (on MSRV)
run: cd rp2040-hal-examples && cargo hack build --optional-deps --each-feature
- name: Build rp-binary-info (on MSRV)
run: cd rp-binary-info && cargo hack build --optional-deps --each-feature
16 changes: 13 additions & 3 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,20 @@ jobs:
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
components: clippy
- run: cargo clippy --workspace --examples
- run: cargo clippy --workspace --examples --all-features
- name: Build rp2040-hal
run: cd rp2040-hal && cargo clippy --target=thumbv6m-none-eabi
- name: Build rp2040-hal (with all features)
run: cd rp2040-hal && cargo clippy --target=thumbv6m-none-eabi --all-features
- name: Build rp2040-hal-macros
run: cd rp2040-hal-macros && cargo clippy
- name: Build on-target-tests
run: cd on-target-tests && cargo clippy
- name: Build rp2040-hal-examples
run: cd rp2040-hal-examples && cargo clippy
- name: Build rp-binary-info
run: cd rp-binary-info && cargo clippy
13 changes: 11 additions & 2 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ jobs:
env:
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv6m-none-eabi
components: rustfmt
- run: cargo fmt -- --check
- name: Check format of rp2040-hal
run: cd rp2040-hal && cargo fmt -- --check
- name: Check format of rp2040-hal-macros
run: cd rp2040-hal-macros && cargo fmt -- --check
- name: Check format of on-target-tests
run: cd on-target-tests && cargo fmt -- --check
- name: Check format of rp2040-hal-examples
run: cd rp2040-hal-examples && cargo fmt -- --check
- name: Check format of rp-binary-info
run: cd rp-binary-info && cargo fmt -- --check
23 changes: 0 additions & 23 deletions Cargo.toml

This file was deleted.

6 changes: 6 additions & 0 deletions format.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rem Formats all the files in the repo

cargo fmt --manifest-path rp2040-hal\Cargo.toml -- --check
cargo fmt --manifest-path rp2040-hal-macros\Cargo.toml -- --check
cargo fmt --manifest-path rp2040-hal-examples\Cargo.toml -- --check
cargo fmt --manifest-path on-target-tests\Cargo.toml -- --check
8 changes: 8 additions & 0 deletions format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

# Formats all the files in the repo

cargo fmt --manifest-path rp2040-hal/Cargo.toml -- --check
cargo fmt --manifest-path rp2040-hal-macros/Cargo.toml -- --check
cargo fmt --manifest-path rp2040-hal-examples/Cargo.toml -- --check
cargo fmt --manifest-path on-target-tests/Cargo.toml -- --check
File renamed without changes.
77 changes: 38 additions & 39 deletions on-target-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,79 +1,78 @@
[package]
authors = ["The rp-rs Developers"]
description = "Test cases that run on an RP2040"
edition = "2021"
license = "MIT OR Apache-2.0"
name = "on-target-tests"
version = "0.1.0"
publish = false
readme = "README.md"
repository = "https://github.com/rp-rs/rp-hal"
version = "0.1.0"

[[test]]
name = "dma_m2m_u8"
harness = false
name = "dma_m2m_u8"

[[test]]
name = "dma_m2m_u16"
harness = false
name = "dma_m2m_u16"

[[test]]
name = "dma_m2m_u32"
harness = false
name = "dma_m2m_u32"

[[test]]
name = "dma_spi_loopback_u8"
harness = false
name = "dma_spi_loopback_u8"

[[test]]
name = "dma_spi_loopback_u16"
harness = false
name = "dma_spi_loopback_u16"

[[test]]
name = "dma_dyn"
harness = false
name = "dma_dyn"

[[test]]
name = "i2c_loopback"
harness = false
name = "i2c_loopback"

[[test]]
name = "i2c_loopback_async"
harness = false
name = "i2c_loopback_async"

[[test]]
name = "gpio"
harness = false
name = "gpio"

[dependencies]
cortex-m = "0.7"
cortex-m-rt = "0.7"
embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = [
"unproven",
] }
embedded-hal = "1.0.0"
embedded-hal-async = "1.0.0"

critical-section = "1.0.0"
defmt = "0.3"
defmt-rtt = "0.4"
defmt-test = "0.3.1"
panic-probe = { version = "0.3", features = ["print-defmt"] }

rp2040-hal = { path = "../rp2040-hal", features = [
"critical-section-impl",
"defmt",
"rt",
"i2c-write-iter",
] }
# Needed to set spi frequencies
embedded-hal = "1.0.0"
embedded-hal-async = "1.0.0"
embedded_hal_0_2 = {package = "embedded-hal", version = "0.2.5", features = ["unproven"]}
fugit = "0.3.6"

futures = {version = "0.3.30", default-features = false, features = ["async-await"]}
heapless = {version = "0.8.0", features = ["portable-atomic-critical-section", "defmt-03"]}
i2c-write-iter = {version = "1.0.0", features = ["async"]}
itertools = {version = "0.12.0", default-features = false}
nostd_async = {version = "0.6.1", features = ["wfe"]}
panic-probe = {version = "0.3", features = ["print-defmt"]}
rp2040-boot2 = "0.3.0"
critical-section = "1.0.0"
heapless = { version = "0.8.0", features = [
"portable-atomic-critical-section",
"defmt-03",
] }
# - `wfe`: we may want to signal between cores with sev
# - `wfe` implies `cortex-m`
nostd_async = { version = "0.6.1", features = ["wfe"] }
futures = { version = "0.3.30", default-features = false, features = [
"async-await",
] }
i2c-write-iter = { version = "1.0.0", features = ["async"] }
itertools = { version = "0.12.0", default-features = false }
rp2040-hal = {path = "../rp2040-hal", features = ["critical-section-impl", "defmt", "rt", "i2c-write-iter"]}

[profile.dev]
codegen-units = 1
incremental = false
lto = 'fat'
opt-level = 's'

[profile.test]
codegen-units = 1
incremental = false
lto = 'fat'
opt-level = 's'
2 changes: 2 additions & 0 deletions on-target-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ Adding a test:
Running all tests:
Linux (and any other Unix-likes where probe-rs are supported):
```system
cd on-target-tests
./run_tests.sh
```
Windows
```system
cd on-target-tests
run_tests.bat
```

Expand Down
2 changes: 1 addition & 1 deletion run_tests.bat → on-target-tests/run_tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

@SET "CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=probe-rs run"

cargo test -p on-target-tests --no-fail-fast -- --chip rp2040
cargo test --no-fail-fast -- --chip rp2040
2 changes: 1 addition & 1 deletion run_tests.sh → on-target-tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Keep running tests even if one of them fails
# We need to specify probe-rs as our runner via environment variables here
# to control build since we aren't able to override them in config.toml
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-rs run" cargo test -p on-target-tests --no-fail-fast -- --chip rp2040
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-rs run" cargo test --no-fail-fast -- --chip rp2040
37 changes: 37 additions & 0 deletions rp2040-hal-examples/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Cargo Configuration for the https://github.com/rp-rs/rp-hal.git repository.
#
# You might want to make a similar file in your own repository if you are
# writing programs for Raspberry Silicon microcontrollers.
#

[build]
# Set the default target to match the Cortex-M0+ in the RP2040
target = "thumbv6m-none-eabi"

# Target specific options
[target.thumbv6m-none-eabi]
# Pass some extra options to rustc, some of which get passed on to the linker.
#
# * linker argument --nmagic turns off page alignment of sections (which saves
# flash space)
# * linker argument -Tlink.x tells the linker to use link.x as the linker
# script. This is usually provided by the cortex-m-rt crate, and by default
# the version in that crate will include a file called `memory.x` which
# describes the particular memory layout for your specific chip.
# * no-vectorize-loops turns off the loop vectorizer (seeing as the M0+ doesn't
# have SIMD)
rustflags = [
"-C", "link-arg=--nmagic",
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=-Tdefmt.x",
"-C", "no-vectorize-loops",
]

# This runner will make a UF2 file and then copy it to a mounted RP2040 in USB
# Bootloader mode:
runner = "elf2uf2-rs -d"

# This runner will find a supported SWD debug probe and flash your RP2040 over
# SWD:
# runner = "probe-rs run --chip RP2040"
Loading