Commit 7b5670a9 authored by Daniel Silveira's avatar Daniel Silveira

Minor bug corrected, see details list below:

Configure now makes a merge to git checkout of rtems
Remove direct reference to Makefile-hc in Makefile os pos, since now
configure converts Makefile-hc to Makefile
Add init.c in hardcode for the RTEMS testsuites

refs #112291
parent 3a28ef70
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ARINC_653_Module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ModuleName="bare">
<!-- Partition 0 -->
<Partition PartitionIdentifier="1" PartitionName="p0"
Criticality="LEVEL_A" EntryPoint="entry_point" SystemPartition="false">
<PartitionConfiguration Personality="RTEMS5" Cores="1">
<Libs>LIBAIR; LIBPRINTF</Libs>
<Devices></Devices>
<Cache>CODE; DATA</Cache>
<Memory Size="0x400000" />
<Permissions>
FPU_CONTROL; GLOBAL_TIME; CACHE_CONTROL; SET_TOD; SET_PARTITION_MODE;
</Permissions>
</PartitionConfiguration>
</Partition>
<!-- Schedule 1 -->
<Module_Schedule ScheduleIdentifier="1" ScheduleName="test_sched"
InitialModuleSchedule="true" MajorFrameSeconds="1.0">
<Partition_Schedule PartitionIdentifier="1" PartitionName="p0"
PeriodDurationSeconds="0.3" PeriodSeconds="1.0">
<Window_Schedule WindowIdentifier="1" PartitionPeriodStart="true"
WindowDurationSeconds="0.3" WindowStartSeconds="0.0"/>
</Partition_Schedule>
</Module_Schedule>
<!-- Module configuration -->
<AIR_Configuration TicksPerSecond="200" RequiredCores="1"/>
</ARINC_653_Module>
/**
* @file
*
* Minimum Size Application Initialization
*/
/*
* COPYRIGHT (c) 1989-2012.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <bsp.h>
#include <rtems/score/thread.h>
static void *Init( uintptr_t ignored )
{
/* initialize application */
/* Real application would call idle loop functionality */
/* but in this case, just return and fall into a fatal error */
return NULL;
}
/* configuration information */
/*
* This application has no device drivers.
*/
/* NOTICE: the clock driver is explicitly disabled */
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
/*
* This application has no filesytem and libio support.
*/
#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
/*
* This disables reentrancy support in the C Library. It is usually
* not something an application wants to do unless the development
* team is committed to using C Library routines that are KNOWN to
* be reentrant. Caveat Emptor!!
*/
#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
/*
* This test does not need the console driver so there is no reason
* to configure termios.
*/
#define CONFIGURE_TERMIOS_DISABLED
/*
* This test does not use any stdio.
*/
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 0
/*
* This may prevent us from running on every architecture but it
* demonstrates that the user can specify how small of a minimum
* stack they want.
*/
#define CONFIGURE_MINIMUM_TASK_STACK_SIZE 512
/*
* This lowers the number of priorities that this test is able to
* use. The Idle task will be running at the lowest priority.
*/
#define CONFIGURE_MAXIMUM_PRIORITY 15
/*
* This configures RTEMS to use a single memory pool for the RTEMS Workspace
* and C Program Heap. If not defined, there will be separate memory pools
* for the RTEMS Workspace and C Program Heap. Having separate pools
* does haved some advantages in the event a task blows a stack or writes
* outside its memory area. However, in low memory systems the overhead of
* the two pools plus the potential for unused memory in either pool is
* very undesirable.
*
* In high memory environments, this is desirable when you want to use
* the RTEMS "unlimited" objects option. You will be able to create objects
* until you run out of memory.
*/
#define CONFIGURE_UNIFIED_WORK_AREAS
/*
* In this application, the initialization task performs the system
* initialization and then transforms itself into the idle task.
*/
#define CONFIGURE_IDLE_TASK_BODY Init
#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
/*
* If you are debugging confdefs.h, define this
*/
/* #define CONFIGURE_CONFDEFS_DEBUG */
/*
* Instantiate the configuration tables.
*/
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* global variables */
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ARINC_653_Module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ModuleName="bare">
<!-- Partition 0 -->
<Partition PartitionIdentifier="1" PartitionName="p0"
Criticality="LEVEL_A" EntryPoint="entry_point" SystemPartition="false">
<PartitionConfiguration Personality="RTEMS5" Cores="1">
<Libs>LIBAIR; LIBPRINTF</Libs>
<Devices></Devices>
<Cache>CODE; DATA</Cache>
<Memory Size="0x400000" />
<Permissions>
FPU_CONTROL; GLOBAL_TIME; CACHE_CONTROL; SET_TOD; SET_PARTITION_MODE;
</Permissions>
</PartitionConfiguration>
</Partition>
<!-- Schedule 1 -->
<Module_Schedule ScheduleIdentifier="1" ScheduleName="test_sched"
InitialModuleSchedule="true" MajorFrameSeconds="1.0">
<Partition_Schedule PartitionIdentifier="1" PartitionName="p0"
PeriodDurationSeconds="0.3" PeriodSeconds="1.0">
<Window_Schedule WindowIdentifier="1" PartitionPeriodStart="true"
WindowDurationSeconds="0.3" WindowStartSeconds="0.0"/>
</Partition_Schedule>
</Module_Schedule>
<!-- Module configuration -->
<AIR_Configuration TicksPerSecond="200" RequiredCores="1"/>
</ARINC_653_Module>
/*
* Copyright (c) 2013-2015 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tmacros.h"
const char rtems_test_name[] = "SPCONTEXT 1";
#define ITERATION_COUNT 2000
#define PRIORITY_HIGH 2
#define PRIORITY_LOW 3
#define FINISH_EVENT RTEMS_EVENT_0
typedef struct {
rtems_id control_task;
rtems_id validate_tasks[3];
rtems_id timer;
size_t task_index;
int iteration_counter;
} test_context;
static test_context test_instance;
static void validate_task(rtems_task_argument arg)
{
_CPU_Context_validate(arg);
rtems_test_assert(0);
}
static void start_validate_task(
rtems_id *id,
uintptr_t pattern,
rtems_task_priority priority,
bool fp_unit
)
{
rtems_status_code sc;
rtems_attribute fpu_state;
fpu_state = fp_unit ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES;
sc = rtems_task_create(
rtems_build_name('V', 'A', 'L', 'I'),
priority,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
fpu_state,
id
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_start(*id, validate_task, pattern);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
static void reset_timer_or_finish(test_context *self, rtems_id timer)
{
rtems_status_code sc;
int i = self->iteration_counter;
if (i < ITERATION_COUNT) {
self->iteration_counter = i + 1;
sc = rtems_timer_reset(timer);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
} else {
sc = rtems_event_send(self->control_task, FINISH_EVENT);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
}
static void switch_priorities(test_context *self)
{
rtems_status_code sc;
size_t index = self->task_index;
size_t next = (index + 1) % RTEMS_ARRAY_SIZE(self->validate_tasks);
size_t task_current_high = index;
size_t task_next_high = next;
rtems_task_priority priority;
self->task_index = next;
sc = rtems_task_set_priority(
self->validate_tasks[task_next_high],
PRIORITY_HIGH,
&priority
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_set_priority(
self->validate_tasks[task_current_high],
PRIORITY_LOW,
&priority
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
static void clobber_and_switch_timer(rtems_id timer, void *arg)
{
uintptr_t pattern = (uintptr_t) 0xffffffffffffffffU;
test_context *self = arg;
reset_timer_or_finish(self, self->timer);
switch_priorities(self);
_CPU_Context_volatile_clobber(pattern);
}
static void start_timer(test_context *self)
{
rtems_status_code sc;
sc = rtems_timer_create(rtems_build_name('C', 'L', 'S', 'W'), &self->timer);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_timer_fire_after(self->timer, 2, clobber_and_switch_timer, self);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
static void wait_for_finish(void)
{
rtems_status_code sc;
rtems_event_set out;
sc = rtems_event_receive(
FINISH_EVENT,
RTEMS_WAIT | RTEMS_EVENT_ALL,
RTEMS_NO_TIMEOUT,
&out
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(out == FINISH_EVENT);
}
static void test(
test_context *self,
bool task_0_fpu,
bool task_1_fpu,
bool task_2_fpu
)
{
rtems_status_code sc;
uintptr_t pattern_0 = (uintptr_t) 0xaaaaaaaaaaaaaaaaU;
uintptr_t pattern_1 = (uintptr_t) 0x5555555555555555U;
uintptr_t pattern_2 = (uintptr_t) 0x0000000000000000U;
memset(self, 0, sizeof(*self));
self->control_task = rtems_task_self();
start_validate_task(
&self->validate_tasks[0],
pattern_0,
PRIORITY_HIGH,
task_0_fpu
);
start_validate_task(
&self->validate_tasks[1],
pattern_1,
PRIORITY_LOW,
task_1_fpu
);
start_validate_task(
&self->validate_tasks[2],
pattern_2,
PRIORITY_LOW,
task_2_fpu
);
start_timer(self);
wait_for_finish();
sc = rtems_task_delete(self->validate_tasks[0]);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_delete(self->validate_tasks[1]);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_task_delete(self->validate_tasks[2]);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_timer_delete(self->timer);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
static void test_context_is_executing(void)
{
#if defined(RTEMS_SMP)
/*
* Provide a stack area, since on some architectures the top/bottom of stack
* is initialized by _CPU_Context_Initialize().
*/
static char stack[1024];
Context_Control context;
bool is_executing;
memset(&context, 0, sizeof(context));
is_executing = _CPU_Context_Get_is_executing(&context);
rtems_test_assert(!is_executing);
_CPU_Context_Set_is_executing(&context, true);
is_executing = _CPU_Context_Get_is_executing(&context);
rtems_test_assert(is_executing);
_CPU_Context_Set_is_executing(&context, false);
is_executing = _CPU_Context_Get_is_executing(&context);
rtems_test_assert(!is_executing);
_CPU_Context_Set_is_executing(&context, true);
_CPU_Context_Initialize(
&context,
(void *) &stack[0],
sizeof(stack),
0,
NULL,
false,
NULL
);
is_executing = _CPU_Context_Get_is_executing(&context);
rtems_test_assert(is_executing);
#endif
}
static bool is_fp(int i)
{
return i != 0;
}
static const char *desc(int i)
{
return is_fp(i) ? "F" : "N";
}
static void Init(rtems_task_argument arg)
{
test_context *self = &test_instance;
int i;
int j;
int k;
TEST_BEGIN();
test_context_is_executing();
for (i = 0; i < 2; ++i) {
for (j = 0; j < 2; ++j) {
for (k = 0; k < 2; ++k) {
printf("Test configuration %s %s %s... ", desc(i), desc(j), desc(k));
test(self, is_fp(i), is_fp(j), is_fp(k));
printf("done\n");
}
}
}
TEST_END();
rtems_test_exit(0);
}
static void switch_extension(Thread_Control *executing, Thread_Control *heir)
{
uintptr_t pattern = (uintptr_t) 0xffffffffffffffffU;
_CPU_Context_volatile_clobber(pattern);
}
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_MAXIMUM_TIMERS 1
#define CONFIGURE_INITIAL_EXTENSIONS \
{ .thread_switch = switch_extension }, \
RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
......@@ -387,14 +387,19 @@ class Configuration(object):
return input_file, output_file
##
# @brief Execute POS git checkout
# @brief Execute POS git checkout and the\n patchit
# @param pos_name Name of the pos
# @return Path to the makefile template
def git_pos_checkout(self, pos_name, logger):
if self.supported_pos[pos_name].git_id is not "":
def pos_checkout_and_patch(self, pos_name, logger):
if self.supported_pos[pos_name].git_id is not "":
logger.information(1, 'Checking out ' + pos_name + ' from GIT')
FNULL = open(os.devnull, 'w')
# git stash current files to merge ahead and patch on pos checkout
subprocess.call(['git','stash'], cwd="pos", stdout=FNULL, stderr=subprocess.STDOUT)
# git checkout call
subprocess.call(['git','checkout', self.supported_pos[pos_name].git_id], cwd="pos/" + pos_name+ "/" + pos_name, stdout=FNULL, stderr=subprocess.STDOUT)
# patch pos by doing git stash pop
subprocess.call(['git','stash', 'pop'], cwd="pos", stdout=FNULL, stderr=subprocess.STDOUT)
# if self.supported_pos[pos_name].makefile is None:
# return os.path.join(air.AIR_TEMPLATES_DIRECTORY, 'pos_makefile.mako')
......
......@@ -62,7 +62,7 @@ ${'\t\t'}--prefix=$(RTEMS_INSTALL_DIR) && cd ..; ${'\\'}
${'\t'}fi
${'\t'}make -C $(RTEMS_BUILD_DIR) CPPFLAGS='$(AIR_HEADERS)' && ${'\\'}
${'\t'}make -C $(RTEMS_BUILD_DIR) install && ${'\\'}
${'\t'}make -C edilib -f Makefile-hc BUILD_DIR='$(EDILIB_BUILD_DIR)'
${'\t'}make -C edilib BUILD_DIR='$(EDILIB_BUILD_DIR)'
# Clean
${template.Rule('clean', True, None)}
......
......@@ -110,8 +110,8 @@ def Run(args, logger):
pos = os_configuration.get_pos_config(pos_name)
#Git checkout of pos
os_configuration.git_pos_checkout(pos_name, logger)
#Git checkout of pos and patchit
os_configuration.pos_checkout_and_patch(pos_name, logger)
# check if it is an alias
# if pos.alias is not None and pos_name in pos.alias:
......
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