summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-12-04 09:38:27 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-12-05 07:47:06 +0100
commite870941bb0f2f300e8fd252c7e30ecaabbe50841 (patch)
treee250a92e371ecae1798098fa1367872f721ddca4
parentbeagle bsp: disable watchdog on am335x (diff)
downloadrtems-e870941bb0f2f300e8fd252c7e30ecaabbe50841.tar.bz2
libmisc: More useful default configuration
The dummy.c was a de-facto default configuration. Rename it to default-configuration.c. Use unlimited objects and the stack checker. This makes it easier for new RTEMS users which will likely use this file if they just work with the usual main() function as the application entry point. Provide proper arguments for main() using the BSP command line. Add spare user extensions and drivers. Do not initialize the network by default. Delete bspinit.c.
-rw-r--r--c/src/lib/libbsp/Makefile.am2
-rw-r--r--c/src/lib/libbsp/i386/pc386/Makefile.am1
-rw-r--r--c/src/lib/libbsp/m68k/mcf5235/Makefile.am2
-rw-r--r--c/src/lib/libbsp/shared/bspinit.c98
-rw-r--r--c/src/lib/libbsp/sparc/erc32/Makefile.am1
-rw-r--r--c/src/lib/libbsp/sparc/leon2/Makefile.am1
-rw-r--r--c/src/lib/libbsp/sparc/leon3/Makefile.am2
-rw-r--r--cpukit/libmisc/Makefile.am5
-rw-r--r--cpukit/libmisc/dummy/README23
-rw-r--r--cpukit/libmisc/dummy/default-configuration.c105
-rw-r--r--cpukit/libmisc/dummy/dummy.c38
-rw-r--r--testsuites/libtests/Makefile.am1
-rw-r--r--testsuites/libtests/configure.ac1
-rw-r--r--testsuites/libtests/defaultconfig01/Makefile.am19
-rw-r--r--testsuites/libtests/defaultconfig01/defaultconfig01.doc11
-rw-r--r--testsuites/libtests/defaultconfig01/defaultconfig01.scn2
-rw-r--r--testsuites/libtests/defaultconfig01/init.c59
17 files changed, 202 insertions, 169 deletions
diff --git a/c/src/lib/libbsp/Makefile.am b/c/src/lib/libbsp/Makefile.am
index ac64f37119..3cab4d7cfa 100644
--- a/c/src/lib/libbsp/Makefile.am
+++ b/c/src/lib/libbsp/Makefile.am
@@ -6,7 +6,7 @@ DIST_SUBDIRS = @libbsp_cpu_subdir@
EXTRA_DIST = MERGE.PROCEDURE bsp.am
# shared
-EXTRA_DIST += shared/bootcard.c shared/bspclean.c shared/bspinit.c \
+EXTRA_DIST += shared/bootcard.c shared/bspclean.c \
shared/bsplibc.c shared/bsppost.c shared/console-polled.c \
shared/console.c shared/gnatinstallhandler.c shared/sbrk.c \
shared/tod.c
diff --git a/c/src/lib/libbsp/i386/pc386/Makefile.am b/c/src/lib/libbsp/i386/pc386/Makefile.am
index 391bfa99e3..42b0279eb1 100644
--- a/c/src/lib/libbsp/i386/pc386/Makefile.am
+++ b/c/src/lib/libbsp/i386/pc386/Makefile.am
@@ -147,7 +147,6 @@ libbsp_a_SOURCES += ../../i386/shared/irq/idt.c
libbsp_a_SOURCES += ../../i386/shared/irq/irq.c
libbsp_a_SOURCES += ../../i386/shared/irq/irq_init.c
libbsp_a_SOURCES += ../../shared/bootcard.c
-libbsp_a_SOURCES += ../../shared/bspinit.c
libbsp_a_SOURCES += ../../shared/sbrk.c
libbsp_a_SOURCES += startup/ldsegs.S
libbsp_a_SOURCES += ../../i386/shared/irq/irq_asm.S
diff --git a/c/src/lib/libbsp/m68k/mcf5235/Makefile.am b/c/src/lib/libbsp/m68k/mcf5235/Makefile.am
index f24d83014e..e551d29bc5 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/Makefile.am
+++ b/c/src/lib/libbsp/m68k/mcf5235/Makefile.am
@@ -32,7 +32,7 @@ libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsppredriverhook.c \
startup/bspgetcpuclockspeed.c ../../shared/bsppretaskinghook.c \
../../shared/bspgetworkarea.c startup/init5235.c startup/bspstart.c \
../../shared/bootcard.c ../../shared/sbrk.c ../../shared/setvec.c \
- ../../shared/gnatinstallhandler.c ../../shared/bspinit.c \
+ ../../shared/gnatinstallhandler.c \
startup/copyvectors.c
# clock
libbsp_a_SOURCES += clock/clock.c ../../../shared/clockdrv_shell.h
diff --git a/c/src/lib/libbsp/shared/bspinit.c b/c/src/lib/libbsp/shared/bspinit.c
deleted file mode 100644
index b524389de2..0000000000
--- a/c/src/lib/libbsp/shared/bspinit.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * COPYRIGHT (c) 1989-2009.
- * 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.
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <bsp.h>
-#include <bsp/bootcard.h>
-#ifdef RTEMS_NETWORKING
- #include <rtems/rtems_bsdnet.h>
-#endif
-
-/*
- * Necessary prototypes
- */
-rtems_task Init (rtems_task_argument arg);
-int main (int argc, char* argv[]);
-
-/*
- * This routine calls main from a confdefs.h default Init task
- * set up. The bootcard will provide the task argument as
- * command line string (ASCIIZ).
- */
-
-rtems_task Init (rtems_task_argument arg)
-{
- const char* boot_cmdline = *((const char**) arg);
- char* cmdline = 0;
- char* command;
- int argc = 0;
- char** argv = NULL;
- int result = -124;
-
- if (boot_cmdline) {
- cmdline = malloc (strlen (boot_cmdline) + 1);
-
- if (cmdline) {
- strcpy (cmdline, boot_cmdline);
-
- command = cmdline;
-
- /*
- * Break the line up into arguments with "" being ignored.
- */
- while (true) {
- command = strtok (command, " \t\r\n");
- if (command == NULL)
- break;
- argc++;
- command = '\0';
- }
-
- /*
- * If there are arguments, allocate enough memory for the argv
- * array to be passed into main().
- *
- * NOTE: If argc is 0, then argv will be NULL.
- */
- argv = calloc (argc, sizeof (char*));
-
- if (argv) {
- int a;
-
- command = cmdline;
- argv[0] = command;
-
- for (a = 1; a < argc; a++) {
- command += strlen (command) + 1;
- argv[a] = command;
- }
- } else
- argc = 0;
- }
- }
-
-#ifdef RTEMS_NETWORKING
- rtems_bsdnet_initialize_network ();
-#endif
-
- result = main (argc, argv);
-
- free (argv);
- free (cmdline);
-
- exit (result);
-}
-
-/*
- * By making this a weak alias and a user can provide there own.
- */
-
-void Init (rtems_task_argument arg) __attribute__ ((weak));
diff --git a/c/src/lib/libbsp/sparc/erc32/Makefile.am b/c/src/lib/libbsp/sparc/erc32/Makefile.am
index 00e398b54f..c99d2fb429 100644
--- a/c/src/lib/libbsp/sparc/erc32/Makefile.am
+++ b/c/src/lib/libbsp/sparc/erc32/Makefile.am
@@ -36,7 +36,6 @@ libbsp_a_SOURCES += ../../sparc/shared/bsppretaskinghook.c
libbsp_a_SOURCES += ../../shared/bsppost.c
libbsp_a_SOURCES += ../../shared/bspstart.c
libbsp_a_SOURCES += ../../shared/bootcard.c
-libbsp_a_SOURCES += ../../shared/bspinit.c
libbsp_a_SOURCES += ../../shared/sbrk.c
libbsp_a_SOURCES += startup/setvec.c
libbsp_a_SOURCES += startup/spurious.c
diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am
index ac6f327396..d1e3817207 100644
--- a/c/src/lib/libbsp/sparc/leon2/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am
@@ -57,7 +57,6 @@ libbsp_a_SOURCES += ../../shared/sbrk.c
libbsp_a_SOURCES += startup/setvec.c
libbsp_a_SOURCES += startup/spurious.c
libbsp_a_SOURCES += startup/bspidle.c
-libbsp_a_SOURCES += ../../shared/bspinit.c
libbsp_a_SOURCES += startup/bspdelay.c
libbsp_a_SOURCES += ../../sparc/shared/startup/early_malloc.c
libbsp_a_SOURCES += ../../sparc/shared/startup/bsp_fatal_exit.c
diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am
index c5c9b77826..c8940953f8 100644
--- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
@@ -39,7 +39,7 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c \
../../sparc/shared/startup/bspgetworkarea.c ../../shared/sbrk.c \
startup/setvec.c \
startup/spurious.c startup/bspidle.S startup/bspdelay.c \
- ../../shared/bspinit.c ../../sparc/shared/startup/early_malloc.c
+ ../../sparc/shared/startup/early_malloc.c
libbsp_a_SOURCES += startup/cpucounter.c
libbsp_a_SOURCES += ../../sparc/shared/startup/bsp_fatal_exit.c
libbsp_a_SOURCES += startup/bsp_fatal_halt.c
diff --git a/cpukit/libmisc/Makefile.am b/cpukit/libmisc/Makefile.am
index 209b46d12a..8fc208f176 100644
--- a/cpukit/libmisc/Makefile.am
+++ b/cpukit/libmisc/Makefile.am
@@ -35,11 +35,8 @@ noinst_LIBRARIES += libdevnull.a
libdevnull_a_SOURCES = devnull/devnull.c devnull/devnull.h \
devnull/devzero.c devnull/devzero.h
-## dummy
-EXTRA_DIST += dummy/README
-
noinst_LIBRARIES += libdummy.a
-libdummy_a_SOURCES = dummy/dummy.c dummy/dummy-networking.c
+libdummy_a_SOURCES = dummy/default-configuration.c dummy/dummy-networking.c
## dumpbuf
noinst_LIBRARIES += libdumpbuf.a
diff --git a/cpukit/libmisc/dummy/README b/cpukit/libmisc/dummy/README
deleted file mode 100644
index 03bb30834d..0000000000
--- a/cpukit/libmisc/dummy/README
+++ /dev/null
@@ -1,23 +0,0 @@
-dummy.rel
-=========
-
-A relocatible objects which contains a dummy configuration for RTEMS.
-
-Helps linking standard c-program code with RTEMS, which shall *not* be run
-on a target, such as configure script code fragments generated by autoconf's
-AC_TRY_LINK.
-
-Example:
-
-tar xzvf somepkg.tar.gz
-cd somepkg
-
-LDFLAGS=/usr/local/rtems/<cpu>-rtems/<bsp>/lib/dummy.rel \
-CC="<cpu>-rtems-gcc \
--B/usr/local/rtems/<cpu>-rtems/<bsp>/lib/ -specs bsp_specs -qrtems" \
-CC_FOR_BUILD="gcc" \
-configure --host=<cpu>-rtems --build=i686-pc-linux-gnu
-make
-
-History:
-Starting dummy.c with a copy of rtems-19990528/c/src/tests/samples/minimum/init.c
diff --git a/cpukit/libmisc/dummy/default-configuration.c b/cpukit/libmisc/dummy/default-configuration.c
new file mode 100644
index 0000000000..ff04a74776
--- /dev/null
+++ b/cpukit/libmisc/dummy/default-configuration.c
@@ -0,0 +1,105 @@
+/*
+ * Default configuration file
+ *
+ * COPYRIGHT (c) 1989-2008.
+ * 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 <stdlib.h>
+
+#include <rtems.h>
+
+int main( int argc, char **argv );
+
+static void Init( rtems_task_argument arg )
+{
+ const char *boot_cmdline = *((const char **) arg);
+ char *cmdline = NULL;
+ int argc = 0;
+ char **argv = NULL;
+ int result;
+
+ if ( boot_cmdline != NULL ) {
+ size_t n = strlen( boot_cmdline ) + 1;
+
+ cmdline = malloc( n );
+ if ( cmdline != NULL ) {
+ char* command;
+
+ memcpy( cmdline, boot_cmdline, n);
+
+ command = cmdline;
+
+ /*
+ * Break the line up into arguments with "" being ignored.
+ */
+ while ( true ) {
+ command = strtok( command, " \t\r\n" );
+ if ( command == NULL )
+ break;
+
+ ++argc;
+ command = '\0';
+ }
+
+ /*
+ * If there are arguments, allocate enough memory for the argv
+ * array to be passed into main().
+ *
+ * NOTE: If argc is 0, then argv will be NULL.
+ */
+ argv = calloc( argc, sizeof( *argv ) );
+ if ( argv != NULL ) {
+ int a;
+
+ command = cmdline;
+ argv[ 0 ] = command;
+
+ for ( a = 1; a < argc; ++a ) {
+ command += strlen( command ) + 1;
+ argv[ a ] = command;
+ }
+ } else {
+ argc = 0;
+ }
+ }
+ }
+
+ result = main( argc, argv );
+
+ free( argv );
+ free( cmdline );
+
+ exit( result );
+}
+
+/* configuration information */
+
+/* This is enough to get a basic main() up. */
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_UNIFIED_WORK_AREAS
+#define CONFIGURE_UNLIMITED_OBJECTS
+#define CONFIGURE_STACK_CHECKER_ENABLED
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 8
+#define CONFIGURE_MAXIMUM_DRIVERS 16
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
+
+/* Include basic device drivers needed to call delays */
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_DISABLE_BSP_SETTINGS
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+
diff --git a/cpukit/libmisc/dummy/dummy.c b/cpukit/libmisc/dummy/dummy.c
deleted file mode 100644
index 839a556bac..0000000000
--- a/cpukit/libmisc/dummy/dummy.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Dummy configuration file
- *
- * COPYRIGHT (c) 1989-2008.
- * 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 <rtems.h>
-
-int main( int, char **, char **);
-
-/* configuration information */
-
-/* This is enough to get a basic main() up. */
-#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_MAXIMUM_TASKS 10
-#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
-#define CONFIGURE_INIT_TASK_ENTRY_POINT (void *)main
-
-/* Include basic device drivers needed to call delays */
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-
-#define CONFIGURE_DISABLE_BSP_SETTINGS
-
-#define CONFIGURE_INIT
-
-#include <rtems/confdefs.h>
-
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index 4f22ac825e..ed773c4e06 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -1,6 +1,7 @@
ACLOCAL_AMFLAGS = -I ../aclocal
_SUBDIRS = POSIX
+_SUBDIRS += defaultconfig01
_SUBDIRS += pwdgrp02
_SUBDIRS += shell01
_SUBDIRS += pwdgrp01
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index 53a017b19d..39e518fed6 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -67,6 +67,7 @@ AM_CONDITIONAL(DLTESTS,[test x"$TEST_LIBDL" = x"yes"])
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
+defaultconfig01/Makefile
pwdgrp02/Makefile
shell01/Makefile
pwdgrp01/Makefile
diff --git a/testsuites/libtests/defaultconfig01/Makefile.am b/testsuites/libtests/defaultconfig01/Makefile.am
new file mode 100644
index 0000000000..ffa894abc2
--- /dev/null
+++ b/testsuites/libtests/defaultconfig01/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = defaultconfig01
+defaultconfig01_SOURCES = init.c
+
+dist_rtems_tests_DATA = defaultconfig01.scn defaultconfig01.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 = $(defaultconfig01_OBJECTS)
+LINK_LIBS = $(defaultconfig01_LDLIBS)
+
+defaultconfig01$(EXEEXT): $(defaultconfig01_OBJECTS) $(defaultconfig01_DEPENDENCIES)
+ @rm -f defaultconfig01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/libtests/defaultconfig01/defaultconfig01.doc b/testsuites/libtests/defaultconfig01/defaultconfig01.doc
new file mode 100644
index 0000000000..532245350a
--- /dev/null
+++ b/testsuites/libtests/defaultconfig01/defaultconfig01.doc
@@ -0,0 +1,11 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: defaultconfig01
+
+directives:
+
+ - main()
+
+concepts:
+
+ - Make sure the default configuration works.
diff --git a/testsuites/libtests/defaultconfig01/defaultconfig01.scn b/testsuites/libtests/defaultconfig01/defaultconfig01.scn
new file mode 100644
index 0000000000..6f140ea53a
--- /dev/null
+++ b/testsuites/libtests/defaultconfig01/defaultconfig01.scn
@@ -0,0 +1,2 @@
+*** BEGIN OF TEST DEFAULTCONFIG 1 ***
+*** END OF TEST DEFAULTCONFIG 1 ***
diff --git a/testsuites/libtests/defaultconfig01/init.c b/testsuites/libtests/defaultconfig01/init.c
new file mode 100644
index 0000000000..21c326dcbd
--- /dev/null
+++ b/testsuites/libtests/defaultconfig01/init.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014 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 <stdio.h>
+
+#include <bsp.h>
+
+#include "tmacros.h"
+
+const char rtems_test_name[] = "DEFAULTCONFIG 1";
+
+static void install_bsp_extension(void)
+{
+#ifdef BSP_INITIAL_EXTENSION
+ static const rtems_extensions_table bsp_ext = BSP_INITIAL_EXTENSION;
+
+ rtems_status_code sc;
+ rtems_id id;
+
+ sc = rtems_extension_create(
+ rtems_build_name('B', 'S', 'P', ' '),
+ &bsp_ext,
+ &id
+ );
+ rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+#endif
+}
+
+int main(int argc, char **argv)
+{
+ int i;
+
+ TEST_BEGIN();
+
+ install_bsp_extension();
+
+ for (i = 0; i < argc; ++i) {
+ printf("argv[%i] = %s\n", i, argv[i]);
+ }
+
+ TEST_END();
+
+ return 0;
+}