1 |
786 |
skrzyp |
# ====================================================================
|
2 |
|
|
#
|
3 |
|
|
# startup.cdl
|
4 |
|
|
#
|
5 |
|
|
# ISO environment startup/termination related configuration data
|
6 |
|
|
#
|
7 |
|
|
# ====================================================================
|
8 |
|
|
## ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
## -------------------------------------------
|
10 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
12 |
|
|
##
|
13 |
|
|
## eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
## the terms of the GNU General Public License as published by the Free
|
15 |
|
|
## Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
## version.
|
17 |
|
|
##
|
18 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
## for more details.
|
22 |
|
|
##
|
23 |
|
|
## You should have received a copy of the GNU General Public License
|
24 |
|
|
## along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
##
|
27 |
|
|
## As a special exception, if other files instantiate templates or use
|
28 |
|
|
## macros or inline functions from this file, or you compile this file
|
29 |
|
|
## and link it with other works to produce a work based on this file,
|
30 |
|
|
## this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
## the GNU General Public License. However the source code for this file
|
32 |
|
|
## must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
## General Public License v2.
|
34 |
|
|
##
|
35 |
|
|
## This exception does not invalidate any other reasons why a work based
|
36 |
|
|
## on this file might be covered by the GNU General Public License.
|
37 |
|
|
## -------------------------------------------
|
38 |
|
|
## ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
# ====================================================================
|
40 |
|
|
######DESCRIPTIONBEGIN####
|
41 |
|
|
#
|
42 |
|
|
# Author(s): jlarmour
|
43 |
|
|
# Contributors:
|
44 |
|
|
# Date: 2000-04-14
|
45 |
|
|
#
|
46 |
|
|
#####DESCRIPTIONEND####
|
47 |
|
|
#
|
48 |
|
|
# ====================================================================
|
49 |
|
|
|
50 |
|
|
cdl_package CYGPKG_LIBC_STARTUP {
|
51 |
|
|
display "ISO environment startup/termination"
|
52 |
|
|
description "
|
53 |
|
|
This package manages the control of the
|
54 |
|
|
environment (in the general sense) that an
|
55 |
|
|
application would require for full ISO C / POSIX
|
56 |
|
|
compatibility, including a main() entry point
|
57 |
|
|
supplied with arguments and an environment
|
58 |
|
|
(as retrievable by the getenv() function).
|
59 |
|
|
It also includes at the other end of things,
|
60 |
|
|
what happens when main() returns or exit() is
|
61 |
|
|
called."
|
62 |
|
|
doc ref/c-library-startup.html
|
63 |
|
|
include_dir cyg/libc/startup
|
64 |
|
|
parent CYGPKG_LIBC
|
65 |
|
|
requires CYGPKG_ISOINFRA
|
66 |
|
|
requires { CYGINT_LIBC_STARTUP_CONTEXT == 1 }
|
67 |
|
|
implements CYGINT_ISO_EXIT
|
68 |
|
|
implements CYGINT_ISO_MAIN_STARTUP
|
69 |
|
|
implements CYGINT_ISO_ENVIRON
|
70 |
|
|
|
71 |
|
|
compile _exit.cxx abort.cxx atexit.cxx \
|
72 |
|
|
environ.cxx exit.cxx invokemain.cxx \
|
73 |
|
|
main.cxx mainthread.cxx
|
74 |
|
|
|
75 |
|
|
compile -library=libextras.a cstartup.cxx
|
76 |
|
|
|
77 |
|
|
# ====================================================================
|
78 |
|
|
|
79 |
|
|
cdl_interface CYGINT_LIBC_STARTUP_EXTERNAL_INVOKE_MAIN_POSSIBLE {
|
80 |
|
|
display "main() can be invoked elsewhere"
|
81 |
|
|
description "Implementors of this interface show that they
|
82 |
|
|
allow main() to be invoked elsewhere."
|
83 |
|
|
flavor bool
|
84 |
|
|
no_define
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
cdl_option CYGDAT_LIBC_ARGUMENTS {
|
88 |
|
|
display "Arguments to main()"
|
89 |
|
|
flavor data
|
90 |
|
|
default_value {"{(char *)\"\", (char *)NULL}"}
|
91 |
|
|
description "
|
92 |
|
|
This option allows the setting of the arguments
|
93 |
|
|
to the main function. This only has any effect
|
94 |
|
|
when cyg_iso_c_start() is used to start the
|
95 |
|
|
ISO C compatibility. This will automatically
|
96 |
|
|
invoke main() in an ISO C compatible fashion.
|
97 |
|
|
This option is in fact used as argv, and so is
|
98 |
|
|
an n-tuple of string constants. The final
|
99 |
|
|
entry must be NULL. Conventionally if argv\[0\]
|
100 |
|
|
is supplied, it is used to inform the program
|
101 |
|
|
of its name."
|
102 |
|
|
}
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
cdl_component CYGPKG_LIBC_STARTUP_CONTEXT {
|
106 |
|
|
display "Startup context for main()"
|
107 |
|
|
flavor none
|
108 |
|
|
no_define
|
109 |
|
|
description "This component describes the options available for
|
110 |
|
|
what context main() is invoked in, such as in a thread
|
111 |
|
|
etc."
|
112 |
|
|
|
113 |
|
|
cdl_interface CYGINT_LIBC_STARTUP_CONTEXT {
|
114 |
|
|
display "Startup context implementors"
|
115 |
|
|
no_define
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
cdl_option CYGSEM_LIBC_STARTUP_MAIN_INITCONTEXT {
|
120 |
|
|
display "Invoked from initialization context"
|
121 |
|
|
description "With this option selected, main() will be
|
122 |
|
|
called via cyg_user_start() (unless the program
|
123 |
|
|
overrides the default cyg_user_start()). This
|
124 |
|
|
means it is run in the context of the system
|
125 |
|
|
initialization code, without the eCos kernel
|
126 |
|
|
scheduler running, and using the startup stack.
|
127 |
|
|
This means that any functions that may require
|
128 |
|
|
interactions with a running kernel will not
|
129 |
|
|
work (including libc functions, if configured
|
130 |
|
|
to be thread safe for example), so you should
|
131 |
|
|
restrict yourself to only calling fully
|
132 |
|
|
re-entrant functions from within main() in
|
133 |
|
|
this case."
|
134 |
|
|
flavor bool
|
135 |
|
|
default_value { 0 == CYGPKG_KERNEL && 0 ==
|
136 |
|
|
CYGINT_LIBC_STARTUP_EXTERNAL_INVOKE_MAIN_POSSIBLE }
|
137 |
|
|
implements CYGINT_LIBC_STARTUP_CONTEXT
|
138 |
|
|
implements CYGINT_LIBC_STARTUP_MAIN_NO_STACK_SIZE
|
139 |
|
|
}
|
140 |
|
|
|
141 |
|
|
cdl_component CYGSEM_LIBC_STARTUP_MAIN_THREAD {
|
142 |
|
|
display "Invoked as eCos thread"
|
143 |
|
|
requires CYGPKG_KERNEL
|
144 |
|
|
flavor bool
|
145 |
|
|
default_value { 0 != CYGPKG_KERNEL && 0 == \
|
146 |
|
|
CYGINT_LIBC_STARTUP_EXTERNAL_INVOKE_MAIN_POSSIBLE }
|
147 |
|
|
implements CYGINT_LIBC_STARTUP_CONTEXT
|
148 |
|
|
description "
|
149 |
|
|
With this option selected, main() is invoked from an eCos
|
150 |
|
|
thread."
|
151 |
|
|
|
152 |
|
|
cdl_option CYGSEM_LIBC_MAIN_STACK_FROM_SYSTEM {
|
153 |
|
|
display "System provides stack for main()'s thread"
|
154 |
|
|
description "
|
155 |
|
|
This option controls whether the stack of
|
156 |
|
|
main()'s thread is provided by the application or
|
157 |
|
|
provided by the system. When disabled, the
|
158 |
|
|
application must declare a pointer variable
|
159 |
|
|
cyg_libc_main_stack which is a pointer to an
|
160 |
|
|
appropriately aligned region of memory. The
|
161 |
|
|
application must also declare a variable of
|
162 |
|
|
type `int' called cyg_libc_main_stack_size
|
163 |
|
|
which contains the size of the stack in bytes.
|
164 |
|
|
This must be a multiple of 8."
|
165 |
|
|
flavor bool
|
166 |
|
|
default_value 1
|
167 |
|
|
}
|
168 |
|
|
|
169 |
|
|
cdl_option CYGNUM_LIBC_MAIN_THREAD_PRIORITY {
|
170 |
|
|
display "Priority of main()'s thread"
|
171 |
|
|
description "
|
172 |
|
|
This option is used to provide the thread
|
173 |
|
|
priority which main()'s thread runs at. Be
|
174 |
|
|
sure to check that this number is appropriate
|
175 |
|
|
for the kernel scheduler chosen. Different
|
176 |
|
|
kernel schedulers impose different restrictions
|
177 |
|
|
on the usable priorities."
|
178 |
|
|
flavor data
|
179 |
|
|
legal_values 0 to 0x7fffffff
|
180 |
|
|
default_value 10
|
181 |
|
|
}
|
182 |
|
|
}
|
183 |
|
|
|
184 |
|
|
cdl_option CYGSEM_LIBC_STARTUP_MAIN_OTHER {
|
185 |
|
|
display "Invoked elsewhere"
|
186 |
|
|
description "With this option selected, main() must be
|
187 |
|
|
invoked by a separate package, or by the user."
|
188 |
|
|
flavor bool
|
189 |
|
|
default_value { 0 != \
|
190 |
|
|
CYGINT_LIBC_STARTUP_EXTERNAL_INVOKE_MAIN_POSSIBLE }
|
191 |
|
|
requires CYGINT_LIBC_STARTUP_EXTERNAL_INVOKE_MAIN_POSSIBLE
|
192 |
|
|
implements CYGINT_LIBC_STARTUP_CONTEXT
|
193 |
|
|
}
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
cdl_interface CYGINT_LIBC_STARTUP_MAIN_NO_STACK_SIZE {
|
197 |
|
|
display "Don't allow main()'s stack size to be set"
|
198 |
|
|
description "This interface describes whether the stack size
|
199 |
|
|
value set in this package is supported by the
|
200 |
|
|
implementation that invokes main. If not, that
|
201 |
|
|
option is disabled."
|
202 |
|
|
flavor bool
|
203 |
|
|
no_define
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
cdl_option CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE {
|
207 |
|
|
display "main()'s default thread stack size"
|
208 |
|
|
flavor data
|
209 |
|
|
legal_values 16 to 0x7fffffff
|
210 |
|
|
default_value 8192
|
211 |
|
|
active_if !CYGINT_LIBC_STARTUP_MAIN_NO_STACK_SIZE
|
212 |
|
|
description "
|
213 |
|
|
This option sets the size of the stack used
|
214 |
|
|
in the context that invokes main(). For example,
|
215 |
|
|
with an eCos kernel, when the cyg_iso_c_start()
|
216 |
|
|
function is used to invoke the user-supplied
|
217 |
|
|
main() function in an ISO C compatible fashion,
|
218 |
|
|
a separate thread is created to call main().
|
219 |
|
|
This option controls the size of that thread's
|
220 |
|
|
stack, which is allocated in the BSS. It
|
221 |
|
|
must be a multiple of 8. Note, a low number
|
222 |
|
|
here may be overriden by the HAL if there is
|
223 |
|
|
a minimum requirement to process interrupts
|
224 |
|
|
etc. This option cannot be set if the implementation
|
225 |
|
|
that invokes main() does not use it."
|
226 |
|
|
}
|
227 |
|
|
|
228 |
|
|
cdl_component CYGFUN_LIBC_ATEXIT {
|
229 |
|
|
display "Include atexit() function"
|
230 |
|
|
flavor bool
|
231 |
|
|
default_value 1
|
232 |
|
|
description "
|
233 |
|
|
This option enables the use of the atexit()
|
234 |
|
|
function, and ensure that the atexit handlers
|
235 |
|
|
are invoked from within exit() as defined in
|
236 |
|
|
the ISO C standard."
|
237 |
|
|
|
238 |
|
|
cdl_option CYGNUM_LIBC_ATEXIT_HANDLERS {
|
239 |
|
|
display "Number of functions atexit() supports"
|
240 |
|
|
flavor data
|
241 |
|
|
legal_values 1 to 0x7fffffff
|
242 |
|
|
default_value 32
|
243 |
|
|
description "
|
244 |
|
|
This option sets the number of functions
|
245 |
|
|
that atexit() has room for. In other words,
|
246 |
|
|
the number of separate atexit() calls that
|
247 |
|
|
can be made before calling exit() or returning
|
248 |
|
|
from main() ( in an environment controlled by
|
249 |
|
|
cyg_iso_c_start() ). For strict compliance
|
250 |
|
|
with the ISO C standard this should be at
|
251 |
|
|
least 32."
|
252 |
|
|
}
|
253 |
|
|
}
|
254 |
|
|
|
255 |
|
|
cdl_option CYGSEM_LIBC_EXIT_CALLS_FFLUSH {
|
256 |
|
|
display "Make exit() call fflush()"
|
257 |
|
|
requires CYGINT_ISO_STDIO_FILEACCESS
|
258 |
|
|
default_value { 0 != CYGINT_ISO_STDIO_FILEACCESS }
|
259 |
|
|
description "
|
260 |
|
|
This option will ensure that all output
|
261 |
|
|
streams are flushed when exitting using
|
262 |
|
|
exit() as prescribed by the ISO C standard."
|
263 |
|
|
}
|
264 |
|
|
|
265 |
|
|
cdl_option CYGSEM_LIBC_EXIT_STOPS_SYSTEM {
|
266 |
|
|
display "_exit() stops all threads"
|
267 |
|
|
requires CYGPKG_KERNEL
|
268 |
|
|
default_value 0
|
269 |
|
|
description "
|
270 |
|
|
If this option is enabled then _exit(),
|
271 |
|
|
which is called from exit() which itself is
|
272 |
|
|
called on return from main(), stops the eCos
|
273 |
|
|
scheduler. For strict POSIX 1003.1
|
274 |
|
|
compatibility this would be the normal
|
275 |
|
|
behaviour. To allow the thread to simply
|
276 |
|
|
exit, without affecting other threads, simply
|
277 |
|
|
leave this option disabled. If there is no eCos
|
278 |
|
|
scheduler, then _exit() simply loops
|
279 |
|
|
irrespective of the setting of this option."
|
280 |
|
|
}
|
281 |
|
|
|
282 |
|
|
cdl_option CYGDAT_LIBC_DEFAULT_ENVIRONMENT {
|
283 |
|
|
display "Default environment"
|
284 |
|
|
flavor data
|
285 |
|
|
default_value {"{ NULL }"}
|
286 |
|
|
description "
|
287 |
|
|
This option allows the setting of the default
|
288 |
|
|
contents of the environment. This is in fact
|
289 |
|
|
the contents of the global environment pointer
|
290 |
|
|
char **environ defined by POSIX 1003.1. Strings
|
291 |
|
|
must be of the form NAME=VALUE, and the final
|
292 |
|
|
entry must be NULL."
|
293 |
|
|
}
|
294 |
|
|
|
295 |
|
|
cdl_option CYGSEM_LIBC_INVOKE_DEFAULT_STATIC_CONSTRUCTORS {
|
296 |
|
|
display "Invoke default static constructors"
|
297 |
|
|
requires CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
|
298 |
|
|
requires { CYGSEM_LIBC_STARTUP_MAIN_THREAD || \
|
299 |
|
|
(CYGSEM_LIBC_STARTUP_MAIN_OTHER && CYGPKG_POSIX_PTHREAD) }
|
300 |
|
|
default_value 0
|
301 |
|
|
description "
|
302 |
|
|
This option causes the C library to call
|
303 |
|
|
static constructors with default priority
|
304 |
|
|
from within the context of the main() thread,
|
305 |
|
|
working with the co-operation of the HAL.
|
306 |
|
|
This may be needed for environments that
|
307 |
|
|
expect static constructors to be run in a
|
308 |
|
|
thread context. Note that this uses an object
|
309 |
|
|
with priority 65534. Therefore do not use
|
310 |
|
|
priority 65534 for any other static objects
|
311 |
|
|
with this option enabled."
|
312 |
|
|
}
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
# ====================================================================
|
316 |
|
|
|
317 |
|
|
cdl_component CYGPKG_LIBC_STARTUP_OPTIONS {
|
318 |
|
|
display "ISO environment startup/termination build options"
|
319 |
|
|
flavor none
|
320 |
|
|
no_define
|
321 |
|
|
description "
|
322 |
|
|
Package specific build options including control over
|
323 |
|
|
compiler flags used only in building this package,
|
324 |
|
|
and details of which tests are built."
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
cdl_option CYGPKG_LIBC_STARTUP_CFLAGS_ADD {
|
328 |
|
|
display "Additional compiler flags"
|
329 |
|
|
flavor data
|
330 |
|
|
no_define
|
331 |
|
|
default_value { "" }
|
332 |
|
|
description "
|
333 |
|
|
This option modifies the set of compiler flags for
|
334 |
|
|
building this package. These flags are used in addition
|
335 |
|
|
to the set of global flags."
|
336 |
|
|
}
|
337 |
|
|
|
338 |
|
|
cdl_option CYGPKG_LIBC_STARTUP_CFLAGS_REMOVE {
|
339 |
|
|
display "Suppressed compiler flags"
|
340 |
|
|
flavor data
|
341 |
|
|
no_define
|
342 |
|
|
default_value { "" }
|
343 |
|
|
description "
|
344 |
|
|
This option modifies the set of compiler flags for
|
345 |
|
|
building this package. These flags are removed from
|
346 |
|
|
the set of global flags if present."
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
cdl_option CYGPKG_LIBC_STARTUP_TESTS {
|
350 |
|
|
display "ISO environment startup/termination tests"
|
351 |
|
|
flavor data
|
352 |
|
|
no_define
|
353 |
|
|
calculated { "tests/atexit" }
|
354 |
|
|
description "
|
355 |
|
|
This option specifies the set of tests for this package."
|
356 |
|
|
}
|
357 |
|
|
}
|
358 |
|
|
}
|
359 |
|
|
|
360 |
|
|
# ====================================================================
|
361 |
|
|
# EOF startup.cdl
|