Skip to content
Snippets Groups Projects
Commit c285c2a3 authored by Per Lindgren's avatar Per Lindgren
Browse files

TRACE related macros fixed

parent 3a2d55f6
No related branches found
No related tags found
No related merge requests found
...@@ -50,13 +50,14 @@ int event_count = 0; ...@@ -50,13 +50,14 @@ int event_count = 0;
/* Create array containing structs of type locks */ /* Create array containing structs of type locks */
#define MAX_NUM_LOCKS 10 #define MAX_NUM_LOCKS 10
event eventlist[MAX_NUM_LOCKS]; event eventlist[MAX_NUM_LOCKS];
void __attribute__ ((noinline)) trace_event(action a, event e) { void __attribute__ ((noinline)) trace_event(action a, elem e) {
eventlist[event_count].time = DWT->CYCCNT; eventlist[event_count].time = DWT->CYCCNT;
eventlist[event_count].action = a; eventlist[event_count].action = a;
eventlist[event_count].elem = e; eventlist[event_count].elem = e;
event_count+=1; event_count+=1;
} }
#define TRACE_EVENT(A,E) trace_event(A, E);
#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);
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
#ifdef KLEE #ifdef KLEE
#include "SRP_klee.h" #include "SRP_klee.h"
#define TRACE(X) {} #define ITM_TRACE(X) {}
#elif defined KLEE_WCET #elif defined KLEE_WCET
#include "SRP_wcet.h" #include "SRP_wcet.h"
#define TRACE(X) {} #define ITM_TRACE(X) {}
#else #else
// Production code // Production code
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <stm32f401xe.h> #include <stm32f401xe.h>
#include "SRP.h" #include "SRP.h"
#define TRACE(X) trace_printf(X) #define ITM_TRACE(X) trace_printf(X)
#endif #endif
// job bindings // job bindings
...@@ -56,7 +56,7 @@ void work(int i) ...@@ -56,7 +56,7 @@ void work(int i)
TASK(j1) TASK(j1)
{ {
TRACE("j1_enter\n"); ITM_TRACE("j1_enter\n");
LOCK(r2); LOCK(r2);
if (state > 0) { if (state > 0) {
work(10); work(10);
...@@ -64,18 +64,18 @@ TASK(j1) ...@@ -64,18 +64,18 @@ TASK(j1)
work(5); work(5);
} }
LOCK(r1); LOCK(r1);
TRACE("j1_r1_locked\n"); ITM_TRACE("j1_r1_locked\n");
work(1); work(1);
TRACE("j1_r1_locked\n"); ITM_TRACE("j1_r1_locked\n");
UNLOCK(r1); UNLOCK(r1);
UNLOCK(r2); UNLOCK(r2);
} }
TASK(j2) TASK(j2)
{ {
TRACE("j2_enter\n"); ITM_TRACE("j2_enter\n");
LOCK(r1); LOCK(r1);
TRACE("j2_r1_locked\n"); ITM_TRACE("j2_r1_locked\n");
work(5); work(5);
UNLOCK(r1); UNLOCK(r1);
...@@ -84,17 +84,17 @@ TASK(j2) ...@@ -84,17 +84,17 @@ TASK(j2)
} else { } else {
work(1); work(1);
} }
TRACE("j2_exit\n"); ITM_TRACE("j2_exit\n");
} }
TASK(j3) TASK(j3)
{ {
TRACE("j3_enter\n"); ITM_TRACE("j3_enter\n");
LOCK(r2); LOCK(r2);
TRACE("j3_r2_locked\n"); ITM_TRACE("j3_r2_locked\n");
work(1); work(1);
UNLOCK(r2); UNLOCK(r2);
TRACE("j3_exit\n"); ITM_TRACE("j3_exit\n");
// int b = 2 * state; // int b = 2 * state;
// if (b < 10) // if (b < 10)
...@@ -170,7 +170,7 @@ int main() ...@@ -170,7 +170,7 @@ int main()
// this will be run in the production code // this will be run in the production code
int main() int main()
{ {
TRACE("\nInit\n"); ITM_TRACE("\nInit\n");
SETPRIO(j1); // Set HW priorities SETPRIO(j1); // Set HW priorities
SETPRIO(j2); SETPRIO(j2);
SETPRIO(j3); SETPRIO(j3);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment