Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:18

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  *  Default configuration file
0005  *
0006  *  COPYRIGHT (c) 1989-2008.
0007  *  On-Line Applications Research Corporation (OAR).
0008  *
0009  * Redistribution and use in source and binary forms, with or without
0010  * modification, are permitted provided that the following conditions
0011  * are met:
0012  * 1. Redistributions of source code must retain the above copyright
0013  *    notice, this list of conditions and the following disclaimer.
0014  * 2. Redistributions in binary form must reproduce the above copyright
0015  *    notice, this list of conditions and the following disclaimer in the
0016  *    documentation and/or other materials provided with the distribution.
0017  *
0018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0019  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0021  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0022  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0023  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0024  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0025  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0026  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0027  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0028  * POSSIBILITY OF SUCH DAMAGE.
0029  */
0030 
0031 #ifdef HAVE_CONFIG_H
0032 #include "config.h"
0033 #endif
0034 
0035 #include <stdlib.h>
0036 #include <string.h>
0037 
0038 #include <rtems.h>
0039 
0040 int main( int argc, char **argv );
0041 
0042 static void Init( rtems_task_argument arg )
0043 {
0044   const char *boot_cmdline = *((const char **) arg);
0045   char       *cmdline = NULL;
0046   int         argc = 0;
0047   char      **argv = NULL;
0048   int         result;
0049 
0050   if ( boot_cmdline != NULL ) {
0051     size_t n = strlen( boot_cmdline ) + 1;
0052 
0053     cmdline = malloc( n );
0054     if ( cmdline != NULL ) {
0055       char* command;
0056 
0057       memcpy( cmdline, boot_cmdline, n);
0058 
0059       command = cmdline;
0060 
0061       /*
0062        * Break the line up into arguments with "" being ignored.
0063        */
0064       while ( true ) {
0065         command = strtok( command, " \t\r\n" );
0066         if ( command == NULL )
0067           break;
0068 
0069         ++argc;
0070         command = '\0';
0071       }
0072 
0073       /*
0074        * If there are arguments, allocate enough memory for the argv
0075        * array to be passed into main().
0076        *
0077        * NOTE: If argc is 0, then argv will be NULL.
0078        */
0079       argv = calloc( argc, sizeof( *argv ) );
0080       if ( argv != NULL ) {
0081         int a;
0082 
0083         command = cmdline;
0084         argv[ 0 ] = command;
0085 
0086         for ( a = 1; a < argc; ++a ) {
0087           command += strlen( command ) + 1;
0088           argv[ a ] = command;
0089         }
0090       } else {
0091         argc = 0;
0092       }
0093     }
0094   }
0095 
0096   result = main( argc, argv );
0097 
0098   free( argv );
0099   free( cmdline );
0100 
0101   exit( result );
0102 }
0103 
0104 /* configuration information */
0105 
0106 /* This is enough to get a basic main() up. */
0107 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
0108 #define CONFIGURE_UNIFIED_WORK_AREAS
0109 #define CONFIGURE_STACK_CHECKER_ENABLED
0110 
0111 /* on smaller architectures lower the number or resources */
0112 #define CONFIGURE_UNLIMITED_OBJECTS
0113 #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 8
0114 #define CONFIGURE_MAXIMUM_DRIVERS 16
0115 #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 32
0116 
0117 /* Include basic device drivers needed to call delays */
0118 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
0119 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
0120 
0121 #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
0122 
0123 #define CONFIGURE_MAXIMUM_PROCESSORS CPU_MAXIMUM_PROCESSORS
0124 
0125 #define CONFIGURE_DISABLE_BSP_SETTINGS
0126 
0127 #define CONFIGURE_INIT
0128 
0129 #include <rtems/confdefs.h>