Skip to content
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
42 changes: 14 additions & 28 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,9 @@ jobs:
clippy:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }} / clippy
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]
target: [thumbv8m.main-none-eabihf]
steps:
Expand All @@ -72,26 +68,14 @@ jobs:
- name: rustup target add ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: cargo clippy (libs)
uses: giraffate/clippy-action@v1
with:
reporter: "github-pr-check"
clippy_flags: -- -F clippy::suspicious -D clippy::correctness -F clippy::perf -F clippy::style
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: "./libs"
run: cargo clippy --locked --features mimxrt685s -- -F clippy::suspicious -D clippy::correctness -F clippy::perf -F clippy::style
working-directory: "./libs"
Comment thread
jerrysxie marked this conversation as resolved.
- name: cargo clippy (examples)
uses: giraffate/clippy-action@v1
with:
reporter: "github-pr-check"
clippy_flags: -- -F clippy::suspicious -D clippy::correctness -F clippy::perf -F clippy::style
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: "./examples/rt685s"
run: cargo clippy --locked -- -F clippy::suspicious -D clippy::correctness -F clippy::perf -F clippy::style
working-directory: "./examples/rt685s"
- name: cargo clippy (bootloader-tool)
uses: giraffate/clippy-action@v1
with:
reporter: "github-pr-check"
clippy_flags: -- -D clippy::suspicious -D clippy::correctness -D clippy::perf -D clippy::style
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: "./bootloader-tool"
run: cargo clippy --locked -- -D clippy::suspicious -D clippy::correctness -D clippy::perf -D clippy::style
working-directory: "./bootloader-tool"

# Enable once we have a released crate
# semver:
Expand Down Expand Up @@ -131,12 +115,12 @@ jobs:
- name: rustup target add ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: cargo doc (libs)
run: cargo doc --no-deps --features mimxrt685s
run: cargo doc --locked --no-deps --features mimxrt685s
working-directory: "./libs"
env:
RUSTDOCFLAGS: --cfg docsrs
- name: cargo doc (examples)
run: cargo doc --no-deps
run: cargo doc --locked --no-deps
working-directory: "./examples/rt685s"
env:
RUSTDOCFLAGS: --cfg docsrs
Expand Down Expand Up @@ -197,12 +181,14 @@ jobs:
log-level: warn
manifest-path: ./libs/Cargo.toml
command: check
arguments: --locked
- name: Cargo deny (examples)
uses: EmbarkStudios/cargo-deny-action@v2
with:
log-level: warn
manifest-path: ./examples/rt685s/Cargo.toml
command: check
arguments: --locked

msrv:
# check that we can build using the minimal rust version that is specified by this crate
Expand All @@ -212,7 +198,7 @@ jobs:
strategy:
fail-fast: false
matrix:
msrv: ["1.90"] # We are depending on embassy-imxrt.
msrv: ["1.93"] # fixed 1.31.0 requires 1.93 or later
target: [thumbv8m.main-none-eabihf]
name: ubuntu / MSRV ${{ matrix.msrv }}
steps:
Expand All @@ -231,13 +217,13 @@ jobs:
- name: rustup target add ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: cargo +${{ matrix.msrv }} check (libs)
run: cargo check --features mimxrt685s
run: cargo check --locked --features mimxrt685s
working-directory: "./libs"
- name: cargo +${{ matrix.msrv }} check (examples)
run: cargo check
run: cargo check --locked
working-directory: "./examples/rt685s"
- name: cargo +${{ matrix.msrv }} check (bootloader-tool)
run: cargo check
run: cargo check --locked
working-directory: "./bootloader-tool"

fuzz:
Expand Down
2 changes: 1 addition & 1 deletion bootloader-tool/src/commands/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub async fn process(config: &Config, command: DownloadCommands) -> anyhow::Resu
download_prelude(&prelude_path, &probe_args).await?;
}
Other(args) => {
process_other(config, args).await?;
process_other(config, *args).await?;
}
};
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion bootloader-tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,5 @@ pub enum DownloadCommands {
},

#[command(flatten)]
Other(RunCommands),
Other(Box<RunCommands>),
}
2 changes: 1 addition & 1 deletion bootloader-tool/src/processors/otp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct HmacKey(pub [u8; 16]);

pub fn generate(config: &Config) -> anyhow::Result<Otp> {
if std::fs::exists(&config.otp_path)? {
log::warn!("OTP file {} already generated, skipping...", &config.otp_path.display());
log::warn!("OTP file {} already generated, skipping...", config.otp_path.display());
return get_otp(config);
}

Expand Down
16 changes: 11 additions & 5 deletions bootloader-tool/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ use itertools::Itertools;

pub fn parse_hex(s: &str) -> anyhow::Result<Vec<u8>> {
s.as_bytes()
.chunks_exact(2)
.as_chunks::<2>()
.0
.iter()
.map(|chunk| u8::from_str_radix(std::str::from_utf8(chunk).unwrap(), 16))
.try_collect::<_, Vec<_>, _>()
.context("Input not hexidecimal")
Expand All @@ -18,13 +20,17 @@ pub fn generate_hex(buf: &[u8]) -> String {
}

pub fn bytes_to_u32_le(b: &[u8]) -> Vec<u32> {
b.chunks_exact(4)
.map(|chunk| u32::from_le_bytes(chunk.try_into().unwrap()))
b.as_chunks::<4>()
.0
.iter()
.map(|chunk| u32::from_le_bytes(*chunk))
.collect::<Vec<u32>>()
}

pub fn bytes_to_u32_be(b: &[u8]) -> Vec<u32> {
b.chunks_exact(4)
.map(|chunk| u32::from_be_bytes(chunk.try_into().unwrap()))
b.as_chunks::<4>()
.0
.iter()
.map(|chunk| u32::from_be_bytes(*chunk))
.collect::<Vec<u32>>()
}
1 change: 0 additions & 1 deletion examples/rt685s/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Cargo.lock
/target
Comment thread
jerrysxie marked this conversation as resolved.
/target_ci
Loading
Loading