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.
This commit is contained in:
Sebastian Huber
2014-12-04 09:38:27 +01:00
parent 13d9029453
commit e870941bb0
17 changed files with 202 additions and 169 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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));

View File

@@ -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

View File

@@ -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

View File

@@ -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