Commit 0ae7059e authored by jdelange's avatar jdelange
Browse files

* Add support for the compcert target

 * Add support for VCD trace files



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@2672 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 15efb75f
...@@ -2,11 +2,13 @@ C_FILES = $(srcdir)/hello.c ...@@ -2,11 +2,13 @@ C_FILES = $(srcdir)/hello.c
AADL_FILES = $(srcdir)/rma.aadl \ AADL_FILES = $(srcdir)/rma.aadl \
$(srcdir)/rma-xenomai-posix.aadl \ $(srcdir)/rma-xenomai-posix.aadl \
$(srcdir)/rma-compcert.aadl \ $(srcdir)/rma-compcert.aadl \
$(srcdir)/rma-bench.aadl \
$(srcdir)/rma-xenomai-native.aadl $(srcdir)/rma-xenomai-native.aadl
SCENARIO_FILES = $(srcdir)/scenario.aadl \ SCENARIO_FILES = $(srcdir)/scenario.aadl \
$(srcdir)/scenario-compcert.aadl \ $(srcdir)/scenario-compcert.aadl \
$(srcdir)/scenario-bench.aadl \
$(srcdir)/scenario-xenomai-native.aadl \ $(srcdir)/scenario-xenomai-native.aadl \
$(srcdir)/scenario-xenomai-posix.aadl $(srcdir)/scenario-xenomai-posix.aadl
......
-- This AADL model illustrates how to conduct schedulability analysis
-- using Cheddar, and then code generation of periodic tasks.
--
-- Two periodic tasks run in parrallel, without interaction. Tasks
-- parameters allows RMA analysis
--
-- $Id: rma.aadl 370 2007-04-23 14:54:41Z hugues $
package RMAAadl
public
with Deployment;
-----------------
-- Subprograms --
-----------------
subprogram Hello_Spg_1
properties
source_language => C;
source_name => "user_Hello_Spg_1";
source_text => ("hello.c");
end Hello_Spg_1;
subprogram Hello_Spg_2
properties
source_language => C;
source_name => "user_Hello_Spg_2";
source_text => ("hello.c");
end Hello_Spg_2;
-------------
-- Threads --
-------------
thread Task
end Task;
thread implementation Task.impl_1
calls
Mycalls: {
P_Spg : subprogram Hello_Spg_1;
};
properties
Dispatch_Protocol => periodic;
Period => 1000ms;
Compute_Execution_time => 0 ms .. 3 ms;
Deadline => 1000 ms;
Priority => 1;
end Task.impl_1;
thread implementation Task.impl_2
calls
Mycalls: {
P_Spg : subprogram Hello_Spg_2;
};
properties
Dispatch_Protocol => periodic;
Period => 500ms;
Compute_Execution_time => 0 ms .. 3 ms;
Deadline => 500 ms;
Priority => 2;
end Task.impl_2;
---------------
-- Processor --
---------------
processor cpurm
properties
Deployment::Execution_Platform => bench;
end cpurm;
processor implementation cpurm.impl
properties
Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol);
end cpurm.impl;
---------------
-- Processes --
---------------
process node_a
end node_a;
process implementation node_a.impl
subcomponents
Task1 : thread Task.impl_1;
Task2 : thread Task.impl_2;
end node_a.impl;
------------
-- System --
------------
system rma
end rma;
system implementation rma.impl
subcomponents
node_a : process node_a.impl;
cpu_rm : processor cpurm.impl;
properties
Actual_Processor_Binding => (reference (cpu_rm)) applies to node_a;
end rma.impl;
end RMAAadl;
-- This AADL model illustrates how to conduct schedulability analysis
-- using Cheddar, and then code generation of periodic tasks.
--
-- Two periodic tasks run in parrallel, without interaction. Tasks
-- parameters allows RMA analysis
--
-- $Id: rma.aadl 370 2007-04-23 14:54:41Z hugues $
package RMAAadl
public
with Deployment;
-----------------
-- Subprograms --
-----------------
subprogram Hello_Spg_1
properties
source_language => C;
source_name => "user_Hello_Spg_1";
source_text => ("hello.c");
end Hello_Spg_1;
subprogram Hello_Spg_2
properties
source_language => C;
source_name => "user_Hello_Spg_2";
source_text => ("hello.c");
end Hello_Spg_2;
-------------
-- Threads --
-------------
thread Task
end Task;
thread implementation Task.impl_1
calls
Mycalls: {
P_Spg : subprogram Hello_Spg_1;
};
properties
Dispatch_Protocol => periodic;
Period => 1000ms;
Compute_Execution_time => 0 ms .. 3 ms;
Deadline => 1000 ms;
Priority => 1;
end Task.impl_1;
thread implementation Task.impl_2
calls
Mycalls: {
P_Spg : subprogram Hello_Spg_2;
};
properties
Dispatch_Protocol => periodic;
Period => 500ms;
Compute_Execution_time => 0 ms .. 3 ms;
Deadline => 500 ms;
Priority => 2;
end Task.impl_2;
---------------
-- Processor --
---------------
processor cpurm
properties
Deployment::Execution_Platform => native_compcert;
end cpurm;
processor implementation cpurm.impl
properties
Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol);
end cpurm.impl;
---------------
-- Processes --
---------------
process node_a
end node_a;
process implementation node_a.impl
subcomponents
Task1 : thread Task.impl_1;
Task2 : thread Task.impl_2;
end node_a.impl;
------------
-- System --
------------
system rma
end rma;
system implementation rma.impl
subcomponents
node_a : process node_a.impl;
cpu_rm : processor cpurm.impl;
properties
Actual_Processor_Binding => (reference (cpu_rm)) applies to node_a;
end rma.impl;
end RMAAadl;
-- This is a scenario file describing the AADL
-- application rma
-- $Id: scenario.aadl 6404 2009-04-22 10:10:04Z hugues $
system rma
properties
Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref");
Ocarina_Config::AADL_Files =>
("rma-bench.aadl");
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
end rma;
system implementation rma.Impl
end rma.Impl;
-- This is a scenario file describing the AADL
-- application rma
-- $Id: scenario.aadl 6404 2009-04-22 10:10:04Z hugues $
system rma
properties
Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref");
Ocarina_Config::AADL_Files =>
("rma-compcert.aadl");
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
end rma;
system implementation rma.Impl
end rma.Impl;
...@@ -54,8 +54,10 @@ void __po_hi_unmarshall_int16 (__po_hi_int16_t* value, __po_hi_msg_t* msg,__po_h ...@@ -54,8 +54,10 @@ void __po_hi_unmarshall_int16 (__po_hi_int16_t* value, __po_hi_msg_t* msg,__po_h
void __po_hi_marshall_int32 (__po_hi_int32_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_marshall_int32 (__po_hi_int32_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
void __po_hi_unmarshall_int32 (__po_hi_int32_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_unmarshall_int32 (__po_hi_int32_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
#ifndef COMPCERT
void __po_hi_marshall_int64 (__po_hi_int64_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_marshall_int64 (__po_hi_int64_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
void __po_hi_unmarshall_int64 (__po_hi_int64_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_unmarshall_int64 (__po_hi_int64_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
#endif
void __po_hi_marshall_uint8 (__po_hi_uint8_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_marshall_uint8 (__po_hi_uint8_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
void __po_hi_unmarshall_uint8 (__po_hi_uint8_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_unmarshall_uint8 (__po_hi_uint8_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
...@@ -66,8 +68,10 @@ void __po_hi_unmarshall_uint16 (__po_hi_uint16_t* value, __po_hi_msg_t* msg,__po ...@@ -66,8 +68,10 @@ void __po_hi_unmarshall_uint16 (__po_hi_uint16_t* value, __po_hi_msg_t* msg,__po
void __po_hi_marshall_uint32 (__po_hi_uint32_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_marshall_uint32 (__po_hi_uint32_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
void __po_hi_unmarshall_uint32 (__po_hi_uint32_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_unmarshall_uint32 (__po_hi_uint32_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
#ifndef COMPCERT
void __po_hi_marshall_uint64 (__po_hi_uint64_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_marshall_uint64 (__po_hi_uint64_t value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
void __po_hi_unmarshall_uint64 (__po_hi_uint64_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset); void __po_hi_unmarshall_uint64 (__po_hi_uint64_t* value, __po_hi_msg_t* msg,__po_hi_uint32_t* offset);
#endif
#ifdef PO_HI_USE_ASN1 #ifdef PO_HI_USE_ASN1
#include <asn1_deployment.h> #include <asn1_deployment.h>
......
...@@ -94,10 +94,10 @@ int __po_hi_initialize_tasking(void); ...@@ -94,10 +94,10 @@ int __po_hi_initialize_tasking(void);
* This function returns SUCCESS if there is no error. Else, * This function returns SUCCESS if there is no error. Else,
* it returns the negative value ERROR_CREATE_TASK. * it returns the negative value ERROR_CREATE_TASK.
*/ */
int __po_hi_create_periodic_task (__po_hi_task_id id, int __po_hi_create_periodic_task (const __po_hi_task_id id,
__po_hi_time_t period, const __po_hi_time_t* period,
__po_hi_priority_t priority, const __po_hi_priority_t priority,
__po_hi_stack_t stack_size, const __po_hi_stack_t stack_size,
void* (*start_routine)(void)); void* (*start_routine)(void));
/* /*
...@@ -111,10 +111,10 @@ int __po_hi_create_periodic_task (__po_hi_task_id id, ...@@ -111,10 +111,10 @@ int __po_hi_create_periodic_task (__po_hi_task_id id,
* Returns SUCCESS value if there is no error. Else, returns the negative * Returns SUCCESS value if there is no error. Else, returns the negative
* value ERROR_CREATE_TASK * value ERROR_CREATE_TASK
*/ */
int __po_hi_create_sporadic_task (__po_hi_task_id id, int __po_hi_create_sporadic_task (const __po_hi_task_id id,
__po_hi_time_t period, const __po_hi_time_t* period,
__po_hi_priority_t priority, const __po_hi_priority_t priority,
__po_hi_stack_t stack_size, const __po_hi_stack_t stack_size,
void* (*start_routine)(void)); void* (*start_routine)(void));
/* /*
...@@ -128,10 +128,10 @@ int __po_hi_create_sporadic_task (__po_hi_task_id id, ...@@ -128,10 +128,10 @@ int __po_hi_create_sporadic_task (__po_hi_task_id id,
* Returns SUCCESS value if there is no error. Else, returns the negative * Returns SUCCESS value if there is no error. Else, returns the negative
* value ERROR_CREATE_TASK * value ERROR_CREATE_TASK
*/ */
int __po_hi_create_generic_task (__po_hi_task_id id, int __po_hi_create_generic_task (const __po_hi_task_id id,
__po_hi_time_t period, const __po_hi_time_t* period,
__po_hi_priority_t priority, const __po_hi_priority_t priority,
__po_hi_stack_t stack_size, const __po_hi_stack_t stack_size,
void* (*start_routine)(void)); void* (*start_routine)(void));
/* /*
...@@ -155,7 +155,7 @@ int __po_hi_wait_for_next_period (__po_hi_task_id task); ...@@ -155,7 +155,7 @@ int __po_hi_wait_for_next_period (__po_hi_task_id task);
* Return SUCCESS if there is no error. Else, it returns * Return SUCCESS if there is no error. Else, it returns
* a negative value : ERROR_CLOCK or ERROR_PTHREAD_COND * a negative value : ERROR_CLOCK or ERROR_PTHREAD_COND
*/ */
int __po_hi_task_delay_until (__po_hi_time_t time, __po_hi_task_id task); int __po_hi_task_delay_until (__po_hi_time_t* time, __po_hi_task_id task);
/* /*
* Computer the next period for a task, according to the period * Computer the next period for a task, according to the period
......
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
#endif #endif
typedef __po_hi_uint64_t __po_hi_time_t; typedef struct
{
__po_hi_uint32_t sec; /* amount of second */
__po_hi_uint32_t nsec; /* amount of nanosecond */
}__po_hi_time_t;
/* /*
* Represent the time in PolyORB-HI. * Represent the time in PolyORB-HI.
* *
...@@ -35,6 +39,10 @@ typedef __po_hi_uint64_t __po_hi_time_t; ...@@ -35,6 +39,10 @@ typedef __po_hi_uint64_t __po_hi_time_t;
* The granularity of the time is in microsecond (10^-6) * The granularity of the time is in microsecond (10^-6)
*/ */
#define __PO_HI_TIME_TO_US(value) ((value.sec*1000000)+(value.nsec / 1000))
#define __PO_HI_TIME_TO_MS(value) ((value.sec*1000)+(value.nsec / 1000000))
int __po_hi_get_time (__po_hi_time_t* mytime); int __po_hi_get_time (__po_hi_time_t* mytime);
/* /*
* Get the current time and store informations * Get the current time and store informations
...@@ -43,41 +51,52 @@ int __po_hi_get_time (__po_hi_time_t* mytime); ...@@ -43,41 +51,52 @@ int __po_hi_get_time (__po_hi_time_t* mytime);
* (ERROR_CLOCK). Else, returns a positive value. * (ERROR_CLOCK). Else, returns a positive value.
*/ */
__po_hi_time_t __po_hi_add_times (__po_hi_time_t left, int __po_hi_add_times (__po_hi_time_t* result,
__po_hi_time_t right); const __po_hi_time_t* left,
const __po_hi_time_t* right);
/* /*
* Add the two structures given in parameter. The returned * Add the two structures given in parameter. The returned
* value is the result of the operation. * value is the result of the operation.
*/ */
__po_hi_time_t __po_hi_seconds (__po_hi_uint32_t seconds); int __po_hi_seconds (__po_hi_time_t* time,
const __po_hi_uint32_t seconds);
/* /*
* Build a __po_hi_time_t value which contains the * Build a __po_hi_time_t value which contains the
* amount of time (in seconds) represented by the * amount of time (in seconds) represented by the
* argument seconds. * argument seconds.
*/ */
__po_hi_time_t __po_hi_milliseconds (__po_hi_uint32_t milliseconds); int __po_hi_milliseconds (__po_hi_time_t* time,
const __po_hi_uint32_t milliseconds);
/* /*
* Build a __po_hi_time_t value which contains the * Build a __po_hi_time_t value which contains the
* amount of time (in milliseconds) represented by the * amount of time (in milliseconds) represented by the
* argument milliseconds. * argument milliseconds.
*/ */
__po_hi_time_t __po_hi_microseconds (__po_hi_uint32_t microseconds); int __po_hi_microseconds (__po_hi_time_t* time,
const __po_hi_uint32_t microseconds);
/* /*
* Build a __po_hi_time_t value which contains the * Build a __po_hi_time_t value which contains the
* amount of time (in microseconds) represented by the * amount of time (in microseconds) represented by the
* argument microseconds. * argument microseconds.
*/ */
int __po_hi_delay_until (__po_hi_time_t time); int __po_hi_delay_until (const __po_hi_time_t* time);
/* /*
* sleep until the time given in argument. * sleep until the time given in argument.
* Return SUCCESS if there is no error. Else, it returns * Return SUCCESS if there is no error. Else, it returns
* a negative value : ERROR_CLOCK or ERROR_PTHREAD_COND * a negative value : ERROR_CLOCK or ERROR_PTHREAD_COND
*/ */
int __po_hi_time_copy (__po_hi_time_t* dst, const __po_hi_time_t* src);
/*
* Copy a time value from src to dst.
* Returns __PO_HI_SUCCESS if successful.
*/
#ifdef NEED_CLOCK_GETTIME #ifdef NEED_CLOCK_GETTIME
#define CLOCK_REALTIME 0 #define CLOCK_REALTIME 0
int clock_gettime(int clk_id, struct timespec *tp); int clock_gettime(int clk_id, struct timespec *tp);
...@@ -87,4 +106,12 @@ int clock_gettime(int clk_id, struct timespec *tp); ...@@ -87,4 +106,12 @@ int clock_gettime(int clk_id, struct timespec *tp);
* emulate it. For example, Darwin does not support it * emulate it. For example, Darwin does not support it
*/ */
int __po_hi_time_is_greater (const __po_hi_time_t* value, const __po_hi_time_t* limit);
/*
* Indicates if a time value is greater than an other.
* Returns 1 if value is greater than limit.
* Returns 0 otherwise.
*/
#endif /* __PO_HI_TIME_H__ */ #endif /* __PO_HI_TIME_H__ */
...@@ -42,11 +42,15 @@ typedef double __po_hi_float64_t; ...@@ -42,11 +42,15 @@ typedef double __po_hi_float64_t;
typedef int8_t __po_hi_int8_t; typedef int8_t __po_hi_int8_t;
typedef int16_t __po_hi_int16_t; typedef int16_t __po_hi_int16_t;
typedef int32_t __po_hi_int32_t; typedef int32_t __po_hi_int32_t;
#ifndef COMPCERT
typedef int64_t __po_hi_int64_t; typedef int64_t __po_hi_int64_t;
#endif
typedef uint8_t __po_hi_uint8_t; typedef uint8_t __po_hi_uint8_t;
typedef uint16_t __po_hi_uint16_t; typedef uint16_t __po_hi_uint16_t;
typedef uint32_t __po_hi_uint32_t; typedef uint32_t __po_hi_uint32_t;
#ifndef COMPCERT
typedef uint64_t __po_hi_uint64_t; typedef uint64_t __po_hi_uint64_t;
#endif
#else #else
/* /*
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* For more informations, please visit http://ocarina.enst.fr * For more informations, please visit http://ocarina.enst.fr
* *
* Copyright (C) 2007-2009, GET-Telecom Paris. * Copyright (C) 2007-2009, GET-Telecom Paris.
* Copyright (C) 2010, European Space Agency. * Copyright (C) 2010-2011, European Space Agency.
*/ */
#ifndef __PO_HI_UTILS_H__ #ifndef __PO_HI_UTILS_H__
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* Simulate the WCET of the task. It enters an infinite loop during a * Simulate the WCET of the task. It enters an infinite loop during a
* random period chosen from the first and second argument. * random period chosen from the first and second argument.
*/ */
int __po_hi_simulate_wcet (__po_hi_time_t time1, __po_hi_time_t time2); int __po_hi_simulate_wcet (const __po_hi_time_t* time1, const __po_hi_time_t* time2);
/* /*
* Take a rate as argument, returns the probability that we meet this rate. * Take a rate as argument, returns the probability that we meet this rate.
...@@ -28,4 +28,51 @@ int __po_hi_compute_miss (__po_hi_uint8_t rate); ...@@ -28,4 +28,51 @@ int __po_hi_compute_miss (__po_hi_uint8_t rate);
unsigned long __po_hi_swap_byte (unsigned long value); unsigned long __po_hi_swap_byte (unsigned long value);
#ifdef __PO_HI_USE_VCD
#include <pthread.h>
#include <string.h>
void __po_hi_instrumentation_vcd_init (void);
#define __PO_HI_INSTRUMENTATION_VCD_INIT __po_hi_instrumentation_vcd_init ();
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...) \
{ \
\
extern int __po_hi_vcd_file; \
extern int __po_hi_vcd_init;\
extern __po_hi_time_t __po_hi_vcd_start_time; \
extern pthread_mutex_t __po_hi_vcd_mutex; \
__po_hi_time_t __po_hi_vcd_current_time; \
char buf[1024]; \
int size_to_write = 0; \
uint64_t st,ct,et = 0; \
\
pthread_mutex_lock (&__po_hi_vcd_mutex); \
\
if (__po_hi_get_time(&__po_hi_vcd_current_time) != __PO_HI_SUCCESS) \
{ \
__DEBUGMSG("[POHIC-INSTRUMENTATION] Could not retrieve time\n"); \
} \
else \
{ \
st = __PO_HI_TIME_TO_US(__po_hi_vcd_start_time); ct = __PO_HI_TIME_TO_US(__po_hi_vcd_current_time); et = ct - st ; \
memset (buf, '\0', 1024); \
size_to_write = sprintf (buf, "#%llu\n", et); \
write (__po_hi_vcd_file, buf, size_to_write); printf (buf);\
\
memset (buf, '\0', 1024); \
size_to_write = sprintf (buf, s, ##args); \
write (__po_hi_vcd_file, buf, size_to_write); printf(buf); \
} \
pthread_mutex_unlock (&__po_hi_vcd_mutex); \
}
#else
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...)
#define __PO_HI_INSTRUMENTATION_VCD_INIT