@@ -19,6 +19,21 @@ test_svd() {
19
19
cargo check --manifest-path $td /Cargo.toml
20
20
}
21
21
22
+ test_svd_for_target () {
23
+ curl -L --output $td /input.svd $2
24
+
25
+ # NOTE we care about errors in svd2rust, but not about errors / warnings in rustfmt
26
+ local cwd=$( pwd)
27
+ pushd $td
28
+ RUST_BACKTRACE=1 $cwd /target/$TARGET /release/svd2rust --target $1 -i input.svd
29
+
30
+ mv lib.rs src/lib.rs
31
+
32
+ popd
33
+
34
+ cargo check --manifest-path $td /Cargo.toml
35
+ }
36
+
22
37
main () {
23
38
# Ensure that `cargo test` works to avoid surprising people, though it
24
39
# doesn't help with our actual coverage.
@@ -423,52 +438,12 @@ main() {
423
438
echo ' [dependencies.riscv-rt]' >> $td /Cargo.toml
424
439
echo ' version = "0.6.0"' >> $td /Cargo.toml
425
440
426
- (
427
- cd $td &&
428
- curl -LO \
429
- https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd
430
- cd $td &&
431
- curl -LO \
432
- https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd
433
- cd $td &&
434
- curl -LO \
435
- https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd
436
- )
437
-
438
- local cwd=$( pwd)
439
-
440
441
# Test MSP430
441
- pushd $td
442
-
443
- RUST_BACKTRACE=1 $cwd /target/$TARGET /release/svd2rust --target msp430 -i $td /msp430g2553.svd
444
- mv $td /lib.rs $td /src/lib.rs
445
- rustfmt $td /src/lib.rs || true
446
-
447
- popd
448
-
449
- cargo check --manifest-path $td /Cargo.toml
450
-
451
- # Test RISC-V FE310
452
- pushd $td
453
-
454
- RUST_BACKTRACE=1 $cwd /target/$TARGET /release/svd2rust --target riscv -i $td /e310x.svd
455
- mv $td /lib.rs $td /src/lib.rs
456
- rustfmt $td /src/lib.rs || true
457
-
458
- popd
459
-
460
- cargo check --manifest-path $td /Cargo.toml
461
-
462
- # Test RISC-V K210
463
- pushd $td
464
-
465
- RUST_BACKTRACE=1 $cwd /target/$TARGET /release/svd2rust --target riscv -i $td /k210.svd
466
- mv $td /lib.rs $td /src/lib.rs
467
- rustfmt $td /src/lib.rs || true
468
-
469
- popd
442
+ test_svd_for_target msp430 https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd
470
443
471
- cargo check --manifest-path $td /Cargo.toml
444
+ # Test RISC-V chips
445
+ test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd
446
+ test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd
472
447
;;
473
448
474
449
Nordic)
0 commit comments