Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cortex-m-rtfm-klee
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KLEE
cortex-m-rtfm-klee
Commits
e77ce578
Commit
e77ce578
authored
7 years ago
by
Per
Browse files
Options
Downloads
Patches
Plain Diff
wcet_bkpt code gen
parent
638e6e56
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
+1
-1
1 addition, 1 deletion
Cargo.toml
examples/resource.rs
+34
-34
34 additions, 34 deletions
examples/resource.rs
macros/Cargo.toml
+2
-1
2 additions, 1 deletion
macros/Cargo.toml
macros/src/trans.rs
+43
-17
43 additions, 17 deletions
macros/src/trans.rs
with
80 additions
and
53 deletions
Cargo.toml
+
1
−
1
View file @
e77ce578
...
@@ -35,7 +35,7 @@ version = "0.2.0"
...
@@ -35,7 +35,7 @@ version = "0.2.0"
path
=
"./klee"
path
=
"./klee"
[features]
[features]
wcet_bkpt
=
[]
wcet_bkpt
=
[
"cortex-m-rtfm-macros/wcet_bkpt"
]
wcet_nop
=
[]
wcet_nop
=
[]
klee_mode
=
[
"cortex-m-rtfm-macros/klee_mode"
,
"klee/klee_mode"
]
klee_mode
=
[
"cortex-m-rtfm-macros/klee_mode"
,
"klee/klee_mode"
]
...
...
This diff is collapsed.
Click to expand it.
examples/resource.rs
+
34
−
34
View file @
e77ce578
...
@@ -78,36 +78,36 @@ fn exti3(t: &mut Threshold, mut r: EXTI3::Resources) {
...
@@ -78,36 +78,36 @@ fn exti3(t: &mut Threshold, mut r: EXTI3::Resources) {
#[allow(dead_code)]
#[allow(dead_code)]
fn
init
(
_p
:
init
::
Peripherals
,
_r
:
init
::
Resources
)
{}
fn
init
(
_p
:
init
::
Peripherals
,
_r
:
init
::
Resources
)
{}
extern
crate
cortex_m
;
//
extern crate cortex_m;
use
cortex_m
::
register
::
basepri
;
//
use cortex_m::register::basepri;
// for wcet should be autogenerated...
//
// for wcet should be autogenerated...
#[inline(never)]
//
#[inline(never)]
#[no_mangle]
//
#[no_mangle]
fn
readbasepri
()
->
u8
{
//
fn readbasepri() -> u8 {
cortex_m
::
register
::
basepri
::
read
()
//
cortex_m::register::basepri::read()
}
//
}
#[inline(never)]
//
#[inline(never)]
#[allow(non_snake_case)]
//
#[allow(non_snake_case)]
#[no_mangle]
//
#[no_mangle]
fn
stub_EXTI1
()
{
//
fn stub_EXTI1() {
unsafe
{
_EXTI1
()
};
//
unsafe { _EXTI1() };
}
//
}
#[inline(never)]
//
#[inline(never)]
#[no_mangle]
//
#[no_mangle]
#[allow(non_snake_case)]
//
#[allow(non_snake_case)]
fn
stub_EXTI2
()
{
//
fn stub_EXTI2() {
unsafe
{
_EXTI2
()
};
//
unsafe { _EXTI2() };
}
//
}
#[inline(never)]
//
#[inline(never)]
#[no_mangle]
//
#[no_mangle]
#[allow(non_snake_case)]
//
#[allow(non_snake_case)]
fn
stub_EXTI3
()
{
//
fn stub_EXTI3() {
unsafe
{
//
unsafe {
_EXTI3
();
//
_EXTI3();
}
//
}
}
//
}
// The idle loop.
// The idle loop.
//
//
...
@@ -116,10 +116,10 @@ fn stub_EXTI3() {
...
@@ -116,10 +116,10 @@ fn stub_EXTI3() {
// endless loop.
// endless loop.
#[inline(never)]
#[inline(never)]
fn
idle
()
->
!
{
fn
idle
()
->
!
{
readbasepri
();
//
readbasepri();
stub_EXTI1
();
//
stub_EXTI1();
// here to provide stub for gdb
stub_EXTI2
();
//
stub_EXTI2();
// here to provide stub for gdb
stub_EXTI3
();
//
stub_EXTI3();
// here to provide stub for gdb
loop
{
loop
{
rtfm
::
nop
();
rtfm
::
nop
();
...
...
This diff is collapsed.
Click to expand it.
macros/Cargo.toml
+
2
−
1
View file @
e77ce578
...
@@ -23,3 +23,4 @@ proc-macro = true
...
@@ -23,3 +23,4 @@ proc-macro = true
[features]
[features]
klee_mode
=
[]
klee_mode
=
[]
wcet_bkpt
=
[]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
macros/src/trans.rs
+
43
−
17
View file @
e77ce578
...
@@ -27,7 +27,12 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
...
@@ -27,7 +27,12 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
quote!
(
#
(
#
root
)
*
)
quote!
(
#
(
#
root
)
*
)
}
}
fn
idle
(
app
:
&
App
,
ownerships
:
&
Ownerships
,
main
:
&
mut
Vec
<
Tokens
>
,
root
:
&
mut
Vec
<
Tokens
>
)
{
fn
idle
(
app
:
&
App
,
ownerships
:
&
Ownerships
,
main
:
&
mut
Vec
<
Tokens
>
,
root
:
&
mut
Vec
<
Tokens
>
,
)
{
let
krate
=
krate
();
let
krate
=
krate
();
let
mut
mod_items
=
vec!
[];
let
mut
mod_items
=
vec!
[];
...
@@ -406,7 +411,9 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
...
@@ -406,7 +411,9 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
let
init
=
&
app
.init.path
;
let
init
=
&
app
.init.path
;
if
!
cfg!
(
feature
=
"klee_mode"
)
{
if
!
cfg!
(
feature
=
"klee_mode"
)
{
// code generation for normal mode
// code generation for normal/wcet mode
if
!
cfg!
(
feature
=
"wcet_bkpt"
)
{
// normal mode
main
.push
(
quote!
{
main
.push
(
quote!
{
// type check
// type check
let
init
:
fn
(
#
(
#
tys
,)
*
)
#
ret
=
#
init
;
let
init
:
fn
(
#
(
#
tys
,)
*
)
#
ret
=
#
init
;
...
@@ -420,7 +427,17 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
...
@@ -420,7 +427,17 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
});
});
});
});
}
else
{
}
else
{
// code generation for klee mode
// wcet_mode
// panic!();
for
(
name
,
_task
)
in
&
app
.tasks
{
let
_name
=
Ident
::
new
(
format!
(
"stub_{}"
,
name
.as_ref
()));
main
.push
(
quote!
{
#
_name
();
});
}
}
}
else
{
// code generation for klee_mode
let
mut
tasks
=
vec!
[];
let
mut
tasks
=
vec!
[];
let
mut
index
:
u32
=
0
;
let
mut
index
:
u32
=
0
;
...
@@ -514,9 +531,10 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
...
@@ -514,9 +531,10 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
for
rname
in
&
task
.resources
{
for
rname
in
&
task
.resources
{
let
ceiling
=
ownerships
[
rname
]
.ceiling
();
let
ceiling
=
ownerships
[
rname
]
.ceiling
();
let
_rname
=
Ident
::
new
(
format!
(
"_{}"
,
rname
.as_ref
()));
let
_rname
=
Ident
::
new
(
format!
(
"_{}"
,
rname
.as_ref
()));
let
resource
=
app
.resources
let
resource
=
app
.resources
.get
(
rname
)
.expect
(
&
format!
(
.get
(
rname
)
"BUG: resource {} has no definition"
,
.expect
(
&
format!
(
"BUG: resource {} has no definition"
,
rname
));
rname
));
let
ty
=
&
resource
.ty
;
let
ty
=
&
resource
.ty
;
let
_static
=
if
resource
.expr
.is_some
()
{
let
_static
=
if
resource
.expr
.is_some
()
{
...
@@ -652,6 +670,7 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
...
@@ -652,6 +670,7 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
let
path
=
&
task
.path
;
let
path
=
&
task
.path
;
let
_tname
=
Ident
::
new
(
format!
(
"_{}"
,
tname
));
let
_tname
=
Ident
::
new
(
format!
(
"_{}"
,
tname
));
let
_stub_tname
=
Ident
::
new
(
format!
(
"stub_{}"
,
tname
));
let
export_name
=
Lit
::
Str
(
tname
.as_ref
()
.to_owned
(),
StrStyle
::
Cooked
);
let
export_name
=
Lit
::
Str
(
tname
.as_ref
()
.to_owned
(),
StrStyle
::
Cooked
);
root
.push
(
quote!
{
root
.push
(
quote!
{
#[allow(non_snake_case)]
#[allow(non_snake_case)]
...
@@ -662,6 +681,13 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
...
@@ -662,6 +681,13 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
f
(
#
(
#
exprs
,)
*
)
f
(
#
(
#
exprs
,)
*
)
}
}
#[inline(never)]
#[no_mangle]
#[allow(non_snake_case)]
fn
#
_stub_tname
()
{
unsafe
{
#
_tname
();
}
}
});
});
root
.push
(
quote!
{
root
.push
(
quote!
{
...
...
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