Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
d7020e_srp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
d7020e
d7020e_srp
Commits
a432fe12
Commit
a432fe12
authored
Mar 5, 2017
by
pln
Browse files
Options
Downloads
Patches
Plain Diff
main restrucuring symbolic jobs, SRP.x files simplified
parent
c08a5c55
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/SRP.h
+1
-1
1 addition, 1 deletion
include/SRP.h
include/SRP_wcet.h
+2
-12
2 additions, 12 deletions
include/SRP_wcet.h
src/main.c
+125
-117
125 additions, 117 deletions
src/main.c
with
128 additions
and
130 deletions
include/SRP.h
+
1
−
1
View file @
a432fe12
...
@@ -34,5 +34,5 @@
...
@@ -34,5 +34,5 @@
#define TASK(J) void IRQh(J) ()
#define TASK(J) void IRQh(J) ()
#define BREAKPOINT { asm volatile("" ::: "memory"); }
#define BREAKPOINT { asm volatile("
nop
" ::: "memory"); }
This diff is collapsed.
Click to expand it.
include/SRP_wcet.h
+
2
−
12
View file @
a432fe12
...
@@ -45,7 +45,6 @@ typedef struct locks
...
@@ -45,7 +45,6 @@ typedef struct locks
}
locks
;
}
locks
;
int
event_count
=
0
;
int
event_count
=
0
;
/* Create array containing structs of type locks */
/* Create array containing structs of type locks */
...
@@ -55,26 +54,17 @@ locks eventlist[MAX_NUM_LOCKS];
...
@@ -55,26 +54,17 @@ locks eventlist[MAX_NUM_LOCKS];
#define TRACE_EVENT(event, el)({eventlist[event_count].time = DWT->CYCCNT; eventlist[event_count].action = event; eventlist[event_count].elem = el; event_count+=1;})
#define TRACE_EVENT(event, el)({eventlist[event_count].time = DWT->CYCCNT; eventlist[event_count].action = event; eventlist[event_count].elem = el; event_count+=1;})
// #define Ceiling(R) (R##_Ceiling)
// #define Code(J) (J##_Code)
// #define IRQn(J) (J##_IRQn)
// #define H(X) ((1 << __NVIC_PRIO_BITS)-X)
#define IRQh(J) (J##_IRQh)
#define IRQh(J) (J##_IRQh)
// #define BARRIER_LOCK { }
// #define BARRIER_UNLOCK { }
#define JOB_REQUEST(J) { }
#define JOB_REQUEST(J) { }
#define LOCK(X) TRACE_EVENT(L, X);
#define LOCK(X) TRACE_EVENT(L, X);
#define UNLOCK(X) TRACE_EVENT(R, X);
#define UNLOCK(X) TRACE_EVENT(R, X);
// #define SETPRIO(J) { }
// #define ENABLE(J) { }
#define TASK(J) void IRQh(J) ()
#define TASK(J) void IRQh(J) ()
#define BREAKPOINT
{ asm volatile("" ::: "memory"); }
#define BREAKPOINT
void
finish_execution
(
void
)
{}
void
finish_execution
(
void
)
{}
void
terminate_execution
(
void
)
{}
//
void terminate_execution(void) {}
This diff is collapsed.
Click to expand it.
src/main.c
+
125
−
117
View file @
a432fe12
//#define KLEE
//#define KLEE
#define KLEE_WCET
#ifdef KLEE
#ifdef KLEE
#include
"SRP_klee.h"
#include
"SRP_klee.h"
#elif KLEE_WCET
#define TRACE(X) {}
#elif defined KLEE_WCET
#include
"SRP_wcet.h"
#include
"SRP_wcet.h"
#define TRACE(X) {}
#else
#else
#include
"main.h"
// Production code
#define enable_itm
#include
<stdint.h>
#endif
#include
<stdio.h>
#include
<stdlib.h>
#include
"dwt.h"
#include
"Trace.h"
#include
<stm32f401xe.h>
#include
"SRP.h"
#define TRACE(X) trace_printf(X)
#endif
// job bindings
// job bindings
#define j1_IRQn EXTI1_IRQn
#define j1_IRQn EXTI1_IRQn
...
@@ -28,96 +42,113 @@
...
@@ -28,96 +42,113 @@
#define r1_Ceiling 2
#define r1_Ceiling 2
#define r2_Ceiling 1
#define r2_Ceiling 1
static
int
state
;
void
work
(
int
i
)
{
void
work
(
int
i
)
{
volatile
int
k
=
0
;
volatile
int
k
=
0
;
for
(
int
j
=
0
;
j
<
100
*
i
;
j
++
)
for
(
int
j
=
0
;
j
<
100
*
i
;
j
++
)
{
{
k
++
;
k
++
;
}
}
}
}
TASK
(
j1
)
TASK
(
j1
)
{
{
TRACE
(
"j1_enter
\n
"
);
LOCK
(
r2
);
LOCK
(
r2
);
JOB_REQUEST
(
j2
);
// job execution request for j2
JOB_REQUEST
(
j2
);
// job execution request for j2
if
(
state
>
0
)
if
(
state
>
0
)
{
{
work
(
10
);
work
(
10
);
}
}
else
{
else
{
work
(
5
);
work
(
5
);
}
}
LOCK
(
r1
);
LOCK
(
r1
);
#ifdef enable_itm
TRACE
(
"j1_r1_locked, before job request j2
\n
"
);
trace_printf
(
"j1_r1_locked, before job request j2
\n
"
);
#endif
JOB_REQUEST
(
j2
);
JOB_REQUEST
(
j2
);
#ifdef enable_itm
TRACE
(
"j1_r1_locked, after job request j2
\n
"
);
trace_printf
(
"j1_r1_locked, after job request j2
\n
"
);
#endif
UNLOCK
(
r1
);
UNLOCK
(
r1
);
UNLOCK
(
r2
);
UNLOCK
(
r2
);
}
}
TASK
(
j2
)
TASK
(
j2
)
{
{
TRACE
(
"j2_enter
\n
"
);
#ifdef enable_itm
trace_printf
(
"j2_enter
\n
"
);
#endif
LOCK
(
r1
);
LOCK
(
r1
);
#ifdef enable_itm
TRACE
(
"j2_r1_locked
\n
"
);
trace_printf
(
"j2_r1_locked
\n
"
);
work
(
5
);
work
(
5
);
#endif
UNLOCK
(
r1
);
UNLOCK
(
r1
);
#ifdef enable_itm
TRACE
(
"j2_exit
\n
"
);
trace_printf
(
"j2_exit
\n
"
);
#endif
}
}
TASK
(
j3
)
{
TASK
(
j3
)
{
#ifdef enable_itm
TRACE
(
"j3_enter
\n
"
);
trace_printf
(
"j3_enter
\n
"
);
#endif
LOCK
(
r1
);
LOCK
(
r1
);
#ifdef enable_itm
TRACE
(
"j3_r1_locked
\n
"
);
trace_printf
(
"j3_r1_locked
\n
"
);
#endif
work
(
1
);
work
(
1
);
UNLOCK
(
r1
);
UNLOCK
(
r1
);
JOB_REQUEST
(
j1
);
JOB_REQUEST
(
j1
);
#ifdef enable_itm
TRACE
(
"j3_exit
\n
"
);
trace_printf
(
"j3_exit
\n
"
);
#endif
}
}
#ifdef KLEE
_WCET
#ifdef KLEE
/
/ will be set by gdb
/
* The case when KLEE makes the path analysis */
static
volatile
int
wcet_task
;
static
int
state
;
#endif
static
int
job
;
int
main
()
int
main
()
{
{
klee_make_symbolic
(
&
job
,
sizeof
(
job
),
"job"
);
#ifdef enable_itm
trace_printf
(
"
\n
Init
\n
"
);
#endif
#ifndef KLEE
switch
(
job
)
{
case
1
:
// check task 1
klee_make_symbolic
(
&
state
,
sizeof
(
state
),
"state"
);
EXTI1_IRQHandler
();
break
;
case
2
:
// check task 2
klee_make_symbolic
(
&
state
,
sizeof
(
state
),
"state"
);
EXTI2_IRQHandler
();
break
;
case
3
:
// check task 3
klee_make_symbolic
(
&
state
,
sizeof
(
state
),
"state"
);
EXTI3_IRQHandler
();
break
;
}
#elif defined KLEE_WCET
/* The case when gdb runs WCET benchmarking */
static
int
state
;
static
int
job
;
int
main
()
{
dwt_enable
();
dwt_enable
();
DWT
->
CYCCNT
=
0
;
DWT
->
CYCCNT
=
0
;
#ifndef KLEE_WCET
switch
(
job
)
{
case
1
:
TRACE_EVENT
(
S
,
j1
);
EXTI1_IRQHandler
();
TRACE_EVENT
(
E
,
j1
);
break
;
case
2
:
TRACE_EVENT
(
S
,
j2
);
EXTI2_IRQHandler
();
TRACE_EVENT
(
E
,
j2
);
break
;
case
3
:
TRACE_EVENT
(
S
,
j3
);
EXTI3_IRQHandler
();
TRACE_EVENT
(
E
,
j3
);
break
;
}
finish_execution
();
// gdb breakpoint
// terminate_execution();
}
#else
// this will be run in the production code
// this will be run in the production code
int
main
()
{
TRACE
(
"
\n
Init
\n
"
);
SETPRIO
(
j1
);
// Set HW priorities
SETPRIO
(
j1
);
// Set HW priorities
SETPRIO
(
j2
);
SETPRIO
(
j2
);
SETPRIO
(
j3
);
SETPRIO
(
j3
);
...
@@ -125,39 +156,16 @@ int main()
...
@@ -125,39 +156,16 @@ int main()
ENABLE
(
j2
);
ENABLE
(
j2
);
ENABLE
(
j3
);
ENABLE
(
j3
);
//JOB_REQUEST(j1); // comment out in assignment c
JOB_REQUEST
(
j3
);
// use in assignment c
JOB_REQUEST
(
j3
);
// use in assignment c
BREAKPOINT
;
BREAKPOINT
while
(
1
)
;
;
return
0
;
/* The case when NOT running WCET benchmark nor KLEE-analysis */
#else
TRACE_EVENT
(
S
,
j1
);
EXTI1_IRQHandler
();
TRACE_EVENT
(
E
,
j1
);
#endif
finish_execution
();
terminate_execution
();
#elif (JOB == 1)
while
(
1
)
// check task 1
;
klee_make_symbolic
(
&
state
,
sizeof
(
state
),
"state"
);
return
0
;
EXTI1_IRQHandler
();
#elif (JOB == 2)
// check task 2
klee_make_symbolic
(
&
state
,
sizeof
(
state
),
"state"
);
EXTI2_IRQHandler
();
#elif (JOB == 3)
// check task 3
klee_make_symbolic
(
&
state
,
sizeof
(
state
),
"state"
);
EXTI3_IRQHandler
();
#endif
}
}
#endif
/*
/*
Assignments
Assignments
...
...
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