Skip to content
Snippets Groups Projects
Commit 7037ac0d authored by Per's avatar Per
Browse files

itm

parent 4fe5f837
No related branches found
No related tags found
No related merge requests found
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
......
......@@ -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"
......
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))
......
......@@ -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,
......
......@@ -19,6 +19,7 @@ fn wait(i: u32) {
fn main() {
ipln!("Start");
// sprintln!("Start");
// a "mutable" (changeable) variable
let mut s = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment