Commit fd170857 authored by yoogx's avatar yoogx

* Add example for code coverage

parent e65d1165
......@@ -208,6 +208,7 @@ AC_OUTPUT([
examples/aadlv1/rma/Makefile
examples/aadlv1/sunseeker/Makefile
examples/aadlv2/Makefile
examples/aadlv2/code_coverage/Makefile
examples/aadlv2/cpp/Makefile
examples/aadlv2/d3.1.3-1/Makefile
examples/aadlv2/import/Makefile
......
SUBDIRS = d3.1.3-1 ping rma sunseeker producer-consumer some-types \
some-types-stdint flight-mgmt import monitor lua cpp \
packet-store file-store latency
packet-store file-store latency code_coverage
SAMPLE_DIR = ${shell $(CYGPATH_U) '$(OCARINA_PREFIX)/examples/ocarina/polyorb-hi-c/aadlv2'}
......@@ -18,5 +18,5 @@ build-all:
check-all:
for dir in $(SUBDIRS); do \
($(MAKE) -C $${dir} check-all) || exit 1; \
done
($(MAKE) -C $${dir} check-all) || exit 1; \
done
C_FILES = $(srcdir)/some-types-stdint.c $(srcdir)/devicesconf.c
AADL_FILES = $(srcdir)/some_types_stdint.aadl $(srcdir)/software.aadl
SCENARIO_FILES = $(srcdir)/scenario.aadl $(srcdir)/scenario_local.aadl \
$(srcdir)/scenario_rtems.aadl
include $(srcdir)/../../Makefile.common
EXTRA_DIST = $(AADL_FILES) $(SCENARIO_FILES) $(C_FILES)
CLEANDIRS = some_types_stdint_impl some_types_local_rtems \
some_types_local_impl
#include <drivers/configuration/ip.h>
__po_hi_c_ip_conf_t pohidrv_device_a = { .devname = "eth0", .address = "127.0.0.1", .version = __po_hi_c_ipv4, .port = 1234};
__po_hi_c_ip_conf_t pohidrv_device_b = { .devname = "eth0", .address = "127.0.0.1", .version = __po_hi_c_ipv4, .port = 1235};
Initialize global queue for task-id 0 ... port 0 (used_size=0,first=0) port 1 (used_size=0,first=0) ... done
Send value, emitter task 0, emitter port 0, emitter entity 0, destination ports :2 (entity=1) ... success ...
Send value, emitter task 0, emitter port 1, emitter entity 0, destination ports :3 (entity=2) ... success ...
Send value, emitter task 0, emitter port 0, emitter entity 0, destination ports :2 (entity=1) ... success ...
Send value, emitter task 0, emitter port 1, emitter entity 0, destination ports :3 (entity=2) ... success ...
Send value, emitter task 0, emitter port 0, emitter entity 0, destination ports :2 (entity=1) ... success ...
Send value, emitter task 0, emitter port 1, emitter entity 0, destination ports :3 (entity=2) ... success ...
Send value, emitter task 0, emitter port 0, emitter entity 0, destination ports :2 (entity=1) ... success ...
Send value, emitter task 0, emitter port 1, emitter entity 0, destination ports :3 (entity=2) ... success ...
Initialize global queue for task-id 0 ... port 0 (used_size=0,first=0) ... done
Initialize global queue for task-id 1 ... port 0 (used_size=0,first=0) ... done
Receiver initialization finished
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredReceived in event data port message for task 0, port 0
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredTask 0 get a value on port 0
Received in event data port message for task 1, port 0
Task 1 get a value on port 0
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredReceived in event data port message for task 0, port 0
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredReceived in event data port message for task 1, port 0
Task 0 get a value on port 0
Task 1 get a value on port 0
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredReceived in event data port message for task 0, port 0
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredReceived in event data port message for task 1, port 0
Task 0 get a value on port 0
Task 1 get a value on port 0
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredReceived in event data port message for task 0, port 0
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredReceived in event data port message for task 1, port 0
Task 0 get a value on port 0
Task 1 get a value on port 0
Receive message
Receive message from node 0
Using raw protocol stack
ERROR, 0 12
package Scenario
public
with Ocarina_Config;
with Ocarina_Library;
system some_types extends Ocarina_Library::Default_PolyORB_HI_C_Config
properties
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref",
"node_b", "node_b.ref");
Ocarina_Config::AADL_Files +=>
("some_types_stdint.aadl", "software.aadl");
Ocarina_Config::Root_System_Name => "Some_Types_Stdint.Impl";
end some_types;
system implementation some_types.Impl
end some_types.Impl;
end scenario;
\ No newline at end of file
package Scenario
public
with Ocarina_Config;
with Ocarina_Library;
system some_types extends Ocarina_Library::Default_PolyORB_HI_C_Config
properties
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref",
"node_b", "node_b.ref");
Ocarina_Config::AADL_Files +=>
("some_types_stdint.aadl", "software.aadl");
Ocarina_Config::Root_System_Name => "some_types_Local.impl";
end some_types;
system implementation some_types.Impl
end some_types.Impl;
end scenario;
\ No newline at end of file
package Scenario
public
with Ocarina_Config;
with Ocarina_Library;
system some_types extends Ocarina_Library::Default_PolyORB_HI_C_Config
properties
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref",
"node_b", "node_b.ref");
Ocarina_Config::AADL_Files +=>
("some_types_stdint.aadl", "software.aadl");
Ocarina_Config::Root_System_Name => "some_types_Local.RTEMS";
end some_types;
system implementation some_types.Impl
end some_types.Impl;
end scenario;
\ No newline at end of file
package Software
public
with Data_Model;
----------
-- Data --
----------
data Boolean_Type
properties
Data_Model::Data_Representation => integer;
Source_Data_Size => 2 Bytes;
end Boolean_Type;
data Integer_Type
properties
Data_Model::Data_Representation => integer;
Source_Data_Size => 4 Bytes;
end Integer_Type;
-----------------
-- Subprograms --
-----------------
subprogram Emit_Boolean
features
Data_Source : out parameter Boolean_Type;
properties
source_language => C;
source_name => "user_emit_boolean";
source_text => ("some-types-stdint.c");
end Emit_Boolean;
subprogram Receive_Boolean
features
Data_Sink : in parameter Boolean_Type;
properties
source_language => C;
source_name => "user_receive_boolean";
source_text => ("some-types-stdint.c");
end Receive_Boolean;
subprogram Emit_Integer
features
Data_Source : out parameter Integer_Type;
properties
source_language => C;
source_name => "user_emit_integer";
source_text => ("some-types-stdint.c");
end Emit_Integer;
subprogram Receive_Integer
features
Data_Sink : in parameter Integer_Type;
properties
source_language => C;
source_name => "user_receive_integer";
source_text => ("some-types-stdint.c");
end Receive_Integer;
--------------------------
-- Wrappers Subprograms --
--------------------------
subprogram Emitter_Wrapper
features
Boolean_Source : out parameter Boolean_Type;
Integer_Source : out parameter Integer_Type;
end Emitter_Wrapper;
subprogram implementation Emitter_Wrapper.Impl
calls
Mycalls: {
B_Spg : subprogram Emit_Boolean;
I_Spg : subprogram Emit_Integer;
};
connections
parameter B_Spg.Data_Source -> Boolean_Source;
parameter I_Spg.Data_Source -> Integer_Source;
end Emitter_Wrapper.Impl;
-------------
-- Threads --
-------------
thread Emitter
features
Boolean_Source : out event data port Boolean_Type;
Integer_Source : out event data port Integer_Type;
end Emitter;
thread implementation Emitter.Impl
calls
Mycalls: {
Emitter_Wrapper : subprogram Emitter_Wrapper.Impl;
};
connections
parameter Emitter_Wrapper.Boolean_Source -> Boolean_Source;
parameter Emitter_Wrapper.Integer_Source -> Integer_Source;
properties
Dispatch_Protocol => Periodic;
Period => 1000 Ms;
end Emitter.Impl;
thread Boolean_Receiver
features
Data_Sink : in event data port Boolean_Type;
end Boolean_Receiver;
thread implementation Boolean_Receiver.Impl
calls
Mycalls: {
B_Spg : subprogram Receive_Boolean;
};
connections
parameter Data_Sink -> B_Spg.Data_Sink;
properties
Dispatch_Protocol => Sporadic;
Period => 10 Ms;
end Boolean_Receiver.Impl;
thread Integer_Receiver
features
Data_Sink : in event data port Integer_Type;
end Integer_Receiver;
thread implementation Integer_Receiver.Impl
calls
Mycalls: {
I_Spg : subprogram Receive_Integer;
};
connections
parameter Data_Sink -> I_Spg.Data_Sink;
properties
Dispatch_Protocol => Sporadic;
Period => 10 Ms;
end Integer_Receiver.Impl;
end Software;
#include <stdio.h>
#include <stdint.h>
int16_t boolean_type_var = 0;
int32_t integer_type_var = 0;
void user_emit_boolean( int16_t* boolean)
{
if (boolean_type_var == 1)
{
boolean_type_var = 0;
}
else
{
boolean_type_var = 1;
}
*boolean = boolean_type_var;
printf ("Sending boolean : %d\n", *boolean);
}
void user_receive_boolean (int16_t boolean)
{
printf ("Receiving boolean : %d\n", boolean);
}
void user_emit_integer( int32_t* integer)
{
integer_type_var++;
*integer = integer_type_var;
printf ("Emetting integer : %d\n", *integer);
}
void user_receive_integer (int32_t integer)
{
printf ("Receiving integer : %d\n", integer);
}
package Some_types
public
with Software;
with Deployment;
with ocarina_drivers;
with ocarina_buses;
---------------
-- Processor --
---------------
processor the_processor
properties
Deployment::Execution_Platform => Native;
end the_processor;
---------------
-- Processes --
---------------
process A
features
Out_Boolean : out event data port Software::Boolean_Type;
Out_Integer : out event data port Software::Integer_Type;
end A;
process implementation A.Impl
subcomponents
Emitter_Thread : thread Software::Emitter.Impl;
connections
port Emitter_Thread.Boolean_Source -> Out_Boolean;
port Emitter_Thread.Integer_Source -> Out_Integer;
end A.Impl;
process B
features
In_Boolean : in event data port Software::Boolean_Type;
In_Integer : in event data port Software::Integer_Type;
end B;
process implementation B.Impl
subcomponents
Boolean_Rcv_Thread : thread Software::Boolean_Receiver.Impl;
Integer_Rcv_Thread : thread Software::Integer_Receiver.Impl;
connections
port In_Boolean -> Boolean_Rcv_Thread.Data_Sink;
port In_Integer -> Integer_Rcv_Thread.Data_Sink;
end B.Impl;
process singleProcess
end singleProcess;
process implementation singleProcess.impl
subcomponents
Emitter_Thread : thread Software::Emitter.Impl;
Boolean_Rcv_Thread : thread Software::Boolean_Receiver.Impl;
Integer_Rcv_Thread : thread Software::Integer_Receiver.Impl;
connections
port Emitter_Thread.Boolean_Source -> Boolean_Rcv_Thread.Data_Sink;
port Emitter_Thread.Integer_Source -> Integer_Rcv_Thread.Data_Sink;
end singleProcess.impl;
------------
-- System --
------------
system Some_Types_Stdint
end Some_Types_Stdint;
system implementation Some_Types_Stdint.Impl
subcomponents
Node_A : process A.Impl;
Node_B : process B.Impl;
Device_A : device ocarina_drivers::generic_sockets_ip.pohic
{Source_Text => ("devicesconf.c");};
Device_B : device ocarina_drivers::generic_sockets_ip.pohic
{Source_Text => ("devicesconf.c");};
CPU_A : processor the_processor;
CPU_B : processor the_processor;
the_bus : bus ocarina_buses::ip.i;
connections
bus access the_bus -> Device_A.link;
bus access the_bus -> Device_B.link;
port Node_A.Out_Boolean -> Node_B.In_Boolean
{Actual_Connection_Binding => (reference (the_bus));};
port Node_A.Out_Integer -> Node_B.In_Integer
{Actual_Connection_Binding => (reference (the_bus));};
properties
actual_processor_binding => (reference (CPU_A)) applies to Node_A;
actual_processor_binding => (reference (CPU_B)) applies to Node_B;
actual_processor_binding => (reference (CPU_A)) applies to Device_A;
actual_processor_binding => (reference (CPU_B)) applies to Device_B;
end Some_Types_Stdint.Impl;
system Some_Types_local
end Some_Types_local;
system implementation Some_Types_local.impl
subcomponents
CPU_A: processor the_processor;
sometypesstdint: process singleProcess.impl;
properties
Actual_Processor_Binding => reference (CPU_A) applies to sometypesstdint;
end Some_Types_local.impl;
system implementation Some_Types_local.Xenomai
extends Some_Types_local.impl
properties
Deployment::Execution_Platform => linux32_xenomai_native applies to CPU_A;
end Some_Types_local.Xenomai;
system implementation Some_Types_local.RTEMS
extends Some_Types_local.impl
properties
Deployment::Execution_platform => LEON_RTEMS applies to CPU_A ;
end Some_Types_local.RTEMS;
end Some_Types;
USER_CFLAGS=-D__PO_HI_USE_GPROF
COVERAGE=gcov
......@@ -405,31 +405,3 @@ int __po_hi_wait_initialization (void)
return (__PO_HI_UNAVAILABLE);
#endif
}
#ifdef __PO_HI_USE_GPROF
void __po_hi_wait_end_of_instrumentation ()
{
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_task_wake_after (10000000 / _TOD_Microseconds_per_tick);
#else
#include <po_hi_time.h>
#include <unistd.h>
__po_hi_time_t now;
__po_hi_time_t ten_secs;
__po_hi_time_t time_to_wait;
__po_hi_get_time (&now);
__po_hi_seconds (&ten_secs, 10);
__po_hi_add_times (&time_to_wait, &ten_secs, &now);
__po_hi_delay_until (&time_to_wait);
#endif
__DEBUGMSG ("Call exit()\n");
__po_hi_tasks_killall ();
exit (1);
__DEBUGMSG ("exit() called\n");
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_task_delete (rtems_self ());
#endif
}
#endif
......@@ -131,8 +131,42 @@ __po_hi_task_id __po_hi_get_task_id (void) {
}
#ifdef __PO_HI_USE_GPROF
void __po_hi_wait_end_of_instrumentation ()
{
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_task_wake_after (10000000 / _TOD_Microseconds_per_tick);
#else
#include <po_hi_time.h>
#include <unistd.h>
__po_hi_time_t now;
__po_hi_time_t ten_secs;
__po_hi_time_t time_to_wait;
__po_hi_get_time (&now);
__po_hi_seconds (&ten_secs, 10);
__po_hi_add_times (&time_to_wait, &ten_secs, &now);
__po_hi_delay_until (&time_to_wait);
#endif
__DEBUGMSG ("Call exit()\n");
__po_hi_tasks_killall ();
exit (1);
__DEBUGMSG ("exit() called\n");
#ifdef __PO_HI_RTEMS_CLASSIC_API
rtems_task_delete (rtems_self ());
#endif
}
#endif
void __po_hi_wait_for_tasks ()
{
#ifdef __PO_HI_USE_GPROF
__po_hi_wait_end_of_instrumentation ();
#endif
#if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX)
int i;
......@@ -436,8 +470,8 @@ pthread_t __po_hi_posix_create_thread (__po_hi_priority_t priority,
if (stack_size != 0)
{
if (pthread_attr_setstacksize (&attr, stack_size) != 0)
{
return ((pthread_t)__PO_HI_ERROR_PTHREAD_ATTR);
{
return ((pthread_t)__PO_HI_ERROR_PTHREAD_ATTR);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment