From d779d7e2fdc53c7c529491d240e1b2e5cf751f71 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Wed, 31 Jul 2019 12:06:28 +0300 Subject: [PATCH 1/3] Simplify build script for non-cortex-m targets --- ci/script.sh | 63 ++++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 44 deletions(-) diff --git a/ci/script.sh b/ci/script.sh index f8fb72b7..9e505abf 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -19,6 +19,21 @@ test_svd() { cargo check --manifest-path $td/Cargo.toml } +test_svd_for_target() { + curl -L --output $td/input.svd $2 + + # NOTE we care about errors in svd2rust, but not about errors / warnings in rustfmt + local cwd=$(pwd) + pushd $td + RUST_BACKTRACE=1 $cwd/target/$TARGET/release/svd2rust --target $1 -i input.svd + + mv lib.rs src/lib.rs + + popd + + cargo check --manifest-path $td/Cargo.toml +} + main() { # Ensure that `cargo test` works to avoid surprising people, though it # doesn't help with our actual coverage. @@ -423,52 +438,12 @@ main() { echo '[dependencies.riscv-rt]' >> $td/Cargo.toml echo 'version = "0.6.0"' >> $td/Cargo.toml - ( - cd $td && - curl -LO \ - https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd - cd $td && - curl -LO \ - https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd - cd $td && - curl -LO \ - https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd - ) - - local cwd=$(pwd) - # Test MSP430 - pushd $td - - RUST_BACKTRACE=1 $cwd/target/$TARGET/release/svd2rust --target msp430 -i $td/msp430g2553.svd - mv $td/lib.rs $td/src/lib.rs - rustfmt $td/src/lib.rs || true - - popd - - cargo check --manifest-path $td/Cargo.toml - - # Test RISC-V FE310 - pushd $td - - RUST_BACKTRACE=1 $cwd/target/$TARGET/release/svd2rust --target riscv -i $td/e310x.svd - mv $td/lib.rs $td/src/lib.rs - rustfmt $td/src/lib.rs || true - - popd - - cargo check --manifest-path $td/Cargo.toml - - # Test RISC-V K210 - pushd $td - - RUST_BACKTRACE=1 $cwd/target/$TARGET/release/svd2rust --target riscv -i $td/k210.svd - mv $td/lib.rs $td/src/lib.rs - rustfmt $td/src/lib.rs || true - - popd + test_svd_for_target msp430 https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd - cargo check --manifest-path $td/Cargo.toml + # Test RISC-V chips + test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd + test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd ;; Nordic) From c69c8816bc9cf01322266b1ab760c41bb3c19f05 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Wed, 31 Jul 2019 12:18:30 +0300 Subject: [PATCH 2/3] Separate RISC-V targets from OTHER --- .travis.yml | 2 ++ ci/script.sh | 49 +++++++++++++++++++++++++++---------------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index ad0491c9..b922372c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ matrix: - env: TARGET=x86_64-unknown-linux-gnu VENDOR=NXP + - env: TARGET=x86_64-unknown-linux-gnu VENDOR=RISC-V + - env: TARGET=x86_64-unknown-linux-gnu VENDOR=SiliconLabs - env: TARGET=x86_64-unknown-linux-gnu VENDOR=Spansion diff --git a/ci/script.sh b/ci/script.sh index 9e505abf..8ba5cee5 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -424,28 +424,6 @@ main() { test_svd ht32f275x ;; - # test other targets (architectures) - OTHER) - echo '[dependencies.bare-metal]' >> $td/Cargo.toml - echo 'version = "0.1.0"' >> $td/Cargo.toml - - echo '[dependencies.msp430]' >> $td/Cargo.toml - echo 'version = "0.1.0"' >> $td/Cargo.toml - - echo '[dependencies.riscv]' >> $td/Cargo.toml - echo 'version = "0.5.0"' >> $td/Cargo.toml - - echo '[dependencies.riscv-rt]' >> $td/Cargo.toml - echo 'version = "0.6.0"' >> $td/Cargo.toml - - # Test MSP430 - test_svd_for_target msp430 https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd - - # Test RISC-V chips - test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd - test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd - ;; - Nordic) echo '[dependencies.bare-metal]' >> $td/Cargo.toml echo 'version = "0.2.0"' >> $td/Cargo.toml @@ -508,6 +486,33 @@ main() { # test_svd LPC5410x_v0.4 ;; + # test other targets (architectures) + OTHER) + echo '[dependencies.bare-metal]' >> $td/Cargo.toml + echo 'version = "0.1.0"' >> $td/Cargo.toml + + echo '[dependencies.msp430]' >> $td/Cargo.toml + echo 'version = "0.1.0"' >> $td/Cargo.toml + + # Test MSP430 + test_svd_for_target msp430 https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd + ;; + + # Community-provided RISC-V SVDs + RISC-V) + echo '[dependencies.bare-metal]' >> $td/Cargo.toml + echo 'version = "0.2.0"' >> $td/Cargo.toml + + echo '[dependencies.riscv]' >> $td/Cargo.toml + echo 'version = "0.5.0"' >> $td/Cargo.toml + + echo '[dependencies.riscv-rt]' >> $td/Cargo.toml + echo 'version = "0.6.0"' >> $td/Cargo.toml + + test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd + test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd + ;; + SiliconLabs) echo '[dependencies.bare-metal]' >> $td/Cargo.toml echo 'version = "0.2.0"' >> $td/Cargo.toml From 8a419975bfcfa43c94bef520eca9aa54d1d29065 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Wed, 31 Jul 2019 12:20:40 +0300 Subject: [PATCH 3/3] Add SVD for FU540 --- ci/script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/script.sh b/ci/script.sh index 8ba5cee5..60b1195d 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -511,6 +511,7 @@ main() { test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd + test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/fu540-pac/master/fu540.svd ;; SiliconLabs)