[e870941] | 1 | /* |
---|
| 2 | * Default configuration file |
---|
| 3 | * |
---|
| 4 | * COPYRIGHT (c) 1989-2008. |
---|
| 5 | * On-Line Applications Research Corporation (OAR). |
---|
| 6 | * |
---|
| 7 | * The license and distribution terms for this file may be |
---|
| 8 | * found in the file LICENSE in this distribution or at |
---|
| 9 | * http://www.rtems.org/license/LICENSE. |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | #ifdef HAVE_CONFIG_H |
---|
| 13 | #include "config.h" |
---|
| 14 | #endif |
---|
| 15 | |
---|
| 16 | #include <stdlib.h> |
---|
[b2ed712] | 17 | #include <string.h> |
---|
[e870941] | 18 | |
---|
| 19 | #include <rtems.h> |
---|
| 20 | |
---|
| 21 | int main( int argc, char **argv ); |
---|
| 22 | |
---|
| 23 | static void Init( rtems_task_argument arg ) |
---|
| 24 | { |
---|
| 25 | const char *boot_cmdline = *((const char **) arg); |
---|
| 26 | char *cmdline = NULL; |
---|
| 27 | int argc = 0; |
---|
| 28 | char **argv = NULL; |
---|
| 29 | int result; |
---|
| 30 | |
---|
| 31 | if ( boot_cmdline != NULL ) { |
---|
| 32 | size_t n = strlen( boot_cmdline ) + 1; |
---|
| 33 | |
---|
| 34 | cmdline = malloc( n ); |
---|
| 35 | if ( cmdline != NULL ) { |
---|
| 36 | char* command; |
---|
| 37 | |
---|
| 38 | memcpy( cmdline, boot_cmdline, n); |
---|
| 39 | |
---|
| 40 | command = cmdline; |
---|
| 41 | |
---|
| 42 | /* |
---|
| 43 | * Break the line up into arguments with "" being ignored. |
---|
| 44 | */ |
---|
| 45 | while ( true ) { |
---|
| 46 | command = strtok( command, " \t\r\n" ); |
---|
| 47 | if ( command == NULL ) |
---|
| 48 | break; |
---|
| 49 | |
---|
| 50 | ++argc; |
---|
| 51 | command = '\0'; |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | /* |
---|
| 55 | * If there are arguments, allocate enough memory for the argv |
---|
| 56 | * array to be passed into main(). |
---|
| 57 | * |
---|
| 58 | * NOTE: If argc is 0, then argv will be NULL. |
---|
| 59 | */ |
---|
| 60 | argv = calloc( argc, sizeof( *argv ) ); |
---|
| 61 | if ( argv != NULL ) { |
---|
| 62 | int a; |
---|
| 63 | |
---|
| 64 | command = cmdline; |
---|
| 65 | argv[ 0 ] = command; |
---|
| 66 | |
---|
| 67 | for ( a = 1; a < argc; ++a ) { |
---|
| 68 | command += strlen( command ) + 1; |
---|
| 69 | argv[ a ] = command; |
---|
| 70 | } |
---|
| 71 | } else { |
---|
| 72 | argc = 0; |
---|
| 73 | } |
---|
| 74 | } |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | result = main( argc, argv ); |
---|
| 78 | |
---|
| 79 | free( argv ); |
---|
| 80 | free( cmdline ); |
---|
| 81 | |
---|
| 82 | exit( result ); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | /* configuration information */ |
---|
| 86 | |
---|
| 87 | /* This is enough to get a basic main() up. */ |
---|
| 88 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
| 89 | #define CONFIGURE_UNIFIED_WORK_AREAS |
---|
| 90 | #define CONFIGURE_STACK_CHECKER_ENABLED |
---|
[54bfbe0] | 91 | |
---|
| 92 | /* on smaller architectures lower the number or resources */ |
---|
[bfcf1473] | 93 | #define CONFIGURE_UNLIMITED_OBJECTS |
---|
| 94 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 8 |
---|
| 95 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
---|
| 96 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
---|
[e870941] | 97 | |
---|
| 98 | /* Include basic device drivers needed to call delays */ |
---|
| 99 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
| 100 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
| 101 | |
---|
[cc3edaa] | 102 | #define CONFIGURE_MAXIMUM_PROCESSORS CPU_MAXIMUM_PROCESSORS |
---|
[8406d94] | 103 | |
---|
[e870941] | 104 | #define CONFIGURE_DISABLE_BSP_SETTINGS |
---|
| 105 | |
---|
| 106 | #define CONFIGURE_INIT |
---|
| 107 | |
---|
| 108 | #include <rtems/confdefs.h> |
---|
| 109 | |
---|