diff options
Diffstat (limited to 'cortex-m-rt/examples/entry-static.rs')
-rw-r--r-- | cortex-m-rt/examples/entry-static.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cortex-m-rt/examples/entry-static.rs b/cortex-m-rt/examples/entry-static.rs new file mode 100644 index 0000000..55e7a89 --- /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_halt; + +use rt::entry; + +#[entry] +fn main() -> ! { + static mut COUNT: u32 = 0; + + loop { + *COUNT += 1; + } +} |