From 63607e5533ddf2194cb0756673303d49ee19b175 Mon Sep 17 00:00:00 2001 From: Jennifer Wilcox Date: Sat, 17 Apr 2021 14:09:54 -0500 Subject: [PATCH 1/8] Add CI checks --- .github/workflows/check.yml | 15 +++++ .gitignore | 1 + Cargo.lock | 118 ++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 .github/workflows/check.yml create mode 100644 Cargo.lock diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..c097d2b --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,15 @@ +on: push +name: CI Checks +jobs: + check: + name: Check and Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: thumbv6m-none-eabi + - run: "cargo check" + - run: "cargo fmt -- --check" + - run: "cargo clippy -- -Dwarnings" diff --git a/.gitignore b/.gitignore index 9f11b75..2f5a8f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea/ +target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..b70fbd7 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,118 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "cortex-m" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643a210c1bdc23d0db511e2a576082f4ff4dcae9d0c37f50b431b8f8439d6d6b" +dependencies = [ + "bare-metal", + "bitfield", + "embedded-hal", + "volatile-register", +] + +[[package]] +name = "embedded-hal" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa998ce59ec9765d15216393af37a58961ddcefb14c753b4816ba2191d865fcb" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.0.0", +] + +[[package]] +name = "nb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" + +[[package]] +name = "rp2040-hal" +version = "0.1.0" +dependencies = [ + "cortex-m", + "embedded-hal", + "nb 1.0.0", + "rp2040-pac", +] + +[[package]] +name = "rp2040-pac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8ce571c4f868bea60de3bf03be22bb92bbb63b6678b8062c6fe7de0b6071963" +dependencies = [ + "cortex-m", + "vcell", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "volatile-register" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286" +dependencies = [ + "vcell", +] From d318d050673b1b2113fe11935e8ca82ac99229d7 Mon Sep 17 00:00:00 2001 From: Jennifer Wilcox Date: Sat, 17 Apr 2021 14:11:47 -0500 Subject: [PATCH 2/8] Run `cargo fmt` --- rp2040-hal/src/rom_data.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rp2040-hal/src/rom_data.rs b/rp2040-hal/src/rom_data.rs index cbf99ef..e55ccb3 100644 --- a/rp2040-hal/src/rom_data.rs +++ b/rp2040-hal/src/rom_data.rs @@ -21,7 +21,10 @@ fn rom_table_lookup(table: *const u16, tag: RomFnTableCode) -> T { unsafe { let rom_table_lookup_ptr: *const u32 = rom_hword_as_ptr(ROM_TABLE_LOOKUP_PTR); let rom_table_lookup: RomTableLookupFn = core::mem::transmute(rom_table_lookup_ptr); - rom_table_lookup(rom_hword_as_ptr(table) as *const u16, u16::from_le_bytes(tag) as u32) + rom_table_lookup( + rom_hword_as_ptr(table) as *const u16, + u16::from_le_bytes(tag) as u32, + ) } } @@ -342,7 +345,7 @@ double_funcs! { 0x40 dsin(angle: f64) -> f64; /// Return the tangent of angle. angle is in radians, and must be in the range -1024 to 1024 0x44 dtan(angle: f64) -> f64; - /// Return the exponential value of v, i.e. so + /// Return the exponential value of v, i.e. so 0x4c dexp(v: f64) -> f64; /// Return the natural logarithm of v. If v <= 0 return -Infinity 0x50 dln(v: f64) -> f64; @@ -371,7 +374,7 @@ double_funcs! { /// Convert a double to a signed fixed point 64-bit integer representation where n specifies the /// position of the binary point in the resulting fixed point representation - e.g. _double2fix(0.5f, /// 16) == 0x8000. This method rounds towards -Infinity, and clamps the resulting integer to lie - /// within the range -0x8000000000000000 to 0x7FFFFFFFFFFFFFFF + /// within the range -0x8000000000000000 to 0x7FFFFFFFFFFFFFFF 0x70 double_to_fix64(v: f64, n: i32) -> i64; /// Convert a double to an unsigned 64-bit integer, rounding towards -Infinity, and clamping the /// result to lie within the range 0x0000000000000000 to 0xFFFFFFFFFFFFFFFF From 778a87dfaaa176857d169924336d0d5147a4a824 Mon Sep 17 00:00:00 2001 From: Jennifer Wilcox Date: Sat, 17 Apr 2021 14:21:55 -0500 Subject: [PATCH 3/8] Also run the checks on PRs I forgot you have to add that event explicitly. --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c097d2b..100bfc8 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,4 +1,4 @@ -on: push +on: [push, pull_request] name: CI Checks jobs: check: From 3c528c6a93b754f211f7d7d3c818b97240bdeb89 Mon Sep 17 00:00:00 2001 From: Jennifer Wilcox Date: Sat, 24 Apr 2021 14:35:23 -0500 Subject: [PATCH 4/8] Remove Cargo.lock --- .gitignore | 1 + Cargo.lock | 118 ----------------------------------------------------- 2 files changed, 1 insertion(+), 118 deletions(-) delete mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 2f5a8f4..781f1c6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ target +Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index b70fbd7..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,118 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "bare-metal" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" -dependencies = [ - "rustc_version", -] - -[[package]] -name = "bitfield" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" - -[[package]] -name = "cortex-m" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643a210c1bdc23d0db511e2a576082f4ff4dcae9d0c37f50b431b8f8439d6d6b" -dependencies = [ - "bare-metal", - "bitfield", - "embedded-hal", - "volatile-register", -] - -[[package]] -name = "embedded-hal" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa998ce59ec9765d15216393af37a58961ddcefb14c753b4816ba2191d865fcb" -dependencies = [ - "nb 0.1.3", - "void", -] - -[[package]] -name = "nb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" -dependencies = [ - "nb 1.0.0", -] - -[[package]] -name = "nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" - -[[package]] -name = "rp2040-hal" -version = "0.1.0" -dependencies = [ - "cortex-m", - "embedded-hal", - "nb 1.0.0", - "rp2040-pac", -] - -[[package]] -name = "rp2040-pac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8ce571c4f868bea60de3bf03be22bb92bbb63b6678b8062c6fe7de0b6071963" -dependencies = [ - "cortex-m", - "vcell", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "vcell" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "volatile-register" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286" -dependencies = [ - "vcell", -] From 5dfa550663788399d5c1be1235f326e2a4c89abe Mon Sep 17 00:00:00 2001 From: Jennifer Wilcox Date: Sat, 24 Apr 2021 14:36:39 -0500 Subject: [PATCH 5/8] Pass --all to cargo check This will be useful once we have examples, which I'm working on in another PR. --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 100bfc8..cbda6da 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,6 +10,6 @@ jobs: with: toolchain: stable target: thumbv6m-none-eabi - - run: "cargo check" + - run: "cargo check --all" - run: "cargo fmt -- --check" - run: "cargo clippy -- -Dwarnings" From cc1a1bee2cc0d5dd978004b81988bf6355527823 Mon Sep 17 00:00:00 2001 From: Jennifer Wilcox Date: Sat, 24 Apr 2021 18:46:07 -0500 Subject: [PATCH 6/8] Also build all examples My other PR has some examples. It turns out `cargo check --all` doesn't actually check _all_ buildable things :( --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cbda6da..cd42d94 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,6 +10,6 @@ jobs: with: toolchain: stable target: thumbv6m-none-eabi - - run: "cargo check --all" + - run: "cargo check --all --examples" - run: "cargo fmt -- --check" - run: "cargo clippy -- -Dwarnings" From cb51448089620fa69c4333a634bc2f331ff5ea41 Mon Sep 17 00:00:00 2001 From: Jennifer Wilcox Date: Sat, 24 Apr 2021 20:17:42 -0500 Subject: [PATCH 7/8] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Émile Grégoire --- .github/workflows/check.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cd42d94..4a96375 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -5,11 +5,23 @@ jobs: name: Check and Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: toolchain: stable target: thumbv6m-none-eabi - - run: "cargo check --all --examples" - - run: "cargo fmt -- --check" - - run: "cargo clippy -- -Dwarnings" + override: true + profile: minimal + components: rustfmt, clippy + - uses: actions-rs/cargo@v1 + with: + command: check + args: --workspace + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check + - uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -Dwarnings From e9721e14c252f3f7adb9abb8969bffb48a938fa1 Mon Sep 17 00:00:00 2001 From: Jennifer Wilcox Date: Sun, 25 Apr 2021 12:24:47 -0500 Subject: [PATCH 8/8] Pin ubuntu version --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4a96375..3319f39 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -3,7 +3,7 @@ name: CI Checks jobs: check: name: Check and Lint - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1