Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cortex-m-debug
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Per Lindgren
cortex-m-debug
Commits
3208194d
Commit
3208194d
authored
7 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
ip, ipln, sp, spln
parent
3ef41518
Branches
master
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+16
-12
16 additions, 12 deletions
src/lib.rs
with
16 additions
and
12 deletions
src/lib.rs
+
16
−
12
View file @
3208194d
...
@@ -6,8 +6,9 @@
...
@@ -6,8 +6,9 @@
macro_rules!
ip
{
macro_rules!
ip
{
(
$s:expr
)
=>
{
(
$s:expr
)
=>
{
{
{
let
p
=
cortex_m
::
Peripherals
::
take
()
.unwrap
();
extern
crate
cortex_m
;
let
mut
itm
=
p
.ITM
;
#[allow(unsafe_code)]
let
itm
=
unsafe
{
&
mut
*
cortex_m
::
peripheral
::
ITM
::
ptr
()
};
cortex_m
::
itm
::
write_str
(
cortex_m
::
itm
::
write_str
(
&
mut
itm
.stim
[
0
],
&
mut
itm
.stim
[
0
],
...
@@ -19,8 +20,10 @@ macro_rules! ip {
...
@@ -19,8 +20,10 @@ macro_rules! ip {
{
{
extern
crate
cortex_m
;
extern
crate
cortex_m
;
#[allow(unsafe_code)]
#[allow(unsafe_code)]
let
itm
=
unsafe
{
&
mut
*
cortex_m
::
peripheral
::
ITM
::
ptr
()
};
cortex_m
::
itm
::
write_fmt
(
cortex_m
::
itm
::
write_fmt
(
unsafe
{
&
mut
itm
.stim
[
0
]
}
,
&
mut
itm
.stim
[
0
],
format_args!
(
$
(
$arg
)
*
)
format_args!
(
$
(
$arg
)
*
)
);
);
}
}
...
@@ -42,26 +45,27 @@ macro_rules! ipln {
...
@@ -42,26 +45,27 @@ macro_rules! ipln {
};
};
}
}
/// Macro for sending a formatted string over semihosting
, with a newline
.
/// Macro for sending a formatted string over semihosting.
#[macro_export]
#[macro_export]
macro_rules!
sp
rintln
{
macro_rules!
sp
{
(
$
(
$e:tt
)
*
)
=>
{
(
$
(
$e:tt
)
*
)
=>
{
{
{
extern
crate
cortex_m_semihosting
;
extern
crate
cortex_m_semihosting
;
use
core
::
fmt
::
Write
;
use
core
::
fmt
::
Write
;
write
ln
!
(
cortex_m_semihosting
::
hio
::
hstdout
()
.unwrap
(),
$
(
$e
)
*
)
.unwrap
();
write!
(
cortex_m_semihosting
::
hio
::
hstdout
()
.unwrap
(),
$
(
$e
)
*
)
.unwrap
();
}
}
}
}
}
}
/// Macro for sending a formatted string over semihosting.
/// Macro for sending a formatted string over semihosting
, with a newline
.
#[macro_export]
#[macro_export]
macro_rules!
sp
rint
{
macro_rules!
sp
ln
{
(
$
(
$e:tt
)
*
)
=>
{
(
$
(
$e:tt
)
*
)
=>
{
{
{
extern
crate
cortex_m_semihosting
;
extern
crate
cortex_m_semihosting
;
use
core
::
fmt
::
Write
;
use
core
::
fmt
::
Write
;
write!
(
cortex_m_semihosting
::
hio
::
hstdout
()
.unwrap
(),
$
(
$e
)
*
)
.unwrap
();
write
ln
!
(
cortex_m_semihosting
::
hio
::
hstdout
()
.unwrap
(),
$
(
$e
)
*
)
.unwrap
();
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment