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> |
---|
17 | |
---|
18 | #include <rtems.h> |
---|
19 | |
---|
20 | int main( int argc, char **argv ); |
---|
21 | |
---|
22 | static void Init( rtems_task_argument arg ) |
---|
23 | { |
---|
24 | const char *boot_cmdline = *((const char **) arg); |
---|
25 | char *cmdline = NULL; |
---|
26 | int argc = 0; |
---|
27 | char **argv = NULL; |
---|
28 | int result; |
---|
29 | |
---|
30 | if ( boot_cmdline != NULL ) { |
---|
31 | size_t n = strlen( boot_cmdline ) + 1; |
---|
32 | |
---|
33 | cmdline = malloc( n ); |
---|
34 | if ( cmdline != NULL ) { |
---|
35 | char* command; |
---|
36 | |
---|
37 | memcpy( cmdline, boot_cmdline, n); |
---|
38 | |
---|
39 | command = cmdline; |
---|
40 | |
---|
41 | /* |
---|
42 | * Break the line up into arguments with "" being ignored. |
---|
43 | */ |
---|
44 | while ( true ) { |
---|
45 | command = strtok( command, " \t\r\n" ); |
---|
46 | if ( command == NULL ) |
---|
47 | break; |
---|
48 | |
---|
49 | ++argc; |
---|
50 | command = '\0'; |
---|
51 | } |
---|
52 | |
---|
53 | /* |
---|
54 | * If there are arguments, allocate enough memory for the argv |
---|
55 | * array to be passed into main(). |
---|
56 | * |
---|
57 | * NOTE: If argc is 0, then argv will be NULL. |
---|
58 | */ |
---|
59 | argv = calloc( argc, sizeof( *argv ) ); |
---|
60 | if ( argv != NULL ) { |
---|
61 | int a; |
---|
62 | |
---|
63 | command = cmdline; |
---|
64 | argv[ 0 ] = command; |
---|
65 | |
---|
66 | for ( a = 1; a < argc; ++a ) { |
---|
67 | command += strlen( command ) + 1; |
---|
68 | argv[ a ] = command; |
---|
69 | } |
---|
70 | } else { |
---|
71 | argc = 0; |
---|
72 | } |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | result = main( argc, argv ); |
---|
77 | |
---|
78 | free( argv ); |
---|
79 | free( cmdline ); |
---|
80 | |
---|
81 | exit( result ); |
---|
82 | } |
---|
83 | |
---|
84 | /* configuration information */ |
---|
85 | |
---|
86 | /* This is enough to get a basic main() up. */ |
---|
87 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
88 | #define CONFIGURE_UNIFIED_WORK_AREAS |
---|
89 | #define CONFIGURE_STACK_CHECKER_ENABLED |
---|
90 | |
---|
91 | /* on smaller architectures lower the number or resources */ |
---|
92 | #if defined(__m32c__) |
---|
93 | #define CONFIGURE_MAXIMUM_TASKS 3 |
---|
94 | #else |
---|
95 | #define CONFIGURE_UNLIMITED_OBJECTS |
---|
96 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 8 |
---|
97 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
---|
98 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
---|
99 | #endif |
---|
100 | |
---|
101 | /* Include basic device drivers needed to call delays */ |
---|
102 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
103 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
104 | |
---|
105 | #define CONFIGURE_DISABLE_BSP_SETTINGS |
---|
106 | |
---|
107 | #define CONFIGURE_INIT |
---|
108 | |
---|
109 | #include <rtems/confdefs.h> |
---|
110 | |
---|