diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-09-22 16:21:12 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-12-11 08:17:16 +0100 |
commit | d0c39838146c6a186ddda3d95dac71c3fa90f11e (patch) | |
tree | 1f96df0fd4b6e5ee9658060529b69bea1a46de4a /testsuites | |
parent | m32r/configure.ac: Looked for m32rsim to exist and now is gone (diff) | |
download | rtems-d0c39838146c6a186ddda3d95dac71c3fa90f11e.tar.bz2 |
Use linker set for system initialization
Make rtems_initialize_data_structures(),
rtems_initialize_before_drivers() and rtems_initialize_device_drivers()
static. Rename rtems_initialize_start_multitasking() to
rtems_initialize_executive() and call the registered system
initialization handlers in this function. Add system initialization API
available via #include <rtems/sysinit.h>. Update the documentation
accordingly.
This is no functional change, only the method to call the existing
initialization routines changes. Instead of direct function calls a
table of function pointers contained in the new RTEMS system
initialization linker set is used. This table looks like this (the
actual addresses depend on the target).
nm *.exe | grep _Linker | sort
0201a2d0 D _Linker_set__Sysinit_begin
0201a2d0 D _Linker_set__Sysinit_bsp_work_area_initialize
0201a2d4 D _Linker_set__Sysinit_bsp_start
0201a2d8 D _Linker_set__Sysinit_rtems_initialize_data_structures
0201a2dc D _Linker_set__Sysinit_bsp_libc_init
0201a2e0 D _Linker_set__Sysinit_rtems_initialize_before_drivers
0201a2e4 D _Linker_set__Sysinit_bsp_predriver_hook
0201a2e8 D _Linker_set__Sysinit_rtems_initialize_device_drivers
0201a2ec D _Linker_set__Sysinit_bsp_postdriver_hook
0201a2f0 D _Linker_set__Sysinit_end
Add test sptests/spsysinit01.
Update #2408.
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/sptests/Makefile.am | 1 | ||||
-rw-r--r-- | testsuites/sptests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/sptests/spsysinit01/Makefile.am | 19 | ||||
-rw-r--r-- | testsuites/sptests/spsysinit01/init.c | 176 | ||||
-rw-r--r-- | testsuites/sptests/spsysinit01/spsysinit01.doc | 13 | ||||
-rw-r--r-- | testsuites/sptests/spsysinit01/spsysinit01.scn | 2 |
6 files changed, 212 insertions, 0 deletions
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 32ce1dad57..dac14e1408 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -33,6 +33,7 @@ _SUBDIRS = \ spsignal_err01 spport_err01 spmsgq_err01 spmsgq_err02 spsem_err01 \ spsem_err02 sptask_err01 spevent_err03 sptask_err03 sptask_err02 \ sptask_err04 spclock_err01 +_SUBDIRS += spsysinit01 if HAS_SMP else _SUBDIRS += sp29 diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 2f50ceb568..6448e037c4 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -46,6 +46,7 @@ AM_CONDITIONAL(HAS_SMP,test "$rtems_cv_RTEMS_SMP" = "yes") # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile +spsysinit01/Makefile splinkersets01/Makefile spstdthreads01/Makefile spsyslock01/Makefile diff --git a/testsuites/sptests/spsysinit01/Makefile.am b/testsuites/sptests/spsysinit01/Makefile.am new file mode 100644 index 0000000000..3a08d51bd1 --- /dev/null +++ b/testsuites/sptests/spsysinit01/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = spsysinit01 +spsysinit01_SOURCES = init.c + +dist_rtems_tests_DATA = spsysinit01.scn spsysinit01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spsysinit01_OBJECTS) +LINK_LIBS = $(spsysinit01_LDLIBS) + +spsysinit01$(EXEEXT): $(spsysinit01_OBJECTS) $(spsysinit01_DEPENDENCIES) + @rm -f spsysinit01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c new file mode 100644 index 0000000000..76f8afd243 --- /dev/null +++ b/testsuites/sptests/spsysinit01/init.c @@ -0,0 +1,176 @@ +/* + * Copyright (c) 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.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include <assert.h> +#include <stdlib.h> + +#include <rtems.h> +#include <rtems/libio_.h> +#include <rtems/sysinit.h> +#include <rtems/test.h> + +#include <rtems/score/sysstate.h> +#include <rtems/score/wkspace.h> + +const char rtems_test_name[] = "SPSYSINIT 1"; + +#define FIRST(x) \ + static void x##_first(void); \ + RTEMS_SYSINIT_ITEM( \ + x##_first, \ + x, \ + RTEMS_SYSINIT_ORDER_FIRST \ + ); \ + static void x##_first(void) + +#define LAST(x) \ + static void x##_last(void); \ + RTEMS_SYSINIT_ITEM( \ + x##_last, \ + x, \ + RTEMS_SYSINIT_ORDER_LAST \ + ); \ + static void x##_last(void) + +static int step; + +static void next_step(int expected) +{ + assert(step == expected); + step = expected + 1; +} + +FIRST(RTEMS_SYSINIT_BSP_WORK_AREAS) +{ + rtems_test_begink(); + assert(_Workspace_Area.area_begin == 0); + next_step(0); +} + +LAST(RTEMS_SYSINIT_BSP_WORK_AREAS) +{ + assert(_Workspace_Area.area_begin != 0); + next_step(1); +} + +FIRST(RTEMS_SYSINIT_BSP_START) +{ + /* + * Since the work performed here is BSP-specific, there is no way to test pre + * and post conditions. + */ + next_step(2); +} + +LAST(RTEMS_SYSINIT_BSP_START) +{ + next_step(3); +} + +FIRST(RTEMS_SYSINIT_DATA_STRUCTURES) +{ + assert(_System_state_Is_before_initialization(_System_state_Get())); + next_step(4); +} + +LAST(RTEMS_SYSINIT_DATA_STRUCTURES) +{ + assert(_System_state_Is_before_multitasking(_System_state_Get())); + next_step(5); +} + +FIRST(RTEMS_SYSINIT_BSP_LIBC) +{ + assert(rtems_libio_semaphore == 0); + next_step(6); +} + +LAST(RTEMS_SYSINIT_BSP_LIBC) +{ + assert(rtems_libio_semaphore != 0); + next_step(7); +} + +FIRST(RTEMS_SYSINIT_BEFORE_DRIVERS) +{ + /* Omit test of build configuration specific pre and post conditions */ + next_step(8); +} + +LAST(RTEMS_SYSINIT_BEFORE_DRIVERS) +{ + next_step(9); +} + +FIRST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) +{ + /* + * Since the work performed here is BSP-specific, there is no way to test pre + * and post conditions. + */ + next_step(10); +} + +LAST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) +{ + next_step(11); +} + +FIRST(RTEMS_SYSINIT_DEVICE_DRIVERS) +{ + assert(!_IO_All_drivers_initialized); + next_step(12); +} + +LAST(RTEMS_SYSINIT_DEVICE_DRIVERS) +{ + assert(_IO_All_drivers_initialized); + next_step(13); +} + +FIRST(RTEMS_SYSINIT_BSP_POST_DRIVERS) +{ + assert(rtems_libio_iop_freelist != NULL); + next_step(14); +} + +LAST(RTEMS_SYSINIT_BSP_POST_DRIVERS) +{ + assert(rtems_libio_iop_freelist == NULL); + next_step(15); +} + +static void Init(rtems_task_argument arg) +{ + next_step(16); + rtems_test_endk(); + exit(0); +} + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/sptests/spsysinit01/spsysinit01.doc b/testsuites/sptests/spsysinit01/spsysinit01.doc new file mode 100644 index 0000000000..08037f0808 --- /dev/null +++ b/testsuites/sptests/spsysinit01/spsysinit01.doc @@ -0,0 +1,13 @@ +This file describes the directives and concepts tested by this test set. + +test set name: spsysinit01 + +directives: + + - rtems_initialize_executive() + +concepts: + + - Ensures that each initialization step is performed in the right order. + - Ensures that each initialization step performs the intended + initializations. diff --git a/testsuites/sptests/spsysinit01/spsysinit01.scn b/testsuites/sptests/spsysinit01/spsysinit01.scn new file mode 100644 index 0000000000..48ead81a16 --- /dev/null +++ b/testsuites/sptests/spsysinit01/spsysinit01.scn @@ -0,0 +1,2 @@ +*** BEGIN OF TEST SPSYSINIT 1 *** +*** END OF TEST SPSYSINIT 1 *** |