Commit 189bc88b authored by Astro's avatar Astro
Browse files

build an empty rust firmware

parent b88d3120
nix:
stage: build
image: nixos/nix:latest
script:
- nix-build
......@@ -2,4 +2,6 @@
members = [
"max32665",
"card10",
"watchapp",
]
[package]
edition = "2018"
name = "card10"
version = "0.0.0"
authors = ["Astro <astro@spaceboyz.net>"]
[dependencies]
max32665 = { path = "../max32665", features = ["rt"] }
cortex-m-rt = { version = "0.6", features = ["device"] }
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=memory.x");
println!("cargo:rerun-if-changed=build.rs");
}
MEMORY {
SPIX (rx) : ORIGIN = 0x08000000, LENGTH = 128M
FLASH (rx) : ORIGIN = 0x10010000, LENGTH = 960k
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 512k
SPID (r) : ORIGIN = 0x80000000, LENGTH = 512M
}
#![no_std]
pub use max32665;
pub use cortex_m_rt as _;
pub use cortex_m_rt::entry;
......@@ -14,12 +14,12 @@ let
name = "rust-card10";
version = "0.0.0";
src = ./.;
cargoSha256 = "0wnv4bv34d30dxkx82z3fll7n28q3dkwygyfl07ajj3bh40r2xwf";
cargoSha256 = "1jwg5x14g9m100yq7m21klmxgmd2gcsggpmcnxwa8vavmkf9gmrn";
preBuild = "export CARGO_HOME=$(mktemp -d cargo-home.XXX)";
doCheck = false;
installPhase = ''
mkdir -p $out/lib
#cp target/thumbv7em-none-eabihf/release/adc2tcp $out/lib/
cp target/thumbv7em-none-eabihf/release/watchapp $out/lib/
'';
};
in {
......
use std :: env ; use std :: fs :: File ; use std :: io :: Write ; use std :: path :: PathBuf ; fn main ( ) { if env :: var_os ( "CARGO_FEATURE_RT" ) . is_some ( ) { let out = & PathBuf :: from ( env :: var_os ( "OUT_DIR" ) . unwrap ( ) ) ; File :: create ( out . join ( "device.x" ) ) . unwrap ( ) . write_all ( include_bytes ! ( "device.x" ) ) . unwrap ( ) ; println ! ( "cargo:rustc-link-search={}" , out . display ( ) ) ; println ! ( "cargo:rerun-if-changed=device.x" ) ; } println ! ( "cargo:rerun-if-changed=build.rs" ) ; }
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
if env::var_os("CARGO_FEATURE_RT").is_some() {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("device.x"))
.unwrap()
.write_all(include_bytes!("device.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=device.x");
}
println!("cargo:rerun-if-changed=build.rs");
}
[package]
edition = "2018"
name = "watchapp"
version = "0.0.0"
authors = ["Astro <astro@spaceboyz.net>"]
[dependencies]
card10 = { path = "../card10" }
panic-abort = "0.3.1"
[profile.release]
codegen-units = 1
incremental = false
debug = true
opt-level = "s"
lto = true
#![no_std]
#![no_main]
use panic_abort as _;
use card10::*;
#[entry]
fn main() -> ! {
panic!("TODO");
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment