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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KLEE
cortex-m-rtfm-klee
Commits
8485a24d
Commit
8485a24d
authored
8 years ago
by
Jorge Aparicio
Browse files
Options
Downloads
Patches
Plain Diff
make the init::Resources argument optional
parent
b7e43c1d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
macros/src/trans.rs
+40
-23
40 additions, 23 deletions
macros/src/trans.rs
with
40 additions
and
23 deletions
macros/src/trans.rs
+
40
−
23
View file @
8485a24d
...
...
@@ -30,9 +30,15 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
let
device
=
&
app
.device
;
let
krate
=
krate
();
let
mut
tys
=
vec!
[
quote!
(
init
::
Peripherals
)];
let
mut
exprs
=
vec!
[
quote!
(
init
::
Peripherals
::
all
())];
let
mut
mod_items
=
vec!
[];
if
!
app
.resources
.is_empty
()
{
let
mut
fields
=
vec!
[];
let
mut
exprs
=
vec!
[];
let
mut
lifetime
=
None
;
let
mut
rexprs
=
vec!
[];
for
(
name
,
resource
)
in
&
app
.resources
{
lifetime
=
Some
(
quote!
(
'a
));
...
...
@@ -42,7 +48,7 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
pub
#
name
:
&
'a
mut
#
krate
::
Static
<
#
ty
>
,
});
exprs
.push
(
quote!
{
r
exprs
.push
(
quote!
{
#
name
:
::
#
krate
::
Static
::
ref_mut
(
&
mut
*
super
::
#
name
.get
()),
});
}
...
...
@@ -53,18 +59,29 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
pub
struct
_initResources
<
#
lifetime
>
{
#
(
#
fields
)
*
}
});
mod
init
{
pub
use
::
#
device
::
Peripherals
;
mod_items
.push
(
quote!
{
pub
use
::
_initResources
as
Resources
;
impl
<
#
lifetime
>
Resources
<
#
lifetime
>
{
pub
unsafe
fn
new
()
->
Self
{
Resources
{
#
(
#
exprs
)
*
#
(
#
rexprs
)
*
}
}
}
});
tys
.push
(
quote!
(
init
::
Resources
));
exprs
.push
(
quote!
(
init
::
Resources
::
new
()));
}
root
.push
(
quote!
{
mod
init
{
pub
use
::
#
device
::
Peripherals
;
#
(
#
mod_items
)
*
}
});
...
...
@@ -116,10 +133,10 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
let
init
=
&
app
.init.path
;
main
.push
(
quote!
{
// type check
let
init
:
fn
(
init
::
Peripherals
,
init
::
Resources
)
=
#
init
;
let
init
:
fn
(
#
(
#
tys
,)
*
)
=
#
init
;
#
krate
::
atomic
(|
_cs
|
unsafe
{
init
(
init
::
Peripherals
::
all
(),
init
::
Resources
::
new
()
);
init
(
#
(
#
exprs
,)
*
);
#
(
#
exceptions
)
*
#
(
#
interrupts
)
*
...
...
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