Skip to content

Commit

Permalink
Add minimal support for MIMXRT633S
Browse files Browse the repository at this point in the history
With these changes, we have a chance of running embassy-imxrt on
MIMXRT633S.
  • Loading branch information
Felipe Balbi committed Feb 3, 2025
1 parent 6f6a61e commit b9c67c1
Show file tree
Hide file tree
Showing 12 changed files with 932 additions and 414 deletions.
97 changes: 87 additions & 10 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,29 @@
# - msrv: check that the msrv specified in the crate is correct
permissions:
contents: read

# This configuration allows maintainers of this repo to create a branch and pull request based on
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
# built once.
on:

push:
branches: [main]
pull_request:

# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

name: check
jobs:

jobs:
commit_list:
runs-on: ubuntu-latest
steps:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down Expand Up @@ -55,20 +59,24 @@ jobs:
runs-on: ubuntu-latest
name: nightly / fmt
needs: commit_list

strategy:
fail-fast: false
matrix:
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}
workdir: [ ".", "examples/rt685s-evk"]

steps:
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ matrix.commit }}

- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt

- name: cargo fmt --check
run: cargo fmt --check
working-directory: ${{ matrix.workdir }}
Expand All @@ -77,31 +85,36 @@ jobs:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }} / clippy (${{ matrix.commit }})
needs: commit_list

permissions:
contents: read
checks: write

strategy:
fail-fast: false
matrix:
# Get early warning of new lints which are regularly introduced in beta channels.
toolchain: [stable, beta]
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}
workdir: [ ".", "examples/rt685s-evk"]

steps:
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ matrix.commit }}

- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy

- name: cargo clippy
uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-check'
clippy_flags: -- -F clippy::suspicious -F clippy::correctness -F clippy::perf -F clippy::style
reporter: 'github-pr-review'
clippy_flags: -- -Dwarnings -F clippy::suspicious -F clippy::correctness -F clippy::perf -F clippy::style
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: ${{ matrix.workdir }}

Expand Down Expand Up @@ -133,19 +146,25 @@ jobs:
runs-on: ubuntu-latest
name: nightly / doc
needs: commit_list

strategy:
fail-fast: false
matrix:
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}

steps:
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ matrix.commit }}

- name: Install nightly
uses: dtolnay/rust-toolchain@nightly

- name: cargo doc
run: cargo doc --no-deps --all-features
run: |
cargo doc --no-deps -F mimxrt685s,rt,defmt,time,time-driver,unstable-pac
cargo doc --no-deps -F mimxrt633s,rt,defmt,time,time-driver,unstable-pac
env:
RUSTDOCFLAGS: --cfg docsrs

Expand All @@ -155,41 +174,96 @@ jobs:
runs-on: ubuntu-latest
name: ubuntu / stable / features
needs: commit_list

strategy:
fail-fast: false
matrix:
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}
feature: [ "mimxrt633s", "mimxrt633s,rt", "mimxrt633s,defmt",
"mimxrt633s,time", "mimxrt633s,time-driver",
"mimxrt633s,unstable-pac", "mimxrt633s,rt,defmt",
"mimxrt633s,rt,time", "mimxrt633s,rt,time-driver",
"mimxrt633s,rt,unstable-pac", "mimxrt633s,defmt,time",
"mimxrt633s,defmt,time-driver", "mimxrt633s,defmt,unstable-pac",
"mimxrt633s,time,time-driver", "mimxrt633s,time,unstable-pac",
"mimxrt633s,time-driver,unstable-pac",
"mimxrt633s,rt,defmt,time", "mimxrt633s,rt,defmt,time-driver",
"mimxrt633s,rt,defmt,unstable-pac",
"mimxrt633s,rt,time,time-driver",
"mimxrt633s,rt,time,unstable-pac",
"mimxrt633s,rt,time-driver,unstable-pac",
"mimxrt633s,defmt,time,time-driver",
"mimxrt633s,defmt,time,unstable-pac",
"mimxrt633s,defmt,time-driver,unstable-pac",
"mimxrt633s,time,time-driver,unstable-pac",
"mimxrt633s,rt,defmt,time,time-driver",
"mimxrt633s,rt,defmt,time,unstable-pac",
"mimxrt633s,rt,defmt,time-driver,unstable-pac",
"mimxrt633s,rt,time,time-driver,unstable-pac",
"mimxrt633s,defmt,time,time-driver,unstable-pac",
"mimxrt633s,rt,defmt,time,time-driver,unstable-pac",
"mimxrt685s", "mimxrt685s,rt", "mimxrt685s,defmt",
"mimxrt685s,time", "mimxrt685s,time-driver",
"mimxrt685s,unstable-pac", "mimxrt685s,rt,defmt",
"mimxrt685s,rt,time", "mimxrt685s,rt,time-driver",
"mimxrt685s,rt,unstable-pac", "mimxrt685s,defmt,time",
"mimxrt685s,defmt,time-driver", "mimxrt685s,defmt,unstable-pac",
"mimxrt685s,time,time-driver", "mimxrt685s,time,unstable-pac",
"mimxrt685s,time-driver,unstable-pac",
"mimxrt685s,rt,defmt,time", "mimxrt685s,rt,defmt,time-driver",
"mimxrt685s,rt,defmt,unstable-pac",
"mimxrt685s,rt,time,time-driver",
"mimxrt685s,rt,time,unstable-pac",
"mimxrt685s,rt,time-driver,unstable-pac",
"mimxrt685s,defmt,time,time-driver",
"mimxrt685s,defmt,time,unstable-pac",
"mimxrt685s,defmt,time-driver,unstable-pac",
"mimxrt685s,time,time-driver,unstable-pac",
"mimxrt685s,rt,defmt,time,time-driver",
"mimxrt685s,rt,defmt,time,unstable-pac",
"mimxrt685s,rt,defmt,time-driver,unstable-pac",
"mimxrt685s,rt,time,time-driver,unstable-pac",
"mimxrt685s,defmt,time,time-driver,unstable-pac",
"mimxrt685s,rt,defmt,time,time-driver,unstable-pac" ]

steps:
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ matrix.commit }}

- name: Install stable
uses: dtolnay/rust-toolchain@stable

- name: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack

# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
# --feature-powerset runs for every combination of features
- name: cargo hack
run: cargo hack --feature-powerset check
- name: cargo manual hack
run: cargo check -F ${{ matrix.feature }}

deny:
# cargo-deny checks licenses, advisories, sources, and bans for
# our dependencies.
runs-on: ubuntu-latest
name: ubuntu / stable / deny
needs: commit_list

strategy:
fail-fast: false
matrix:
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}

steps:
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ matrix.commit }}

- name: Install stable
uses: dtolnay/rust-toolchain@stable

- name: cargo install cargo-deny
uses: EmbarkStudios/cargo-deny-action@v2
with:
Expand All @@ -208,7 +282,6 @@ jobs:
fail-fast: false
matrix:
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}
workdir: [ ".", "examples/rt685s-evk"]
msrv: ["1.83"] # We're relying on namespaced-features, which
# was released in 1.60
#
Expand All @@ -222,16 +295,20 @@ jobs:
# collapse_debuginfo
#
# embassy upstream switched to rust 1.83

name: ubuntu / ${{ matrix.msrv }} (${{ matrix.commit }})
steps:
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ matrix.commit }}

- name: Install ${{ matrix.msrv }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.msrv }}

- name: cargo +${{ matrix.msrv }} check
run: cargo check
working-directory: ${{ matrix.workdir }}
run: |
cargo check -F mimxrt685s,rt,defmt,time,time-driver,unstable-pac
cargo check -F mimxrt633s,rt,defmt,time,time-driver,unstable-pac
16 changes: 15 additions & 1 deletion .github/workflows/nostd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,42 @@
# information about how the concurrency cancellation and workflow triggering works
permissions:
contents: read

on:
push:
branches: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

name: no-std

jobs:
nostd:
runs-on: ubuntu-latest
name: ${{ matrix.target }}

strategy:
matrix:
target: [thumbv8m.main-none-eabihf]

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Install stable
uses: dtolnay/rust-toolchain@stable

- name: rustup target add ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}

- name: Show variable
run: echo ${{ env.TOKEN }}

- name: cargo check
run: cargo check --target ${{ matrix.target }} --no-default-features
run: |
cargo check --target ${{ matrix.target }} --no-default-features -F mimxrt685s
cargo check --target ${{ matrix.target }} --no-default-features -F mimxrt633s
40 changes: 30 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ flavors = [{ name = "imxrt685s", target = "thumbv8m.main-none-eabihf" }]
features = ["defmt", "unstable-pac", "time-driver"]

[features]
default = ["rt"]
## Enable the rt feature of [`rp-pac`](https://docs.rs/crates/rp-pac). This brings in the [`cortex-m-rt`](https://docs.rs/cortex-m-rt) crate, which adds startup code and minimal runtime initialization.
rt = ["mimxrt685s-pac/rt"]
default = ["mimxrt685s", "rt"]

## Enable [defmt support](https://docs.rs/defmt) and enables `defmt` debug-log messages and formatting in embassy drivers.
## Enable the rt feature of
## [`rp-pac`](https://docs.rs/crates/rp-pac). This brings in the
## [`cortex-m-rt`](https://docs.rs/cortex-m-rt) crate, which adds
## startup code and minimal runtime initialization.
rt = [
"mimxrt685s-pac?/rt",
"mimxrt633s-pac?/rt",
]

## Enable [defmt support](https://docs.rs/defmt) and enables `defmt`
## debug-log messages and formatting in embassy drivers.
defmt = ["dep:defmt", "mimxrt685s-pac/defmt"]
## Enable features requiring `embassy-time`
time = ["dep:embassy-time"]
Expand All @@ -34,6 +42,20 @@ time-driver = [
"dep:embassy-time-queue-utils",
]

#! ### Chip selection features
## MIMXRT685S
mimxrt685s = ["mimxrt685s-pac", "_mimxrt685s"]
mimxrt633s = ["mimxrt633s-pac", "_mimxrt633s"]

## Reexport the PAC for the currently enabled chip at `embassy_imxrt::pac` (unstable)
unstable-pac = []

# Features starting with `_` are for internal use only. They're not intended
# to be enabled by other crates, and are not covered by semver guarantees.

_mimxrt685s = []
_mimxrt633s = []

[dependencies]
embassy-sync = { git = "https://github.com/embassy-rs/embassy" }
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy", optional = true }
Expand All @@ -59,12 +81,6 @@ embedded-storage-async = { version = "0.4.1" }
rand_core = "0.6.4"
fixed = "1.23.1"

mimxrt685s-pac = { version = "0.2.2", features = [
"rt",
"critical-section",
"defmt",
] }

embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = [
"unproven",
] }
Expand All @@ -75,6 +91,10 @@ embedded-hal-nb = { version = "1.0" }
document-features = "0.2.7"
paste = "1.0"

# PACs
mimxrt685s-pac = { version = "0.2.2", optional = true, features = ["rt", "critical-section", "defmt"] }
mimxrt633s-pac = { version = "0.2.0", optional = true, features = ["rt", "critical-section", "defmt"] }

[dev-dependencies]
embassy-executor = { git = "https://github.com/embassy-rs/embassy" }
static_cell = { version = "2" }
2 changes: 2 additions & 0 deletions examples/rt685s-evk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ embassy-imxrt = { version = "0.1.0", path = "../../", features = [
"defmt",
"time-driver",
"time",
"mimxrt685s",
"unstable-pac",
] }

embassy-sync = { git = "https://github.com/embassy-rs/embassy", features = [
Expand Down
Loading

0 comments on commit b9c67c1

Please sign in to comment.