aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/build.rs
diff options
context:
space:
mode:
authorGravatar Jorge Aparicio <jorge@japaric.io> 2017-06-28 22:59:18 -0500
committerGravatar Jorge Aparicio <jorge@japaric.io> 2017-06-30 13:14:18 -0500
commit9fb5a3cf66a5f9fadc2e41c2d54fea941f875168 (patch)
tree2c411de8eca6ad984a56c24ee9297abd9cd8da02 /cortex-m-rt/build.rs
parent37fe84a083a7906f163b4d47524431be9baae2e0 (diff)
downloadcortex-m-9fb5a3cf66a5f9fadc2e41c2d54fea941f875168.tar.gz
cortex-m-9fb5a3cf66a5f9fadc2e41c2d54fea941f875168.tar.zst
cortex-m-9fb5a3cf66a5f9fadc2e41c2d54fea941f875168.zip
enable the FPU before main if the target has an FPU
Diffstat (limited to 'cortex-m-rt/build.rs')
-rw-r--r--cortex-m-rt/build.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/cortex-m-rt/build.rs b/cortex-m-rt/build.rs
index c52b434..45642c5 100644
--- a/cortex-m-rt/build.rs
+++ b/cortex-m-rt/build.rs
@@ -1,3 +1,5 @@
+use std::env;
+
#[cfg(feature = "linker-script")]
mod imp {
use std::env;
@@ -6,6 +8,8 @@ mod imp {
use std::path::PathBuf;
pub fn main() {
+ ::has_fpu();
+
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("link.x"))
@@ -21,7 +25,17 @@ mod imp {
#[cfg(not(feature = "linker-script"))]
mod imp {
- pub fn main() {}
+ pub fn main() {
+ ::has_fpu();
+ }
+}
+
+fn has_fpu() {
+ let target = env::var("TARGET").unwrap();
+
+ if target.ends_with("eabihf") {
+ println!("cargo:rustc-cfg=has_fpu");
+ }
}
fn main() {