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 f8fb72b7..60b1195d 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. @@ -409,68 +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 - - ( - 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 - - cargo check --manifest-path $td/Cargo.toml - ;; - Nordic) echo '[dependencies.bare-metal]' >> $td/Cargo.toml echo 'version = "0.2.0"' >> $td/Cargo.toml @@ -533,6 +486,34 @@ 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 + test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/fu540-pac/master/fu540.svd + ;; + SiliconLabs) echo '[dependencies.bare-metal]' >> $td/Cargo.toml echo 'version = "0.2.0"' >> $td/Cargo.toml