Browse Source

firmware: compile for riscv32i

pull/1/head
parent
commit
fd05fa560f
  1. 24
      firmware/Cargo.lock
  2. 4
      firmware/Cargo.toml
  3. 10
      firmware/default.nix

24
firmware/Cargo.lock

@ -18,7 +18,7 @@ name = "helloworld"
version = "0.0.0"
dependencies = [
"panic-halt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"riscv-rt 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"riscv-rt 0.5.0 (git+https://github.com/m-labs/riscv-rt)",
]
[[package]]
@ -71,7 +71,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "riscv"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/m-labs/riscv#f735652b622981df8850959645a8be6945da9029"
dependencies = [
"bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -80,22 +80,22 @@ dependencies = [
[[package]]
name = "riscv-rt"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/m-labs/riscv-rt#e9ba6738a26f6e9e3b44b118dced942ad7b7e52c"
dependencies = [
"r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"riscv 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"riscv-rt-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"riscv 0.5.2 (git+https://github.com/m-labs/riscv)",
"riscv-rt-macros 0.1.5 (git+https://github.com/m-labs/riscv-rt)",
]
[[package]]
name = "riscv-rt-macros"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
source = "git+https://github.com/m-labs/riscv-rt#e9ba6738a26f6e9e3b44b118dced942ad7b7e52c"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -121,7 +121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "0.15.34"
version = "0.15.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
@ -144,11 +144,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"
"checksum riscv 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "00f3ec73803f144a6474819070dfcf0b0d1662e1bd8845956850ee8f8cfbc69b"
"checksum riscv-rt 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "af8c51c09a5445950a53431d3f8ca9d90ba4062cd86b5407c3e16d8c2558c17d"
"checksum riscv-rt-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e9ba967e1f2902cc37cc4722f7ef4dd5e08cec430c97586424d6f679eb51b695"
"checksum riscv 0.5.2 (git+https://github.com/m-labs/riscv)" = "<none>"
"checksum riscv-rt 0.5.0 (git+https://github.com/m-labs/riscv-rt)" = "<none>"
"checksum riscv-rt-macros 0.1.5 (git+https://github.com/m-labs/riscv-rt)" = "<none>"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe"
"checksum syn 0.15.35 (registry+https://github.com/rust-lang/crates.io-index)" = "641e117d55514d6d918490e47102f7e08d096fdde360247e4a10f7a91a8478d3"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"

4
firmware/Cargo.toml

@ -6,6 +6,10 @@ version = "0.0.0"
panic-halt = "0.2.0"
riscv-rt = "0.5.0"
[patch.crates-io]
riscv = { git = "https://github.com/m-labs/riscv" }
riscv-rt = { git = "https://github.com/m-labs/riscv-rt" }
[profile.release]
codegen-units = 1
incremental = false

10
firmware/default.nix

@ -1,16 +1,20 @@
{ rustPlatform, rust-riscv32i-crates, binutils-riscv32 }:
{ rustPlatform, rust-riscv32i-crates, binutils-riscv32, rustc, cargo }:
rustPlatform.buildRustPackage rec {
name = "helloworld";
version = "0.0.0";
src = ./.;
cargoSha256 = "1j8ipk7mwf6jqjnddpvkdydhgl7lfddxkv6p1vhzlfhqlf8am42j";
cargoSha256 = "0kf2pnfylfmzm0qvi4jfci43qvrnj1v5f037sb9zpvfqyddhdffl";
# HACK - rustc overlay does not update rustPlatform. Find out why.
configurePhase = ''echo XXX ${rustPlatform.rust.rustc} ${rustPlatform.rust.cargo}'';
buildPhase = ''
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
export RUSTFLAGS="-L ${rust-riscv32i-crates}/lib/rustlib/riscv32i-unknown-none-elf/lib -C linker=${binutils-riscv32}/bin/riscv32-unknown-elf-ld -C link-arg=-Tlink.x"
cargo build --release --target riscv32imc-unknown-none-elf
export RUSTC=${rustc}/bin/rustc
${cargo}/bin/cargo build --release --target riscv32i-unknown-none-elf
'';
doCheck = false;

Loading…
Cancel
Save