Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent svd2rust output #265

Merged
merged 2 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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