Skip to content
Snippets Groups Projects
Commit 6a2fde39 authored by Per's avatar Per
Browse files

loop, example

parent 11b07850
No related branches found
No related tags found
No related merge requests found
...@@ -40,5 +40,23 @@ ...@@ -40,5 +40,23 @@
], ],
"cwd": "${workspaceRoot}" "cwd": "${workspaceRoot}"
}, },
{
"type": "gdb",
"request": "attach",
"name": "loop",
"gdbpath": "/usr/bin/arm-none-eabi-gdb",
"executable": "./target/thumbv7em-none-eabihf/debug/examples/loop",
"target": ":3333",
"remote": true,
"autorun": [
"monitor reset init",
"monitor arm semihosting enable",
"monitor tpiu config internal /tmp/itm.log uart off 64000000",
"monitor itm port 0 on",
"load",
"monitor reset init"
],
"cwd": "${workspaceRoot}"
},
] ]
} }
\ No newline at end of file
...@@ -6,10 +6,7 @@ ...@@ -6,10 +6,7 @@
{ {
"type": "shell", "type": "shell",
"label": "xargo build", "label": "xargo build",
"command": "xargo", "command": "xargo build",
"args": [
"build"
],
"problemMatcher": [ "problemMatcher": [
"$rustc" "$rustc"
], ],
...@@ -21,10 +18,7 @@ ...@@ -21,10 +18,7 @@
{ {
"type": "shell", "type": "shell",
"label": "xargo build --release", "label": "xargo build --release",
"command": "xargo", "command": "xargo build --release",
"args": [
"build --release"
],
"problemMatcher": [ "problemMatcher": [
"$rustc" "$rustc"
], ],
...@@ -32,6 +26,18 @@ ...@@ -32,6 +26,18 @@
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
} }
},
{
"type": "shell",
"label": "xargo build --example loop",
"command": "xargo build --example loop ",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
} }
},
] ]
} }
\ No newline at end of file
//! Nesting claims and how the preemption threshold works
//!
//! If you run this program you'll hit the breakpoints as indicated by the
//! letters in the comments: A, then B, then C, etc.
#![deny(unsafe_code)]
#![feature(proc_macro)]
#![no_std]
extern crate cortex_m;
extern crate cortex_m_rtfm as rtfm;
extern crate stm32f40x;
#[macro_use]
extern crate cortex_m_debug;
use rtfm::app;
app! {
device: stm32f40x,
}
fn init(_p: init::Peripherals) {
let mut sum = 0;
for i in 0..10 {
ipln!("i = {}", i);
sum += i;
}
ipln!("Sum 0 .. 10 = {}", sum);
}
#[inline(never)]
fn idle() -> ! {
loop {
rtfm::wfi();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment