Commit a8ec7f82 authored by julien.delange's avatar julien.delange
Browse files

xeno native target works now for RMA example



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@2331 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 8b0f529b
package RMAAadl
public
with Deployment;
with ARINC653;
-----------------
-- Subprograms --
......@@ -72,6 +73,9 @@ processor implementation cpurm.impl
subcomponents
part1 : virtual processor partition_runtime.i;
part2 : virtual processor partition_runtime.i;
properties
ARINC653::Partition_Slots => (1000 ms, 1000 ms);
ARINC653::Slots_Allocation => ( reference (part1), reference (part2));
end cpurm.impl;
---------------
......@@ -87,6 +91,32 @@ subcomponents
Task2 : thread Task.impl_2;
end node_a.impl;
memory myram
end myram;
memory segment
end segment;
memory implementation segment.i
end segment.i;
memory implementation myram.stram
properties
Base_Address => 40000000;
Byte_Count => 4194304;
end myram.stram;
memory implementation myram.sdram
subcomponents
segment1 : memory segment.i {Base_Address => 60000000; Byte_Count => 131072;};
segment2 : memory segment.i {Base_Address => 60020000; Byte_Count => 131072;};
properties
Base_Address => 60000000;
Byte_Count => 134217728;
end myram.sdram;
------------
-- System --
------------
......@@ -99,9 +129,13 @@ subcomponents
node_a : process node_a.impl;
node_b : process node_a.impl;
cpu_rm : processor cpurm.impl;
mem : memory myram.sdram;
memst : memory myram.stram;
properties
Actual_Processor_Binding => (reference (cpu_rm.part1)) applies to node_a;
Actual_Processor_Binding => (reference (cpu_rm.part2)) applies to node_b;
actual_memory_binding => (reference (mem.segment1)) applies to Node_A;
actual_memory_binding => (reference (mem.segment2)) applies to Node_B;
end rma.impl;
end RMAAadl;
......@@ -2,6 +2,7 @@ EXTRA_DIST=$(srcdir)/Makefile.common \
$(srcdir)/Makefile.arm.dslinux \
$(srcdir)/Makefile.arm.n770 \
$(srcdir)/Makefile.leon.ork \
$(srcdir)/Makefile.leon3-xm3 \
$(srcdir)/Makefile.leon.rtems \
$(srcdir)/Makefile.linux32 \
$(srcdir)/Makefile.linux32-xenomai-native \
......
......@@ -223,6 +223,13 @@ $(BINARY): generate-asn1-deployment target-objects check-rtems compile-po-hi $(U
$(make-exe)
endif
ifeq ($(TARGET), leon3-xm3)
OBJS = $(USER_OBJS) $(PO_HI_OBJS) $(GENERATED_OBJS) $(EXTERNAL_OBJECTS)
$(BINARY): generate-asn1-deployment target-objects check-rtems compile-po-hi $(USER_OBJS) $(GENERATED_OBJS)
$(make-exe)
endif
ifeq ($(TARGET), x86.rtems)
OBJS = $(USER_OBJS) $(PO_HI_OBJS) $(GENERATED_OBJS) $(EXTERNAL_OBJECTS)
$(BINARY): generate-asn1-deployment target-objects check-rtems compile-po-hi $(USER_OBJS) $(GENERATED_OBJS)
......
TARGET_CFLAGS = `xeno-config --skin native --cflags` -DXENO_NATIVE -D_POSIX_SOURCE -D_GNU_SOURCE
TARGET_LDFLAGS = `xeno-config --skin native --ldflags`
TARGET_CFLAGS = `xeno-config --skin native --cflags` -DXENO_NATIVE -D_POSIX_SOURCE -D_GNU_SOURCE -m32
TARGET_LDFLAGS = `xeno-config --skin native --ldflags` -m32
SIMULINK_LDFLAGS = -lm
CC = gcc
LD = ld
......
TARGET_CFLAGS = `xeno-config --skin posix --cflags` -DXENO_POSIX -D_POSIX_SOURCE -D_GNU_SOURCE
TARGET_LDFLAGS = `xeno-config --skin posix --ldflags`
TARGET_CFLAGS = `xeno-config --skin posix --cflags` -DXENO_POSIX -D_POSIX_SOURCE -D_GNU_SOURCE -m32
TARGET_LDFLAGS = `xeno-config --skin posix --ldflags` -m32
SIMULINK_LDFLAGS = -lm
CC = gcc
......
EXTRA_DIST=$(srcdir)/x86-rtems-boot.img
EXTRA_DIST=$(srcdir)/x86-rtems-boot.img $(srcdir)/xpath
CLEANFILES = *~
......
#!/bin/bash
# usage: xpath: [-c] [-f file] [-n nspace] xpath
# xpath obtains the conf params from the xml files using a standarized notation.
# xpath query, see: http://www.w3.org/TR/xpath
prog=$(basename $0)
nspaces=
file=
function warn() { echo $* 1>&2; }
function usage() {
warn "usage: $prog: -f file [-c] [-n nspace] xpath"
exit 2
}
if ! which xmllint >/dev/null 2>&1; then
warn $(basename $0): xmllint not found
exit 1
fi
cflag=false
while getopts 'cf:n:' c
do
case $c in
c) cflag=true;;
f) file="$OPTARG";;
n) nspaces="$nspaces $OPTARG";;
?) usage;;
esac
done
shift $(($OPTIND - 1))
if test -z "$file"; then
usage
fi
# detect xtratum namespace and set xm by default
if grep -q 'xmlns="http://www.xtratum.org/.*"' $file; then
xm=`sed -n 's|.*xmlns="\(http://www.xtratum.org/xm-...\)".*|\1|p' $file`
nspaces="$nspaces xm=$xm"
fi
(
for ns in $nspaces; do
echo "setns $ns"
done
for xp in $*; do
echo "xpath $xp"
done
) |
xmllint --noent --shell "$file" |
if $cflag; then
awk '/content/ { if (split($0, content, /=/) == 2) print content[2]; }'
else
cat
fi
......@@ -64,9 +64,18 @@ void __po_hi_wait_for_tasks ()
{
pthread_join( tasks[i].tid , NULL );
}
#endif
#ifdef RTEMS_PURE
#elif defined (RTEMS_PURE)
rtems_task_suspend(RTEMS_SELF);
#elif defined (XENO_NATIVE)
int ret;
while (1)
{
ret = rt_task_join (&(tasks[0].xeno_id));
if (ret != 0)
{
__DEBUGMSG ("Error while calling rt_task_suspend in __po_hi_wait_for_tasks (ret=%d)\n", ret);
}
}
#endif
}
......@@ -94,14 +103,14 @@ int __po_hi_compute_next_period (__po_hi_task_id task)
if (tasks[task].ratemon_period == RTEMS_INVALID_ID)
{
name = rtems_build_name ('P', 'R', 'D' + (char)task, ' ');
name = rtems_build_name ('P', 'R', 'D' + (char)task, ' ');
__DEBUGMSG ("Create monotonic server for task %d\n", task);
ret = rtems_rate_monotonic_create (name, &(tasks[task].ratemon_period));
if (ret != RTEMS_SUCCESSFUL)
{
__DEBUGMSG ("Error while creating the monotonic server, task=%d, status=%d\n", task, ret);
}
__DEBUGMSG ("Create monotonic server for task %d\n", task);
ret = rtems_rate_monotonic_create (name, &(tasks[task].ratemon_period));
if (ret != RTEMS_SUCCESSFUL)
{
__DEBUGMSG ("Error while creating the monotonic server, task=%d, status=%d\n", task, ret);
}
}
return (__PO_HI_SUCCESS);
#else
......@@ -142,11 +151,20 @@ int __po_hi_wait_for_next_period (__po_hi_task_id task)
return (__PO_HI_UNAVAILABLE);
#elif defined (XENO_NATIVE)
if ( ! rt_task_wait_period (NULL))
unsigned long overrun;
int ret;
ret = rt_task_wait_period (&overrun);
if ( ret != 0)
{
__DEBUGMSG ("Error in rt_task_period (task=%d;ret=%d)\n", task, ret);
return (__PO_HI_ERROR_TASK_PERIOD);
}
if (overrun != 0)
{
return (__PO_HI_ERROR_TASK_PERIOD);
}
return (__PO_HI_SUCCESS);
#else
return (__PO_HI_UNAVAILABLE);
......@@ -297,23 +315,20 @@ RT_TASK __po_hi_xenomai_create_thread (__po_hi_priority_t priority,
{
RT_TASK newtask;
if (! rt_task_create (&newtask, NULL, stack_size, priority, 0))
/*
* Uses T_JOINABLE at this time, should avoid that later and put 0 instead
* to be able to use kernel-based threads.
*/
if (rt_task_create (&newtask, NULL, stack_size, priority, T_JOINABLE))
{
__DEBUGMSG ("ERROR when creating the task\n");
}
if ( ! rt_task_start (&newtask, (void*)start_routine, NULL))
{
__DEBUGMSG ("ERROR when starting the task\n");
}
return newtask;
}
#endif
int __po_hi_create_generic_task (__po_hi_task_id id,
__po_hi_time_t period,
__po_hi_priority_t priority,
......@@ -364,10 +379,11 @@ int __po_hi_create_periodic_task (__po_hi_task_id id,
__po_hi_stack_t stack_size,
void* (*start_routine)(void))
{
if (__po_hi_create_generic_task( id, period , priority , stack_size, start_routine ) != 1)
{
if (__po_hi_create_generic_task( id, period , priority , stack_size, start_routine ) != 1)
{
__DEBUGMSG ("ERROR when creating generic task (task id=%d)\n", id);
return (__PO_HI_ERROR_CREATE_TASK);
}
}
/*
* Compute the next period of the task, using the
......@@ -379,10 +395,20 @@ int __po_hi_create_periodic_task (__po_hi_task_id id,
return (__PO_HI_ERROR_CLOCK);
}
#elif defined (XENO_NATIVE)
if (! rt_task_set_periodic (&(tasks[id].xeno_id), TM_NOW, tasks[id].period * 1000000))
int ret;
ret = rt_task_set_periodic (&(tasks[id].xeno_id), TM_NOW, tasks[id].period * 1000);
if (ret != 0)
{
__DEBUGMSG ("ERROR when calling rt_task_set_periodic on task %d, ret=%d, period=%lu\n", id, ret, (unsigned long)tasks[id].period);
return (__PO_HI_ERROR_CLOCK);
}
if (rt_task_start (&(tasks[id].xeno_id), (void*)start_routine, NULL))
{
__DEBUGMSG ("ERROR when starting the task\n");
}
#endif
return (__PO_HI_SUCCESS);
......@@ -404,6 +430,23 @@ int __po_hi_create_sporadic_task (__po_hi_task_id id,
return (__PO_HI_ERROR_CREATE_TASK);
}
#if defined (XENO_NATIVE)
int ret;
ret = rt_task_set_periodic (&(tasks[id].xeno_id), TM_NOW, tasks[id].period * 1000);
if (ret != 0)
{
__DEBUGMSG ("ERROR when calling rt_task_set_periodic on task %d, ret=%d, period=%lu\n", id, ret, (unsigned long)tasks[id].period);
return (__PO_HI_ERROR_CLOCK);
}
if (rt_task_start (&(tasks[id].xeno_id), (void*)start_routine, NULL))
{
__DEBUGMSG ("ERROR when starting the task\n");
}
#endif
return (__PO_HI_SUCCESS);
}
......
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