Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nucleo-64-rtfm
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
nucleo-64-rtfm
Commits
56477acc
Commit
56477acc
authored
7 years ago
by
Per Lindgren
Browse files
Options
Downloads
Patches
Plain Diff
to marcus
parent
6d238c9c
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Cargo.toml
+6
-1
6 additions, 1 deletion
Cargo.toml
macros/src/check.rs
+7
-4
7 additions, 4 deletions
macros/src/check.rs
macros/src/lib.rs
+3
-0
3 additions, 0 deletions
macros/src/lib.rs
src/lib.rs
+44
-8
44 additions, 8 deletions
src/lib.rs
with
60 additions
and
13 deletions
Cargo.toml
+
6
−
1
View file @
56477acc
...
@@ -33,6 +33,11 @@ version = "0.2.0"
...
@@ -33,6 +33,11 @@ version = "0.2.0"
[features]
[features]
wcet_bkpt
=
[]
wcet_bkpt
=
[]
wcet_nop
=
[]
wcet_nop
=
[]
klee
=
[]
[
profile.dev
]
codegen-units
=
1
incremental
=
false
[profile.release]
[profile.release]
lto
=
true
lto
=
true
...
...
This diff is collapsed.
Click to expand it.
macros/src/check.rs
+
7
−
4
View file @
56477acc
...
@@ -6,6 +6,7 @@ use syntax::{self, Resources, Statics};
...
@@ -6,6 +6,7 @@ use syntax::{self, Resources, Statics};
use
syntax
::
error
::
*
;
use
syntax
::
error
::
*
;
#[derive(Debug)]
pub
struct
App
{
pub
struct
App
{
pub
device
:
Path
,
pub
device
:
Path
,
pub
idle
:
Idle
,
pub
idle
:
Idle
,
...
@@ -17,6 +18,7 @@ pub struct App {
...
@@ -17,6 +18,7 @@ pub struct App {
pub
type
Tasks
=
HashMap
<
Ident
,
Task
>
;
pub
type
Tasks
=
HashMap
<
Ident
,
Task
>
;
#[allow(non_camel_case_types)]
#[allow(non_camel_case_types)]
#[derive(Debug)]
pub
enum
Exception
{
pub
enum
Exception
{
PENDSV
,
PENDSV
,
SVCALL
,
SVCALL
,
...
@@ -42,11 +44,13 @@ impl Exception {
...
@@ -42,11 +44,13 @@ impl Exception {
}
}
}
}
#[derive(Debug)]
pub
enum
Kind
{
pub
enum
Kind
{
Exception
(
Exception
),
Exception
(
Exception
),
Interrupt
{
enabled
:
bool
},
Interrupt
{
enabled
:
bool
},
}
}
#[derive(Debug)]
pub
struct
Task
{
pub
struct
Task
{
pub
kind
:
Kind
,
pub
kind
:
Kind
,
pub
path
:
Path
,
pub
path
:
Path
,
...
@@ -63,16 +67,15 @@ pub fn app(app: check::App) -> Result<App> {
...
@@ -63,16 +67,15 @@ pub fn app(app: check::App) -> Result<App> {
tasks
:
app
.tasks
tasks
:
app
.tasks
.into_iter
()
.into_iter
()
.map
(|(
k
,
v
)|
{
.map
(|(
k
,
v
)|
{
let
v
=
::
check
::
task
(
k
.as_ref
(),
v
)
let
v
=
.chain_err
(||
format!
(
"checking task `{}`"
,
k
))
?
;
::
check
::
task
(
k
.as_ref
(),
v
)
.chain_err
(||
format!
(
"checking task `{}`"
,
k
))
?
;
Ok
((
k
,
v
))
Ok
((
k
,
v
))
})
})
.collect
::
<
Result
<
_
>>
()
?
,
.collect
::
<
Result
<
_
>>
()
?
,
};
};
::
check
::
resources
(
&
app
)
::
check
::
resources
(
&
app
)
.chain_err
(||
"checking `resources`"
)
?
;
.chain_err
(||
"checking `resources`"
)
?
;
Ok
(
app
)
Ok
(
app
)
}
}
...
...
This diff is collapsed.
Click to expand it.
macros/src/lib.rs
+
3
−
0
View file @
56477acc
...
@@ -181,6 +181,9 @@ fn run(ts: TokenStream) -> Result<TokenStream> {
...
@@ -181,6 +181,9 @@ fn run(ts: TokenStream) -> Result<TokenStream> {
let
ownerships
=
analyze
::
app
(
&
app
);
let
ownerships
=
analyze
::
app
(
&
app
);
let
tokens
=
trans
::
app
(
&
app
,
&
ownerships
);
let
tokens
=
trans
::
app
(
&
app
,
&
ownerships
);
println!
(
"here we are"
);
println!
(
"{:?}"
,
app
.tasks
);
Ok
(
format!
(
"{}"
,
tokens
)
Ok
(
format!
(
"{}"
,
tokens
)
.parse
()
.parse
()
.map_err
(|
_
|
"BUG: error parsing the generated code"
)
?
)
.map_err
(|
_
|
"BUG: error parsing the generated code"
)
?
)
...
...
This diff is collapsed.
Click to expand it.
src/lib.rs
+
44
−
8
View file @
56477acc
...
@@ -85,6 +85,7 @@ extern crate untagged_option;
...
@@ -85,6 +85,7 @@ extern crate untagged_option;
use
core
::
u8
;
use
core
::
u8
;
pub
use
rtfm_core
::{
Resource
,
Static
,
Threshold
};
pub
use
rtfm_core
::{
Resource
,
Static
,
Threshold
};
#[cfg(not(klee))]
pub
use
cortex_m
::
asm
::{
bkpt
,
nop
,
wfi
};
pub
use
cortex_m
::
asm
::{
bkpt
,
nop
,
wfi
};
pub
use
cortex_m_rtfm_macros
::
app
;
pub
use
cortex_m_rtfm_macros
::
app
;
#[doc(hidden)]
#[doc(hidden)]
...
@@ -92,6 +93,7 @@ pub use untagged_option::UntaggedOption;
...
@@ -92,6 +93,7 @@ pub use untagged_option::UntaggedOption;
use
cortex_m
::
interrupt
::{
self
,
Nr
};
use
cortex_m
::
interrupt
::{
self
,
Nr
};
#[cfg(not(armv6m))]
#[cfg(not(armv6m))]
#[cfg(not(klee))]
use
cortex_m
::
register
::
basepri
;
use
cortex_m
::
register
::
basepri
;
pub
mod
examples
;
pub
mod
examples
;
...
@@ -137,17 +139,51 @@ where
...
@@ -137,17 +139,51 @@ where
if
ceiling
==
max_priority
{
if
ceiling
==
max_priority
{
atomic
(
t
,
|
t
|
f
(
data
,
t
))
atomic
(
t
,
|
t
|
f
(
data
,
t
))
}
else
{
}
else
{
let
old
=
basepri
::
read
();
let
mut
old
=
0
;
// klee mode code generation
// the generated code should not access the hardware
if
!
cfg!
(
feature
=
"klee"
)
{
old
=
basepri
::
read
();
}
let
hw
=
(
max_priority
-
ceiling
)
<<
(
8
-
_nvic_prio_bits
);
let
hw
=
(
max_priority
-
ceiling
)
<<
(
8
-
_nvic_prio_bits
);
// klee mode code generation
// the generated code should not access the hardware
if
!
cfg!
(
feature
=
"klee"
)
{
basepri
::
write
(
hw
);
basepri
::
write
(
hw
);
if
cfg!
(
feature
=
"wcet_bkpt"
)
{
bkpt
();
}
}
if
cfg!
(
feature
=
"wcet_nop"
)
{
nop
();
}
// wcet_bkpt mode
// put breakpoint at raise ceiling, for tracing execution time
if
cfg!
(
feature
=
"wcet_bkpt"
)
{
bkpt
();
}
// wcet_nop mode
// leave nop in the production code, to keep memory layout the same
if
cfg!
(
feature
=
"wcet_nop"
)
{
nop
();
}
let
ret
=
f
(
data
,
&
mut
Threshold
::
new
(
ceiling
));
let
ret
=
f
(
data
,
&
mut
Threshold
::
new
(
ceiling
));
if
cfg!
(
feature
=
"wcet_bkpt"
)
{
bkpt
();
}
// wcet_bkpt mode
if
cfg!
(
feature
=
"wcet_nop"
)
{
nop
();
}
// put breakpoint at lower ceiling, for tracing execution time
if
cfg!
(
feature
=
"wcet_bkpt"
)
{
bkpt
();
}
// wcet_nop mode
// leave nop in the production code, to keep memory layout the same
if
cfg!
(
feature
=
"wcet_nop"
)
{
nop
();
}
// klee mode code generation
// the generated code should not access the hardware
if
!
cfg!
(
feature
=
"klee"
)
{
basepri
::
write
(
old
);
basepri
::
write
(
old
);
}
ret
ret
}
}
}
}
...
...
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