Skip to content

Instantly share code, notes, and snippets.

@jamesmunns
Created January 13, 2019 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmunns/aa348f57496ba23593dafb4fd695a7be to your computer and use it in GitHub Desktop.
Save jamesmunns/aa348f57496ba23593dafb4fd695a7be to your computer and use it in GitHub Desktop.
diff --git a/build.rs b/build.rs
index 73d61f7..d7dfb04 100644
--- a/build.rs
+++ b/build.rs
@@ -45,6 +45,7 @@ handlers.");
Build::new().file("exceptions.s").compile("asm");
println!("cargo:rustc-link-search={}", out.display());
+ println!("cargo:rustc-link-lib=static=asm");
println!("cargo:rerun-if-changed=exceptions.s");
println!("cargo:rerun-if-changed=xmc.x.in");
diff --git a/examples/blinky.rs b/examples/blinky.rs
index 0498bd6..7561afb 100644
--- a/examples/blinky.rs
+++ b/examples/blinky.rs
@@ -19,9 +19,17 @@ fn main() -> ! {
/* (Re-)configure PA1 as output */
let mut led = port1.p1_1.into_push_pull_output();
+ extern "C" {
+ static SVC_Veneer: u32;
+ }
+
+ let x = unsafe { SVC_Veneer };
+
+ let x = 100;
+
loop {
/* Turn PA1 on a million times in a row */
- for _ in 0..1_000_000 {
+ for _ in 0..x {
led.set_high();
}
/* Then turn PA1 off a million times in a row */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment