@@ -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.
@@ -409,68 +424,6 @@ main() {
409
424
test_svd ht32f275x
410
425
;;
411
426
412
- # test other targets (architectures)
413
- OTHER)
414
- echo ' [dependencies.bare-metal]' >> $td /Cargo.toml
415
- echo ' version = "0.1.0"' >> $td /Cargo.toml
416
-
417
- echo ' [dependencies.msp430]' >> $td /Cargo.toml
418
- echo ' version = "0.1.0"' >> $td /Cargo.toml
419
-
420
- echo ' [dependencies.riscv]' >> $td /Cargo.toml
421
- echo ' version = "0.5.0"' >> $td /Cargo.toml
422
-
423
- echo ' [dependencies.riscv-rt]' >> $td /Cargo.toml
424
- echo ' version = "0.6.0"' >> $td /Cargo.toml
425
-
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
- # 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
470
-
471
- cargo check --manifest-path $td /Cargo.toml
472
- ;;
473
-
474
427
Nordic)
475
428
echo ' [dependencies.bare-metal]' >> $td /Cargo.toml
476
429
echo ' version = "0.2.0"' >> $td /Cargo.toml
@@ -533,6 +486,34 @@ main() {
533
486
# test_svd LPC5410x_v0.4
534
487
;;
535
488
489
+ # test other targets (architectures)
490
+ OTHER)
491
+ echo ' [dependencies.bare-metal]' >> $td /Cargo.toml
492
+ echo ' version = "0.1.0"' >> $td /Cargo.toml
493
+
494
+ echo ' [dependencies.msp430]' >> $td /Cargo.toml
495
+ echo ' version = "0.1.0"' >> $td /Cargo.toml
496
+
497
+ # Test MSP430
498
+ test_svd_for_target msp430 https://github.com/pftbest/msp430g2553/raw/v0.1.0/msp430g2553.svd
499
+ ;;
500
+
501
+ # Community-provided RISC-V SVDs
502
+ RISC-V)
503
+ echo ' [dependencies.bare-metal]' >> $td /Cargo.toml
504
+ echo ' version = "0.2.0"' >> $td /Cargo.toml
505
+
506
+ echo ' [dependencies.riscv]' >> $td /Cargo.toml
507
+ echo ' version = "0.5.0"' >> $td /Cargo.toml
508
+
509
+ echo ' [dependencies.riscv-rt]' >> $td /Cargo.toml
510
+ echo ' version = "0.6.0"' >> $td /Cargo.toml
511
+
512
+ test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd
513
+ test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/k210-pac/master/k210.svd
514
+ test_svd_for_target riscv https://raw.githubusercontent.com/riscv-rust/fu540-pac/master/fu540.svd
515
+ ;;
516
+
536
517
SiliconLabs)
537
518
echo ' [dependencies.bare-metal]' >> $td /Cargo.toml
538
519
echo ' version = "0.2.0"' >> $td /Cargo.toml
0 commit comments