aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cortex-m-rt/ci/script.sh3
-rw-r--r--cortex-m-rt/examples/entry-static.rs20
2 files changed, 22 insertions, 1 deletions
diff --git a/cortex-m-rt/ci/script.sh b/cortex-m-rt/ci/script.sh
index 0a28641..ce1aec8 100644
--- a/cortex-m-rt/ci/script.sh
+++ b/cortex-m-rt/ci/script.sh
@@ -13,8 +13,9 @@ main() {
local examples=(
alignment
- minimal
+ entry-static
main
+ minimal
override-exception
pre_init
state
diff --git a/cortex-m-rt/examples/entry-static.rs b/cortex-m-rt/examples/entry-static.rs
new file mode 100644
index 0000000..1b2e118
--- /dev/null
+++ b/cortex-m-rt/examples/entry-static.rs
@@ -0,0 +1,20 @@
+//! `static mut` variables local to the entry point are safe to use
+
+#![deny(unsafe_code)]
+#![deny(warnings)]
+#![no_main]
+#![no_std]
+
+extern crate cortex_m_rt as rt;
+extern crate panic_semihosting;
+
+use rt::entry;
+
+#[entry]
+fn main() -> ! {
+ static mut COUNT: u32 = 0;
+
+ loop {
+ *COUNT += 1;
+ }
+}