Skip to content

Commit 5bdaa8e

Browse files
bors[bot]James Munns
andcommitted
Merge #265
265: Consistent svd2rust output r=japaric a=jamesmunns NOTE: I believe there is still documentation that will need to be updated to represent this. I wanted to make sure my CI changes still work without the other changes (like Cargo.toml) after pulling these changes Co-authored-by: James Munns <[email protected]>
2 parents 56ad812 + f0d42a2 commit 5bdaa8e

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

ci/script.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,20 +430,30 @@ main() {
430430
# https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd
431431
)
432432

433-
target/$TARGET/release/svd2rust --target msp430 -i $td/msp430g2553.svd | \
434-
( rustfmt 2>/dev/null > $td/src/lib.rs || true )
433+
local cwd=$(pwd)
435434

436-
cargo check --manifest-path $td/Cargo.toml
435+
# Test MSP430
436+
pushd $td
437+
438+
$cwd/target/$TARGET/release/svd2rust --target msp430 -i $td/msp430g2553.svd
439+
mv $td/lib.rs $td/src/lib.rs
440+
rustfmt $td/src/lib.rs || true
437441

438-
target/$TARGET/release/svd2rust --target none -i $td/msp430g2553.svd | \
439-
( rustfmt 2>/dev/null > $td/src/lib.rs || true )
442+
popd
440443

441444
cargo check --manifest-path $td/Cargo.toml
442445

443-
# target/$TARGET/release/svd2rust --target riscv -i $td/e310x.svd | \
444-
# ( rustfmt 2>/dev/null > $td/src/lib.rs || true )
446+
# Test RISC-V
445447

446-
cargo check --manifest-path $td/Cargo.toml
448+
# pushd $td
449+
450+
# target/$TARGET/release/svd2rust --target riscv -i $td/e310x.svd
451+
# mv $td/lib.rs $td/src/lib.rs
452+
# rustfmt $td/src/lib.rs || true
453+
454+
# popd
455+
456+
# cargo check --manifest-path $td/Cargo.toml
447457
;;
448458

449459
Nordic)

src/main.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,11 @@ fn run() -> Result<()> {
103103
let mut device_x = String::new();
104104
let items = generate::device::render(&device, &target, nightly, &mut device_x)?;
105105

106+
writeln!(File::create("lib.rs").unwrap(), "{}", quote!(#(#items)*)).unwrap();
107+
106108
if target == Target::CortexM {
107-
writeln!(File::create("lib.rs").unwrap(), "{}", quote!(#(#items)*)).unwrap();
108109
writeln!(File::create("device.x").unwrap(), "{}", device_x).unwrap();
109110
writeln!(File::create("build.rs").unwrap(), "{}", build_rs()).unwrap();
110-
} else {
111-
println!(
112-
"{}",
113-
quote! {
114-
#(#items)*
115-
}
116-
);
117111
}
118112

119113
Ok(())

0 commit comments

Comments
 (0)