source: rtems/cpukit/libmisc/dummy/default-configuration.c

Last change on this file was 97236622, checked in by Joel Sherrill <joel@…>, on 03/18/22 at 15:21:52

cpukit/libmisc/dummy: Change license to BSD-2.

Updates #3053.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 *  Default configuration file
5 *
6 *  COPYRIGHT (c) 1989-2008.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in the
16 *    documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifdef HAVE_CONFIG_H
32#include "config.h"
33#endif
34
35#include <stdlib.h>
36#include <string.h>
37
38#include <rtems.h>
39
40int main( int argc, char **argv );
41
42static void Init( rtems_task_argument arg )
43{
44  const char *boot_cmdline = *((const char **) arg);
45  char       *cmdline = NULL;
46  int         argc = 0;
47  char      **argv = NULL;
48  int         result;
49
50  if ( boot_cmdline != NULL ) {
51    size_t n = strlen( boot_cmdline ) + 1;
52
53    cmdline = malloc( n );
54    if ( cmdline != NULL ) {
55      char* command;
56
57      memcpy( cmdline, boot_cmdline, n);
58
59      command = cmdline;
60
61      /*
62       * Break the line up into arguments with "" being ignored.
63       */
64      while ( true ) {
65        command = strtok( command, " \t\r\n" );
66        if ( command == NULL )
67          break;
68
69        ++argc;
70        command = '\0';
71      }
72
73      /*
74       * If there are arguments, allocate enough memory for the argv
75       * array to be passed into main().
76       *
77       * NOTE: If argc is 0, then argv will be NULL.
78       */
79      argv = calloc( argc, sizeof( *argv ) );
80      if ( argv != NULL ) {
81        int a;
82
83        command = cmdline;
84        argv[ 0 ] = command;
85
86        for ( a = 1; a < argc; ++a ) {
87          command += strlen( command ) + 1;
88          argv[ a ] = command;
89        }
90      } else {
91        argc = 0;
92      }
93    }
94  }
95
96  result = main( argc, argv );
97
98  free( argv );
99  free( cmdline );
100
101  exit( result );
102}
103
104/* configuration information */
105
106/* This is enough to get a basic main() up. */
107#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
108#define CONFIGURE_UNIFIED_WORK_AREAS
109#define CONFIGURE_STACK_CHECKER_ENABLED
110
111/* on smaller architectures lower the number or resources */
112#define CONFIGURE_UNLIMITED_OBJECTS
113#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 8
114#define CONFIGURE_MAXIMUM_DRIVERS 16
115#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32
116
117/* Include basic device drivers needed to call delays */
118#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
119#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
120
121#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
122
123#define CONFIGURE_MAXIMUM_PROCESSORS CPU_MAXIMUM_PROCESSORS
124
125#define CONFIGURE_DISABLE_BSP_SETTINGS
126
127#define CONFIGURE_INIT
128
129#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.