Skip to content
Snippets Groups Projects
Commit e94a25d7 authored by Per Lindgren's avatar Per Lindgren
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
[target.thumbv6m-none-eabi]
runner = 'arm-none-eabi-gdb'
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=true",
"-Z", "linker-flavor=ld",
]
[target.thumbv7m-none-eabi]
runner = 'arm-none-eabi-gdb'
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=arm-none-eabi-ld",
"-Z", "linker-flavor=ld",
]
[target.thumbv7em-none-eabi]
runner = 'arm-none-eabi-gdb'
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=arm-none-eabi-ld",
"-Z", "linker-flavor=ld",
]
[target.thumbv7em-none-eabihf]
runner = 'arm-none-eabi-gdb'
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=arm-none-eabi-ld",
"-Z", "linker-flavor=ld",
]
[build]
target = "thumbv7em-none-eabihf"
\ No newline at end of file
/target/
**/*.rs.bk
Cargo.lock
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"taskName": "xargo build",
"command": "xargo",
"args": [
"build"
],
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
\ No newline at end of file
[package]
name = "cortex-m-debug"
version = "0.1.0"
authors = ["Per Lindgren <per.lindgren@ltu.se>"]
[dependencies]
#cortex-m = "0.3.1"
\ No newline at end of file
# `cortex-m-debug`
> Interleaving ITM print support
+ simple to use, just `ipln!(...)`
+ no need to `borrow/get` the ITM
+ no need to pass ITM around to tasks in `cortex-m-rtfm`
+ non intrusive with respect to scheduling (no `claim` needed using `cortex-m-rtfm`)
+/- ITM output will be interleaved on preemption.
# Usage
``` rust
#[macro_use]
extern crate cortex_m_debug;
...
ipln!();
ipln!("Hello nasty");
ipln!("{} cups of coffee ...", 50);
...
```
Will render the output
```
Hello nasty
50 cups of coffee ...
```
and you know its on.
# License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
[dependencies.core]
stage = 0
[dependencies.compiler_builtins]
stage = 1
\ No newline at end of file
#![no_std]
/// Macro for sending a formatted string through an ITM channel 0,
/// Interleaved with other output to ITM channel 0
#[macro_export]
macro_rules! ip {
($s:expr) => {
#[allow(unsafe_code)]
cortex_m::itm::write_str(
unsafe { &(&*cortex_m::peripheral::ITM.get()).stim[0] },
$s
);
};
($($arg:tt)*) => {
#[allow(unsafe_code)]
cortex_m::itm::write_fmt(
unsafe { &(&*cortex_m::peripheral::ITM.get()).stim[0] },
format_args!($($arg)*
));
}
}
/// Macro for sending a formatted string through an ITM channel 0, with a newline.
/// Interleaved with other output to ITM channel 0
#[macro_export]
macro_rules! ipln {
() => {
ip!("\n");
};
($fmt:expr) => {
ip!(concat!($fmt, "\n"));
};
($fmt:expr, $($arg:tt)*) => {
ip!(concat!($fmt, "\n"), $($arg)*);
};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment