Skip to content

Commit

Permalink
Merge #265
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bors[bot] and James Munns committed Dec 6, 2018
2 parents 56ad812 + f0d42a2 commit 5bdaa8e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
26 changes: 18 additions & 8 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -430,20 +430,30 @@ main() {
# https://raw.githubusercontent.com/riscv-rust/e310x/master/e310x.svd
)

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

cargo check --manifest-path $td/Cargo.toml
# Test MSP430
pushd $td

$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

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

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

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

cargo check --manifest-path $td/Cargo.toml
# pushd $td

# 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
;;

Nordic)
Expand Down
10 changes: 2 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,11 @@ fn run() -> Result<()> {
let mut device_x = String::new();
let items = generate::device::render(&device, &target, nightly, &mut device_x)?;

writeln!(File::create("lib.rs").unwrap(), "{}", quote!(#(#items)*)).unwrap();

if target == Target::CortexM {
writeln!(File::create("lib.rs").unwrap(), "{}", quote!(#(#items)*)).unwrap();
writeln!(File::create("device.x").unwrap(), "{}", device_x).unwrap();
writeln!(File::create("build.rs").unwrap(), "{}", build_rs()).unwrap();
} else {
println!(
"{}",
quote! {
#(#items)*
}
);
}

Ok(())
Expand Down

0 comments on commit 5bdaa8e

Please sign in to comment.