diff --git a/.settings/com.github.rustdt.ide.core.prefs b/.settings/com.github.rustdt.ide.core.prefs
index cee1592168a3e7edefc43f22c3b505ee6d4a84e4..7262c58d68587ad9f7a459787b85e7334f40d638 100644
--- a/.settings/com.github.rustdt.ide.core.prefs
+++ b/.settings/com.github.rustdt.ide.core.prefs
@@ -1,4 +1,4 @@
-build_targets=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<build_targets xmlns\="com.github.rustdt.ide.core">\n<target auto_enabled\="false" config\="build" n_enabled\="false" version2\="true">\n<command_invocation append_env\="true" command_arguments\=" xargo build --example bare0&\#10;">\n<env_vars/>\n</command_invocation>\n</target>\n<target auto_enabled\="false" config\="check" n_enabled\="false" version2\="true">\n<command_invocation append_env\="true" command_arguments\="xargo build --example bare0&\#10;">\n<env_vars/>\n</command_invocation>\n</target>\n<target auto_enabled\="false" config\="clean" n_enabled\="false" version2\="true"/>\n</build_targets>\n
+build_targets=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\n<build_targets xmlns\="com.github.rustdt.ide.core">\n<target auto_enabled\="false" config\="build" n_enabled\="false" version2\="true">\n<command_invocation append_env\="true" command_arguments\="xargo build --examples --message-format\=json">\n<env_vars/>\n</command_invocation>\n</target>\n<target auto_enabled\="false" config\="check" n_enabled\="false" version2\="true">\n<command_invocation append_env\="true" command_arguments\="xargo check --examples --message-format\=json&\#10;">\n<env_vars/>\n</command_invocation>\n</target>\n<target auto_enabled\="false" config\="clean" n_enabled\="false" version2\="true"/>\n</build_targets>\n
 eclipse.preferences.version=1
 format_onSave=true
 racer_path=/home/pln/.cargo/bin/racer
diff --git a/Cargo.toml b/Cargo.toml
index 4fa2c4fba6ca3a3a5ea9a235a6beb6957abb6600..587c1edbab6ee1d651df151c1ce389f28c318f27 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,10 +13,16 @@ version = "0.1.0"
 
 [dependencies]
 cortex-m-rtfm = "0.2.2"
-cortex-m = "0.3.1"
+#cortex-m = "0.3.1"
 rtfm-core = "0.1.0"
 cortex-m-semihosting = "0.2.0"
 
+[dependencies.cortex-m]
+version = "0.3.2"
+git = "https://gitlab.henriktjader.com/pln/cortex-m-fork.git"
+#path = "../cortex-m"
+branch = "itm"
+
 [dependencies.cortex-m-debug]
 version = "0.1.0"
 git = "https://gitlab.henriktjader.com/pln/cortex-m-debug.git"
diff --git a/Makefile b/Makefile
index f328ca86f08f4f3ce034cc9a0cffdd52ba334d66..519294bed3e3bac026e3b177b4418b340195c9e3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 
-TARGETS = bare0 bare1 bare2 bare3 bare4 bare5 bare6
+TARGETS = bare0 bare1 bare2 bare3 bare4 bare5 bare6 clk_out_itm
 DIR = target/thumbv7em-none-eabihf/debug/examples/
 ELFS = $(addprefix $(DIR), $(TARGETS))
 EELFS = $(addsuffix .elf, $(ELFS))
diff --git a/examples/bare0.rs b/examples/bare0.rs
index cb4eb7eadc39a26cc75357e30fa1e5bf688caa72..e562f8b0d05665e1a5e7441c7ba258c521e81c84 100644
--- a/examples/bare0.rs
+++ b/examples/bare0.rs
@@ -8,23 +8,43 @@
 
 // Minimal runtime / startup for Cortex-M microcontrollers
 extern crate cortex_m_rt;
+use core::cell::UnsafeCell;
 
 const X_INIT: u32 = 10;
 
-static mut X: u32 = X_INIT;
-static mut Y: u32 = 0;
+struct U32 {
+    data: UnsafeCell<u32>,
+}
+unsafe impl Sync for U32 {}
+
+static X: U32 = U32 {
+    data: UnsafeCell::new(X_INIT),
+};
+
+static Y: U32 = U32 {
+    data: UnsafeCell::new(0),
+};
+
+impl U32 {
+    fn read(&self) -> u32 {
+        unsafe { *self.data.get() }
+    }
+
+    fn write(&self, v: u32) {
+        unsafe { *self.data.get() = v }
+    }
+}
 
 #[inline(never)]
 fn main() {
-    let mut x = unsafe { X };
+    let mut x = X.read();
 
     loop {
         x += 1;
-        unsafe {
-            X += 1;
-            Y = X;
-            assert!(x == X && X == Y);
-        }
+
+        X.write(X.read() + 1);
+        Y.write(X.read());
+        assert!(x == X.read() && X.read() == Y.read());
     }
 }
 // 1. run the program in the debugger,
diff --git a/examples/bare2.rs b/examples/bare2.rs
index bf49b9243f1e1c2919b7068a0a8379e18ab2af22..bb417c3ee0e073d3366893310b28ecf30c68bb36 100644
--- a/examples/bare2.rs
+++ b/examples/bare2.rs
@@ -19,6 +19,7 @@ fn wait(i: u32) {
 
 fn main() {
     ipln!("Start");
+    // sprintln!("Start");
 
     // a "mutable" (changeable) variable
     let mut s = 0;