OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [user-guide/] [editing-an-ecos-savefile.html] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2
<!-- This material may be distributed only subject to the terms      -->
3
<!-- and conditions set forth in the Open Publication License, v1.0  -->
4
<!-- or later (the latest version is presently available at          -->
5
<!-- http://www.opencontent.org/openpub/).                           -->
6
<!-- Distribution of the work or derivative of the work in any       -->
7
<!-- standard (paper) book form is prohibited unless prior           -->
8
<!-- permission is obtained from the copyright holder.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>Editing an eCos Savefile</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos User Guide"
20
HREF="ecos-user-guide.html"><LINK
21
REL="UP"
22
TITLE="Manual Configuration"
23
HREF="manual-configuration.html"><LINK
24
REL="PREVIOUS"
25
TITLE="Fine-grained Configuration"
26
HREF="fine-grained-configuration.html"><LINK
27
REL="NEXT"
28
TITLE="Editing the Sources"
29
HREF="editing-the-sources.html"></HEAD
30
><BODY
31
CLASS="SECT1"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos User Guide</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="fine-grained-configuration.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
>Chapter 28. Manual Configuration</TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="editing-the-sources.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="SECT1"
82
><H1
83
CLASS="SECT1"
84
><A
85
NAME="EDITING-AN-ECOS-SAVEFILE">Editing an <SPAN
86
CLASS="PRODUCTNAME"
87
>eCos</SPAN
88
> Savefile</H1
89
><P
90
>The <SPAN
91
CLASS="PRODUCTNAME"
92
>eCos</SPAN
93
> configuration information is held in a single
94
          savefile, typically <TT
95
CLASS="FILENAME"
96
>ecos.ecc</TT
97
>, which can
98
          be generated by either the GUI configuration tool or by the
99
          command line <B
100
CLASS="COMMAND"
101
>ecosconfig</B
102
> tool. The file
103
          normally exists at the top level of the build tree. It is a
104
          text file, allowing the various configurations options to be
105
          edited inside a suitable text editor or by other programs or
106
          scripts, as well as in the GUI config tool.</P
107
><P
108
>An <SPAN
109
CLASS="PRODUCTNAME"
110
>eCos</SPAN
111
> savefile is actually a script in the <SPAN
112
CLASS="emphasis"
113
><I
114
CLASS="EMPHASIS"
115
>Tcl</I
116
></SPAN
117
> programming
118
language, so any modifications to the file need to preserve Tcl
119
syntax. For most configuration options, any modifications will be
120
trivial and there is no need to worry about Tcl syntax. For example,
121
changing a 1 to a 0 to disable an option.  For more complicated
122
options, for example<TT
123
CLASS="LITERAL"
124
> CYGDAT_UITRON_TASK_EXTERNS</TT
125
>,
126
which involves some lines of C code, more care has
127
to be taken. If an edited savefile is no longer a valid Tcl script
128
then the configuration tools will be unable to read back the data
129
for further processing, for example to generate a build tree. An
130
outline of Tcl syntax is given below. One point worth noting here
131
is that a line that begins with a &#8220;#&#8221; is
132
usually a comment, and the bulk of an <SPAN
133
CLASS="PRODUCTNAME"
134
>eCos</SPAN
135
> savefile actually consists
136
of such comments, to make it easier to edit.</P
137
><DIV
138
CLASS="SECT2"
139
><H2
140
CLASS="SECT2"
141
><A
142
NAME="AEN2721">Header</H2
143
><P
144
>An <SPAN
145
CLASS="PRODUCTNAME"
146
>eCos</SPAN
147
> savefile begins with a header, which typically
148
            looks something like this:</P
149
><TABLE
150
BORDER="5"
151
BGCOLOR="#E0E0F0"
152
WIDTH="70%"
153
><TR
154
><TD
155
><PRE
156
CLASS="SCREEN"
157
># eCos saved configuration
158
# ---- commands --------------------------------------------------------
159
# This section contains information about the savefile format.
160
# It should not be edited. Any modifications made to this section
161
# may make it impossible for the configuration tools to read
162
# the savefile.
163
 
164
cdl_savefile_version 1;
165
cdl_savefile_command cdl_savefile_version {};
166
cdl_savefile_command cdl_savefile_command {};
167
cdl_savefile_command
168
cdl_configuration { description hardware template package };
169
cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value };
170
cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value };
171
cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value };
172
cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value };
173
      </PRE
174
></TD
175
></TR
176
></TABLE
177
><P
178
>This section of the savefile is intended for use by the
179
        configuration system, and should not be edited. If this
180
        section is edited then the various configuration tools may no
181
        longer be able to read in the modified savefile.</P
182
></DIV
183
><DIV
184
CLASS="SECT2"
185
><H2
186
CLASS="SECT2"
187
><A
188
NAME="AEN2727">Toplevel Section</H2
189
><P
190
>The header is followed by a section that defines the
191
            configuration as a whole. A typical example would
192
            be:</P
193
><TABLE
194
BORDER="5"
195
BGCOLOR="#E0E0F0"
196
WIDTH="70%"
197
><TR
198
><TD
199
><PRE
200
CLASS="SCREEN"
201
># ---- toplevel --------------------------------------------------------
202
# This section defines the toplevel configuration object. The only
203
# values that can be changed are the name of the configuration and
204
# the description field. It is not possible to modify the target,
205
# the template or the set of packages simply by editing the lines
206
# below because these changes have wide-ranging effects. Instead
207
# the appropriate tools should be used to make such modifications.
208
 
209
cdl_configuration eCos {
210
description &#8220;&#8220; ;
211
 
212
# These fields should not be modified.
213
hardware    pid ;
214
template    uitron ;
215
package -hardware CYGPKG_HAL_ARM current ;
216
package -hardware CYGPKG_HAL_ARM_PID current ;
217
package -hardware CYGPKG_IO_SERIAL current ;
218
package -template CYGPKG_HAL current ;
219
package -template CYGPKG_IO current ;
220
package -template CYGPKG_INFRA current ;
221
package -template CYGPKG_KERNEL current ;
222
package -template CYGPKG_UITRON current ;
223
package -template CYGPKG_LIBC current ;
224
package -template CYGPKG_LIBM current ;
225
package -template CYGPKG_DEVICES_WALLCLOCK current ;
226
package -template CYGPKG_ERROR current ;
227
};
228
      </PRE
229
></TD
230
></TR
231
></TABLE
232
><P
233
>This section allows the configuration tools to reload the
234
various packages that make up the configuration. Most of the information
235
should not be edited. If it is necessary to add a new package or
236
to remove an existing one then the appropriate tools should be used
237
for this, for example:</P
238
><TABLE
239
BORDER="5"
240
BGCOLOR="#E0E0F0"
241
WIDTH="70%"
242
><TR
243
><TD
244
><PRE
245
CLASS="PROGRAMLISTING"
246
>$ ecosconfig remove CYGPKG_LIBM</PRE
247
></TD
248
></TR
249
></TABLE
250
><P
251
>There are two fields which can be edited. Configurations have
252
a name; in this case <SPAN
253
CLASS="PRODUCTNAME"
254
>eCos</SPAN
255
>. They can also have a description, which
256
is some arbitrary text. The configuration tools do not make use
257
of these fields, they exist so that users can store additional information
258
about a configuration.</P
259
></DIV
260
><DIV
261
CLASS="SECT2"
262
><H2
263
CLASS="SECT2"
264
><A
265
NAME="AEN2735">Conflicts Section</H2
266
><P
267
>The toplevel section is followed by details of all the
268
            conflicts (if any) in the configuration, for
269
            example:</P
270
><TABLE
271
BORDER="5"
272
BGCOLOR="#E0E0F0"
273
WIDTH="70%"
274
><TR
275
><TD
276
><PRE
277
CLASS="SCREEN"
278
># ---- conflicts -------------------------------------------------------
279
# There are 2 conflicts.
280
#
281
# option CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET
282
#   Property LegalValues
283
#   Illegal current value 100000
284
#   Legal values are: -90000 to 90000
285
#
286
# option CYGSEM_LIBC_TIME_CLOCK_WORKING
287
#   Property Requires
288
#   Requires constraint not satisfied: CYGFUN_KERNEL_THREADS_TIMER
289
          </PRE
290
></TD
291
></TR
292
></TABLE
293
><P
294
>When editing a configuration you may end up with something
295
that is invalid. Any problems in the configuration will be reported
296
in the conflicts section. In this case there are two conflicts.
297
The option <TT
298
CLASS="LITERAL"
299
>CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET</TT
300
> has
301
been given an illegal value: typically this would be fixed by searching
302
for the definition of that option later on in the savefile and modifying
303
the value. The second conflict is more interesting, an unsatisfied <SPAN
304
CLASS="emphasis"
305
><I
306
CLASS="EMPHASIS"
307
>requires</I
308
></SPAN
309
> constraint.
310
Configuration options are not independent: disabling some functionality
311
in, say, the kernel, can have an impact elsewhere; in this case
312
the C library. The various dependencies between the options are
313
specified by the component developers and checked by the configuration
314
system. In this case there are two obvious ways in which the conflict could
315
be resolved: re-enabling <TT
316
CLASS="LITERAL"
317
>CYGFUN_KERNEL_THREADS_TIMER</TT
318
>,
319
or disabling <TT
320
CLASS="LITERAL"
321
>CYGSEM_LIBC_TIME_CLOCK_WORKING</TT
322
>.
323
Both of these options will be listed later on in the file.</P
324
><P
325
>Some care has to be taken when modifying configuration options,
326
to avoid introducing new conflict. For instance it is possible that
327
there might be other options in the system which have a dependency
328
on <TT
329
CLASS="LITERAL"
330
>CYGSEM_LIBC_TIME_CLOCK_WORKING</TT
331
>,
332
so disabling that option may not be the best way to resolve the
333
conflict. Details of all such dependencies are provided in the appropriate
334
places in the savefile.</P
335
><P
336
>It is not absolutely required that a configuration be conflict-free
337
before generating a build tree and building <SPAN
338
CLASS="PRODUCTNAME"
339
>eCos</SPAN
340
>. It is up to the
341
developers of each component to decide what would happen if an attempt
342
is made to build <SPAN
343
CLASS="PRODUCTNAME"
344
>eCos</SPAN
345
> while there are still conflicts. In serious
346
cases there is likely to be a compile-time failure, or possibly
347
a link-time failure. In less serious cases the system may build
348
happily and the application can be linked with the resulting library,
349
but the component may not quite function as intended - although
350
it may still be good enough for the specific needs of the application.
351
It is also possible that everything builds and links, but once in
352
a while the system will unaccountably crash. Using a configuration
353
that still has conflicts is done entirely at the user&#8217;s
354
risk.</P
355
></DIV
356
><DIV
357
CLASS="SECT2"
358
><H2
359
CLASS="SECT2"
360
><A
361
NAME="AEN2749">Data Section</H2
362
><P
363
>The bulk of the savefile lists the various packages,
364
            components, and options, including their values and the
365
            various dependencies. A number of global options come
366
            first, especially those related to the build process such
367
            as compiler flags. These are followed by the various
368
            packages, and the components and options within those
369
            packages, in order.</P
370
><P
371
>Packages, components and options are organized in a
372
            hierarchy. If a particular component is disabled then all
373
            options and sub-components below it will be inactive: any
374
            changes made to these will have no effect. The savefile
375
            contains information about the hierarchy in the form of
376
            comments, for example:</P
377
><TABLE
378
BORDER="5"
379
BGCOLOR="#E0E0F0"
380
WIDTH="70%"
381
><TR
382
><TD
383
><PRE
384
CLASS="SCREEN"
385
>cdl_package CYGPKG_KERNEL ...
386
# &gt;
387
cdl_component CYGPKG_KERNEL_EXCEPTIONS ...
388
# &gt;
389
cdl_option CYGSEM_KERNEL_EXCEPTIONS_DECODE ...
390
cdl_option CYGSEM_KERNEL_EXCEPTIONS_GLOBAL ...
391
# &lt;
392
cdl_component CYGPKG_KERNEL_SCHED ...
393
# &gt;
394
cdl_option CYGSEM_KERNEL_SCHED_MLQUEUE ...
395
cdl_option CYGSEM_KERNEL_SCHED_BITMAP ...
396
# &lt;
397
# &lt;
398
          </PRE
399
></TD
400
></TR
401
></TABLE
402
><P
403
>This corresponds to the following hierarchy:</P
404
><TABLE
405
BORDER="5"
406
BGCOLOR="#E0E0F0"
407
WIDTH="70%"
408
><TR
409
><TD
410
><PRE
411
CLASS="SCREEN"
412
> CYGPKG_KERNEL
413
   CYGPKG_KERNEL_EXCEPTIONS
414
     CYGSEM_KERNEL_EXCEPTIONS_DECODE
415
     CYGSEM_KERNEL_EXCEPTIONS_GLOBAL
416
   CYGPKG_KERNEL_SCHED
417
     CYGSEM_KERNEL_SCHED_MLQUEUE
418
     CYGSEM_KERNEL_SCHED_BITMAP
419
          </PRE
420
></TD
421
></TR
422
></TABLE
423
><P
424
>Providing the hierarchy information in this way allows
425
            programs or scripts to analyze the savefile and readily
426
            determine the hierarchy. It could also be used by a
427
            sufficiently powerful editor to support structured editing
428
            of <SPAN
429
CLASS="PRODUCTNAME"
430
>eCos</SPAN
431
> savefiles. The information is not used by the
432
            configuration tools themselves since they obtain the
433
            hierarchy from the original CDL scripts.</P
434
><P
435
>Each configurable entity is preceded by a comment, of
436
            the following form:</P
437
><TABLE
438
BORDER="5"
439
BGCOLOR="#E0E0F0"
440
WIDTH="70%"
441
><TR
442
><TD
443
><PRE
444
CLASS="SCREEN"
445
># Kernel schedulers
446
# doc: ref/ecos-ref/ecos-kernel-overview.html#THE-SCHEDULER
447
# The eCos kernel provides a choice of schedulers. In addition
448
# there are a number of configuration options to control the
449
# detailed behaviour of these schedulers.
450
cdl_component CYGPKG_KERNEL_SCHED {
451
...
452
};
453
          </PRE
454
></TD
455
></TR
456
></TABLE
457
><P
458
>This provides a short textual alias
459
            <TT
460
CLASS="LITERAL"
461
>Kernel schedulers</TT
462
> for the
463
            component. If online documentation is available for the
464
            configurable entity then this will come next. Finally
465
            there is a short description of the entity as a whole. All
466
            this information is provided by the component
467
            developers.</P
468
><P
469
>Each configurable entity takes the form:</P
470
><TABLE
471
BORDER="5"
472
BGCOLOR="#E0E0F0"
473
WIDTH="70%"
474
><TR
475
><TD
476
><PRE
477
CLASS="SCREEN"
478
>&lt;type&gt; &lt;name&gt; {
479
     &lt;data&gt;
480
};</PRE
481
></TD
482
></TR
483
></TABLE
484
><P
485
>Configurable entities may not be active. This can be either
486
because the parent is disabled or inactive, or because there are
487
one or more <SPAN
488
CLASS="emphasis"
489
><I
490
CLASS="EMPHASIS"
491
>active_if</I
492
></SPAN
493
> properties. Modifying
494
the value of an inactive entity has no effect on the configuration,
495
so this information is provided first:</P
496
><P
497
></P
498
><TABLE
499
BORDER="5"
500
BGCOLOR="#E0E0F0"
501
WIDTH="70%"
502
><TR
503
><TD
504
><PRE
505
CLASS="SCREEN"
506
>cdl_option CYGSEM_KERNEL_EXCEPTIONS_DECODE {
507
# This option is not active
508
# The parent CYGPKG_KERNEL_EXCEPTIONS is disabled
509
...
510
};
511
 
512
...
513
 
514
cdl_option CYGIMP_IDLE_THREAD_YIELD {
515
# This option is not active
516
# ActiveIf constraint: (CYGNUM_KERNEL_SCHED_PRIORITIES == 1)
517
#     CYGNUM_KERNEL_SCHED_PRIORITIES == 32
518
#   --&gt; 0
519
...
520
}; &#13;</PRE
521
></TD
522
></TR
523
></TABLE
524
><P
525
>For <TT
526
CLASS="LITERAL"
527
>CYGIMP_IDLE_THREAD_YIELD</TT
528
> the
529
savefile lists the expression that must be satisfied if the option
530
is to be active, followed by the current value of all entities that
531
are referenced in the expression, and finally the result of evaluating
532
that expression.</P
533
><P
534
>Not all options are directly modifiable in the savefile. First,
535
the value of packages (which is the version of that package loaded
536
into the configuration) cannot be modified here.</P
537
><TABLE
538
BORDER="5"
539
BGCOLOR="#E0E0F0"
540
WIDTH="70%"
541
><TR
542
><TD
543
><PRE
544
CLASS="SCREEN"
545
>&#13;cdl_package CYGPKG_KERNEL {
546
# Packages cannot be added or removed, nor can their version be changed,
547
# simply by editing their value. Instead the appropriate configuration
548
# should be used to perform these actions.
549
...
550
};&#13;</PRE
551
></TD
552
></TR
553
></TABLE
554
><P
555
>The version of a package can be changed using e.g.:    </P
556
><TABLE
557
BORDER="5"
558
BGCOLOR="#E0E0F0"
559
WIDTH="70%"
560
><TR
561
><TD
562
><PRE
563
CLASS="SCREEN"
564
>$ ecosconfig version 1.3 CYGPKG_KERNEL</PRE
565
></TD
566
></TR
567
></TABLE
568
><P
569
>Even though a package&#8217;s value cannot be modified
570
here, it is still important for the savefile to contain the details.
571
In particular packages may impose constraints on other configurable
572
entities and may be referenced by other configurable entities. Also
573
it would be difficult to understand or extract the configuration&#8217;s
574
hierarchy if the packages were not listed in the appropriate places
575
in the savefile.</P
576
><P
577
>Some components (or, conceivably, options) do not have any
578
associated data. Typically they serve only to introduce another
579
level in the hierarchy, which can be useful in the context of the
580
GUI configuration tool.</P
581
><TABLE
582
BORDER="5"
583
BGCOLOR="#E0E0F0"
584
WIDTH="70%"
585
><TR
586
><TD
587
><PRE
588
CLASS="SCREEN"
589
>&#13;cdl_component CYGPKG_HAL_COMMON_INTERRUPTS {
590
# There is no associated value.
591
}; &#13;</PRE
592
></TD
593
></TR
594
></TABLE
595
><P
596
>Other components or options have a calculated value. These
597
are not user-modifiable, but typically the value will depend on
598
other options which can be modified. Such calculated options can
599
be useful when controlling what gets built or what ends up in the
600
generated configuration header files. A calculated value may also
601
effect other parts of the configuration, for instance, via a <SPAN
602
CLASS="emphasis"
603
><I
604
CLASS="EMPHASIS"
605
>requires</I
606
></SPAN
607
> constraint.</P
608
><TABLE
609
BORDER="5"
610
BGCOLOR="#E0E0F0"
611
WIDTH="70%"
612
><TR
613
><TD
614
><PRE
615
CLASS="SCREEN"
616
>&#13;cdl_option BUFSIZ {
617
# Calculated value: CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO ? CYGNUM_LIBC_STDIO_BUFSIZE : 0
618
#     CYGSEM_LIBC_STDIO_WANT_BUFFERED_IO == 1
619
#     CYGNUM_LIBC_STDIO_BUFSIZE == 256
620
# Current_value: 256
621
}; &#13;</PRE
622
></TD
623
></TR
624
></TABLE
625
><P
626
>A special type of calculated value is the <SPAN
627
CLASS="emphasis"
628
><I
629
CLASS="EMPHASIS"
630
>interface</I
631
></SPAN
632
>.
633
The value of an interface is the number of active and enabled options
634
which <SPAN
635
CLASS="emphasis"
636
><I
637
CLASS="EMPHASIS"
638
>implement</I
639
></SPAN
640
> that interface. Again the value
641
of an interface cannot be modified directly; only by modifying the
642
options which implement the interface. However, an interface can
643
be referenced by other parts of the configuration. </P
644
><TABLE
645
BORDER="5"
646
BGCOLOR="#E0E0F0"
647
WIDTH="70%"
648
><TR
649
><TD
650
><PRE
651
CLASS="SCREEN"
652
>cdl_interface CYGINT_KERNEL_SCHEDULER {
653
# Implemented by CYGSEM_KERNEL_SCHED_MLQUEUE, active, enabled
654
# Implemented by CYGSEM_KERNEL_SCHED_BITMAP, active, disabled
655
# This value cannot be modified here.
656
# Current_value: 1
657
# Requires: 1 == CYGINT_KERNEL_SCHEDULER
658
#     CYGINT_KERNEL_SCHEDULER == 1
659
#   --&gt; 1&#13;</PRE
660
></TD
661
></TR
662
></TABLE
663
><TABLE
664
BORDER="5"
665
BGCOLOR="#E0E0F0"
666
WIDTH="70%"
667
><TR
668
><TD
669
><PRE
670
CLASS="SCREEN"
671
># The following properties are affected by this value
672
# interface CYGINT_KERNEL_SCHEDULER
673
#     Requires: 1 == CYGINT_KERNEL_SCHEDULER
674
}; </PRE
675
></TD
676
></TR
677
></TABLE
678
><P
679
>If the configurable entity is modifiable then there will be
680
lines like the following:</P
681
><TABLE
682
BORDER="5"
683
BGCOLOR="#E0E0F0"
684
WIDTH="70%"
685
><TR
686
><TD
687
><PRE
688
CLASS="SCREEN"
689
>
690
cdl_option CYGSEM_KERNEL_SCHED_MLQUEUE {
691
...
692
# Flavor: bool
693
# No user value, uncomment the following line to provide one.
694
# user_value 1
695
# value_source default
696
# Default value: 1
697
...
698
}; &#13;</PRE
699
></TD
700
></TR
701
></TABLE
702
><P
703
>Configurable entities can have one of four different flavors:
704
none, bool, data and booldata. Flavor none indicates that there
705
is no data associated with the entity, typically it just acts as
706
a placeholder in the overall hierarchy. Flavor bool is the most
707
common, it is a simple yes-or-no choice. Flavor data is for more
708
complicated configuration choices, for instance the size of an array
709
or the name of a device. Flavor booldata is a combination of bool
710
and data: the option can be enabled or disabled, and there is some
711
additional data associated with the option as well.</P
712
><P
713
>In the above example the user has not modified this particular
714
option, as indicated by the comment and by the commented-out <TT
715
CLASS="LITERAL"
716
>user_value</TT
717
> line.
718
To disable this option the file should be edited to:</P
719
><TABLE
720
BORDER="5"
721
BGCOLOR="#E0E0F0"
722
WIDTH="70%"
723
><TR
724
><TD
725
><PRE
726
CLASS="SCREEN"
727
>&#13;cdl_option CYGSEM_KERNEL_SCHED_MLQUEUE {
728
...
729
# Flavor: bool
730
# No user value, uncomment the following line to provide one.
731
user_value 0
732
# value_source default
733
# Default value: 1
734
...
735
} &#13;</PRE
736
></TD
737
></TR
738
></TABLE
739
><P
740
>The comment preceding the <TT
741
CLASS="LITERAL"
742
>user_value
743
0</TT
744
> line can be removed if desired, otherwise it
745
will be removed automatically the next time the file is read and
746
updated by the configuration tools.</P
747
><P
748
>Much the same process should be used for options with the
749
data flavor, for example:</P
750
><TABLE
751
BORDER="5"
752
BGCOLOR="#E0E0F0"
753
WIDTH="70%"
754
><TR
755
><TD
756
><PRE
757
CLASS="SCREEN"
758
>
759
cdl_option CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET {
760
# Flavor: data
761
# No user value, uncomment the following line to provide one.
762
# user_value 3600
763
# value_source default
764
# Default value: 3600
765
# Legal values: -90000 to 90000
766
}; &#13;</PRE
767
></TD
768
></TR
769
></TABLE
770
><P
771
>can be changed to:</P
772
><TABLE
773
BORDER="5"
774
BGCOLOR="#E0E0F0"
775
WIDTH="70%"
776
><TR
777
><TD
778
><PRE
779
CLASS="SCREEN"
780
>&#13;cdl_option CYGNUM_LIBC_TIME_DST_DEFAULT_OFFSET {
781
# Flavor: data
782
user_value 7200
783
# value_source default
784
# Default value: 3600
785
# Legal values: -90000 to 90000 }; &#13;</PRE
786
></TD
787
></TR
788
></TABLE
789
><P
790
>Note that the original text provides the default value in
791
the <TT
792
CLASS="LITERAL"
793
>user_value</TT
794
> comment,
795
on the assumption that the desired new value is likely to be similar
796
to the default value. The <TT
797
CLASS="LITERAL"
798
>value_source</TT
799
> comment
800
does not need to be updated, it will be fixed up if the savefile
801
is fed back into the configuration system and regenerated.</P
802
><P
803
>For options with the booldata flavor, the <TT
804
CLASS="LITERAL"
805
>user_value</TT
806
> line
807
needs take two arguments. The first argument is for the boolean
808
part, the second for the data part. For example:</P
809
><TABLE
810
BORDER="5"
811
BGCOLOR="#E0E0F0"
812
WIDTH="70%"
813
><TR
814
><TD
815
><PRE
816
CLASS="SCREEN"
817
>
818
cdl_component CYGNUM_LIBM_COMPATIBILITY {
819
# Flavor: booldata
820
# No user value, uncomment the following line to provide one.
821
# user_value 1 POSIX
822
# value_source default
823
# Default value: 1 POSIX
824
# Legal values:  &#8220;POSIX&#8221; &#8220;IEEE&#8221; &#8220;XOPEN&#8221; &#8220;SVID&#8221;
825
...
826
}; &#13;</PRE
827
></TD
828
></TR
829
></TABLE
830
><P
831
>could be changed to:</P
832
><TABLE
833
BORDER="5"
834
BGCOLOR="#E0E0F0"
835
WIDTH="70%"
836
><TR
837
><TD
838
><PRE
839
CLASS="SCREEN"
840
>
841
cdl_component CYGNUM_LIBM_COMPATIBILITY {
842
# Flavor: booldata
843
user_value 1 IEEE
844
# value_source default
845
# Default value: 1 POSIX
846
# Legal values:  &#8220;POSIX&#8221; &#8220;IEEE&#8221; &#8220;XOPEN&#8221; &#8220;SVID&#8221;
847
...
848
}; &#13;</PRE
849
></TD
850
></TR
851
></TABLE
852
><P
853
>or alternatively, if the whole component should be disabled,
854
to:</P
855
><TABLE
856
BORDER="5"
857
BGCOLOR="#E0E0F0"
858
WIDTH="70%"
859
><TR
860
><TD
861
><PRE
862
CLASS="SCREEN"
863
>
864
cdl_component CYGNUM_LIBM_COMPATIBILITY {
865
# Flavor: booldata
866
user_value 0 POSIX
867
# value_source default
868
# Default value: 1 POSIX
869
# Legal values:  &#8220;POSIX&#8221; &#8220;IEEE&#8221; &#8220;XOPEN&#8221; &#8220;SVID&#8221;
870
...
871
}; &#13;</PRE
872
></TD
873
></TR
874
></TABLE
875
><P
876
>Some options take values that span multiple lines. An example
877
would be:</P
878
><TABLE
879
BORDER="5"
880
BGCOLOR="#E0E0F0"
881
WIDTH="70%"
882
><TR
883
><TD
884
><PRE
885
CLASS="SCREEN"
886
>&#13;cdl_option CYGDAT_UITRON_MEMPOOLVAR_INITIALIZERS {
887
# Flavor: data
888
# No user value, uncomment the following line to provide one.
889
# user_value \
890
# &#8220;CYG_UIT_MEMPOOLVAR( vpool1, 2000 ), \\
891
#  CYG_UIT_MEMPOOLVAR( vpool2, 2000 ), \\
892
#  CYG_UIT_MEMPOOLVAR( vpool3, 2000 ),&#8221;
893
# value_source default
894
# Default value: \
895
#     &#8220;CYG_UIT_MEMPOOLVAR( vpool1, 2000 ), \\
896
#      CYG_UIT_MEMPOOLVAR( vpool2, 2000 ), \\
897
#      CYG_UIT_MEMPOOLVAR( vpool3, 2000 ),&#8221;
898
}; &#13;</PRE
899
></TD
900
></TR
901
></TABLE
902
><P
903
>Setting a user value for this option involves uncommenting
904
and modifying all relevant lines, for example:</P
905
><TABLE
906
BORDER="5"
907
BGCOLOR="#E0E0F0"
908
WIDTH="70%"
909
><TR
910
><TD
911
><PRE
912
CLASS="SCREEN"
913
>&#13;cdl_option CYGDAT_UITRON_MEMPOOLVAR_INITIALIZERS {
914
# Flavor: data
915
user_value \
916
&#8220;CYG_UIT_MEMPOOLVAR( vpool1, 4000 ), \\
917
CYG_UIT_MEMPOOLVAR( vpool2, 4000 ),&#8221;
918
# value_source default
919
# Default value: \
920
#     &#8220;CYG_UIT_MEMPOOLVAR( vpool1, 2000 ), \\
921
#      CYG_UIT_MEMPOOLVAR( vpool2, 2000 ), \\
922
#      CYG_UIT_MEMPOOLVAR( vpool3, 2000 ),&#8221;
923
}; &#13;</PRE
924
></TD
925
></TR
926
></TABLE
927
><P
928
>In such cases appropriate care has to be taken to preserve
929
Tcl syntax, as discussed below.</P
930
><P
931
>The configuration system has the ability to keep track of
932
          several different values for any given option. All options
933
          start off with a default value, in other words their value
934
          source is set to <TT
935
CLASS="LITERAL"
936
>default</TT
937
>. If a
938
          configuration involves conflicts and the configuration
939
          system&#8217;s inference engine is allowed to resolve these
940
          automatically then it may provide an
941
          <TT
942
CLASS="LITERAL"
943
>inferred</TT
944
> value instead, for
945
          example:</P
946
><TABLE
947
BORDER="5"
948
BGCOLOR="#E0E0F0"
949
WIDTH="70%"
950
><TR
951
><TD
952
><PRE
953
CLASS="SCREEN"
954
>&#13;cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT {
955
# Flavor: bool
956
# No user value, uncomment the following line to provide one.
957
# user_value 1
958
# The inferred value should not be edited directly.
959
inferred_value 0
960
# value_source inferred
961
# Default value: 1
962
...
963
}; &#13;</PRE
964
></TD
965
></TR
966
></TABLE
967
><P
968
>Inferred values are calculated by the configuration system
969
and should not be edited by the user. If the inferred value is not
970
correct then a user value should be substituted instead:</P
971
><TABLE
972
BORDER="5"
973
BGCOLOR="#E0E0F0"
974
WIDTH="70%"
975
><TR
976
><TD
977
><PRE
978
CLASS="SCREEN"
979
>&#13;cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT {
980
# Flavor: bool
981
user_value 1
982
# The inferred value should not be edited directly.
983
inferred_value 0
984
# value_source inferred
985
# Default value: 1
986
...
987
}; </PRE
988
></TD
989
></TR
990
></TABLE
991
><P
992
>The inference engine will not override a user value with an
993
inferred one. Making a change like this may well re-introduce a
994
conflict, since the inferred value was only calculated to resolve
995
a conflict. Another run of the inference engine may find a different
996
and more acceptable way of resolving the conflict, but this is not guaranteed
997
and it may be up to the user to examine the various dependencies
998
and work out an acceptable solution.</P
999
><P
1000
>Inferred values are listed in the savefile because the exact
1001
inferred value may depend on the order in which changes were made
1002
and conflicts were resolved. If the inferred values were absent
1003
then it is possible that reloading a savefile would not exactly
1004
restore the configuration. Default values on the other hand are
1005
entirely deterministic so there is no actual need for the values
1006
to be listed in the savefile. However, the default value can be
1007
very useful information so it is provided in a comment.</P
1008
><P
1009
>Occasionally the user will want to do some experimentation,
1010
and temporarily switch an option from a user value back to a default
1011
or inferred one to see what the effect would be. This could be achieved
1012
by simply commenting out the user value. For instance, if the current
1013
savefile contains:</P
1014
><TABLE
1015
BORDER="5"
1016
BGCOLOR="#E0E0F0"
1017
WIDTH="70%"
1018
><TR
1019
><TD
1020
><PRE
1021
CLASS="SCREEN"
1022
>
1023
cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT {
1024
# Flavor: bool
1025
user_value 1
1026
# The inferred value should not be edited directly.
1027
inferred_value 0
1028
# value_source user
1029
# Default value: 1
1030
...
1031
}; &#13;</PRE
1032
></TD
1033
></TR
1034
></TABLE
1035
><P
1036
>then the inferred value could be restored by commenting out
1037
or removing the <TT
1038
CLASS="LITERAL"
1039
>user_value</TT
1040
> line:</P
1041
><TABLE
1042
BORDER="5"
1043
BGCOLOR="#E0E0F0"
1044
WIDTH="70%"
1045
><TR
1046
><TD
1047
><PRE
1048
CLASS="SCREEN"
1049
>
1050
cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT {
1051
# Flavor: bool
1052
# user_value 1
1053
# The inferred value should not be edited directly.
1054
inferred_value 0
1055
# value_source user
1056
# Default value: 1
1057
...
1058
}; &#13;</PRE
1059
></TD
1060
></TR
1061
></TABLE
1062
><P
1063
>This is fine for simple values. However if the value is complicated
1064
then there is a problem: commenting out the <TT
1065
CLASS="LITERAL"
1066
>user_value</TT
1067
> line
1068
or lines means that the user value becomes invisible to the configuration system,
1069
so if the savefile is loaded and then regenerated the information
1070
will be lost. An alternative approach is to keep the <TT
1071
CLASS="LITERAL"
1072
>user_value</TT
1073
> but
1074
explicitly set the <TT
1075
CLASS="LITERAL"
1076
>value_source</TT
1077
> line,
1078
for example:</P
1079
><TABLE
1080
BORDER="5"
1081
BGCOLOR="#E0E0F0"
1082
WIDTH="70%"
1083
><TR
1084
><TD
1085
><PRE
1086
CLASS="SCREEN"
1087
>&#13;cdl_option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT {
1088
# Flavor: bool
1089
user_value 1
1090
# The inferred value should not be edited directly.
1091
inferred_value 0
1092
value_source inferred
1093
# Default value: 1
1094
...
1095
}; &#13;</PRE
1096
></TD
1097
></TR
1098
></TABLE
1099
><P
1100
>In this case the configuration system will use the inferred
1101
value for the purposes of dependency analysis etc., even though
1102
a user value is present. To restore the user value the <TT
1103
CLASS="LITERAL"
1104
>value_source</TT
1105
> line
1106
can be commented out again. If there is no explicit <TT
1107
CLASS="LITERAL"
1108
>value_source</TT
1109
> then
1110
the configuration system will just use the highest priority one:
1111
the user value if it exists; otherwise the inferred value if it
1112
exists; otherwise the default value which always exists.</P
1113
><P
1114
>The default value for an option can be a simple constant,
1115
or it can be an expression involving other options. In the latter
1116
case the expression will be listed, together with the values for
1117
all options referenced in the expression and the current result
1118
of evaluating that expression. This is for informational purposes
1119
only, the default value is always recalculated deterministically
1120
when loading in a savefile.</P
1121
><TABLE
1122
BORDER="5"
1123
BGCOLOR="#E0E0F0"
1124
WIDTH="70%"
1125
><TR
1126
><TD
1127
><PRE
1128
CLASS="SCREEN"
1129
>&#13;cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX {
1130
# Flavor: data
1131
# No user value, uncomment the following line to provide one.
1132
# user_value arm-elf
1133
# value_source default
1134
# Default value:  CYGHWR_THUMB ? &#8220;thumb-elf&#8221; : &#8220;arm-elf&#8221;
1135
#     CYGHWR_THUMB == 0
1136
#   --&gt; arm-elf
1137
}; &#13;</PRE
1138
></TD
1139
></TR
1140
></TABLE
1141
><P
1142
>For options with the data or booldata flavor, there are likely
1143
to be constraints on the possible values. If the value is supposed
1144
to be a number in a given range and a user value of &#8220;<TT
1145
CLASS="LITERAL"
1146
>hello
1147
world</TT
1148
>&#8221; is provided instead then there
1149
are likely to be compile-time failures. Component developers can
1150
specify constraints on the legal values, and these will be listed
1151
in the savefile.</P
1152
><TABLE
1153
BORDER="5"
1154
BGCOLOR="#E0E0F0"
1155
WIDTH="70%"
1156
><TR
1157
><TD
1158
><PRE
1159
CLASS="SCREEN"
1160
>
1161
cdl_option X_TLOSS {
1162
# Flavor: data
1163
# No user value, uncomment the following line to provide one.
1164
# user_value 1.41484755040569E+16
1165
# value_source default
1166
# Default value: 1.41484755040569E+16
1167
# Legal values: 1 to 1e308
1168
};&#13;</PRE
1169
></TD
1170
></TR
1171
></TABLE
1172
><TABLE
1173
BORDER="5"
1174
BGCOLOR="#E0E0F0"
1175
WIDTH="70%"
1176
><TR
1177
><TD
1178
><PRE
1179
CLASS="SCREEN"
1180
>cdl_component CYGNUM_LIBM_COMPATIBILITY {
1181
# Flavor: booldata
1182
# No user value, uncomment the following line to provide one.
1183
# user_value 1 POSIX
1184
# value_source default
1185
# Default value: 1 POSIX
1186
# Legal values:  &#8220;POSIX&#8221; &#8220;IEEE&#8221; &#8220;XOPEN&#8221; &#8220;SVID&#8221;
1187
...
1188
};&#13;</PRE
1189
></TD
1190
></TR
1191
></TABLE
1192
><P
1193
>In some cases the legal values list may be an expression involving
1194
other options. If so then the current values of the referenced options
1195
will be listed, together with the result of evaluating the list
1196
expression, just as for default value expressions.</P
1197
><P
1198
>If an illegal value is provided then this will result in a
1199
conflict, listed in the conflicts section of the savefile. For more
1200
complicated options a simple legal values list is not sufficient
1201
to allow the current value to be validated, and the configuration
1202
system will be unable to flag conflicts. This issue will be addressed in
1203
future releases of the configuration system.</P
1204
><P
1205
>Following the value-related fields for a given option, any <SPAN
1206
CLASS="emphasis"
1207
><I
1208
CLASS="EMPHASIS"
1209
>requires</I
1210
></SPAN
1211
> constraints belonging
1212
to this option will be listed. These constraints are only effective
1213
if the option is active and, for bool and booldata flavors, enabled.
1214
If some aspect of <SPAN
1215
CLASS="PRODUCTNAME"
1216
>eCos</SPAN
1217
> functionality is inactive or disabled then
1218
it cannot impose any constraints on the rest of the system. As usual,
1219
the full expression will be listed followed by the current values
1220
of all options that are referenced and the result of evaluating
1221
the expression:</P
1222
><TABLE
1223
BORDER="5"
1224
BGCOLOR="#E0E0F0"
1225
WIDTH="70%"
1226
><TR
1227
><TD
1228
><PRE
1229
CLASS="SCREEN"
1230
>&#13;cdl_option CYGSEM_LIBC_TIME_TIME_WORKING {
1231
...
1232
# Requires: CYGPKG_DEVICES_WALLCLOCK
1233
#     CYGPKG_DEVICES_WALLCLOCK == current
1234
#   --&gt; 1
1235
};&#13;</PRE
1236
></TD
1237
></TR
1238
></TABLE
1239
><P
1240
>When modifying the value of an option it is useful to know
1241
not only what constraints the option imposes on the rest of the
1242
system but also what other options in the system depend in some
1243
way on this one. The savefile provides this information:</P
1244
><TABLE
1245
BORDER="5"
1246
BGCOLOR="#E0E0F0"
1247
WIDTH="70%"
1248
><TR
1249
><TD
1250
><PRE
1251
CLASS="SCREEN"
1252
>cdl_option CYGFUN_KERNEL_THREADS_TIMER {
1253
...
1254
# The following properties are affected by this value
1255
# option CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT
1256
#     Requires: CYGFUN_KERNEL_THREADS_TIMER
1257
# option CYGIMP_UITRON_STRICT_CONFORMANCE
1258
#     Requires: CYGFUN_KERNEL_THREADS_TIMER
1259
# option CYGSEM_LIBC_TIME_CLOCK_WORKING
1260
#     Requires: CYGFUN_KERNEL_THREADS_TIMER
1261
}; &#13;</PRE
1262
></TD
1263
></TR
1264
></TABLE
1265
></DIV
1266
><DIV
1267
CLASS="SECT2"
1268
><H2
1269
CLASS="SECT2"
1270
><A
1271
NAME="AEN2847">Tcl Syntax</H2
1272
><P
1273
><SPAN
1274
CLASS="PRODUCTNAME"
1275
>eCos</SPAN
1276
> savefiles are implemented as Tcl scripts, and are read
1277
in by running the data through a standard Tcl interpreter that has
1278
been extended with a small number of additional commands such as <TT
1279
CLASS="LITERAL"
1280
>cdl_option</TT
1281
> and <TT
1282
CLASS="LITERAL"
1283
>cdl_configuration</TT
1284
>.
1285
In many cases this is an implementation detail that can be safely
1286
ignored while editing a savefile: simply replacing a <TT
1287
CLASS="LITERAL"
1288
>1</TT
1289
> with
1290
a <TT
1291
CLASS="LITERAL"
1292
>0</TT
1293
> to disable some functionality
1294
is not going to affect whether or not the savefile is still a valid
1295
Tcl script and can be processed by a Tcl interpreter. However, there
1296
are more complicated cases where an understanding of Tcl syntax
1297
is at least desirable, for example:</P
1298
><TABLE
1299
BORDER="5"
1300
BGCOLOR="#E0E0F0"
1301
WIDTH="70%"
1302
><TR
1303
><TD
1304
><PRE
1305
CLASS="SCREEN"
1306
>&#13;cdl_option CYGDAT_UITRON_MEMPOOLVAR_EXTERNS {
1307
     # Flavor: data
1308
     user_value \
1309
      &#8220;static char vpool1\[ 2000 \], \\
1310
      vpool2\[ 2000 \], \\
1311
       vpool3\[ 2000 \];&#8221;
1312
# value_source default
1313
# Default value: \
1314
     #     &#8220;static char vpool1\[ 2000 \], \\
1315
     #      vpool2\[ 2000 \], \\
1316
    #      vpool3\[ 2000 \];&#8221;
1317
};&#13;</PRE
1318
></TD
1319
></TR
1320
></TABLE
1321
><P
1322
>The backslash at the end of the <TT
1323
CLASS="LITERAL"
1324
>user_value</TT
1325
> line
1326
is processed by the Tcl interpreter as a line continuation character.
1327
The quote marks around the user data are also interpreted by the
1328
Tcl interpreter and serve to turn the entire data field into a single
1329
argument. The backslashes preceding the opening and closing square
1330
brackets prevent the Tcl interpreter from treating these characters
1331
specially, otherwise there would be an attempt at <SPAN
1332
CLASS="emphasis"
1333
><I
1334
CLASS="EMPHASIS"
1335
>command
1336
substitution</I
1337
></SPAN
1338
> as described below. The double backslashes
1339
at the end of each line of the data will be turned into a single
1340
backslash by the Tcl interpreter, rather than escaping the newline
1341
character, so that the actual data seen by the configuration system
1342
is:</P
1343
><TABLE
1344
BORDER="5"
1345
BGCOLOR="#E0E0F0"
1346
WIDTH="70%"
1347
><TR
1348
><TD
1349
><PRE
1350
CLASS="SCREEN"
1351
>&#13;static char vpool1[ 2000 ], \
1352
      vpool2[ 2000 ], \
1353
      vpool3[ 2000 ];&#13;</PRE
1354
></TD
1355
></TR
1356
></TABLE
1357
><P
1358
>This is of course the data that should end up in the &micro;ITRON
1359
configuration header file. The opening and closing braces surrounding
1360
the entire body of the option data are also significant and cause
1361
this body to be passed as a single argument to the <B
1362
CLASS="COMMAND"
1363
>cdl_option</B
1364
> command.
1365
The closing semicolon is optional in this example, but provides
1366
a small amount of additional robustness if the savefile is edited
1367
such that it is no longer a valid Tcl script. If the data contained
1368
any <TT
1369
CLASS="LITERAL"
1370
>$</TT
1371
> characters then
1372
these would have to be treated specially as well, via a backslash escape.</P
1373
><P
1374
>In spite of what all the above might seem to suggest, Tcl
1375
is actually a very simple yet powerful scripting language: the syntax
1376
is defined by just eleven rules. On occasion this simplicity means
1377
that Tcl&#8217;s behaviour is subtly different from other languages,
1378
which can confuse newcomers.</P
1379
><P
1380
>When the Tcl interpreter is passed some data such as <TT
1381
CLASS="LITERAL"
1382
>puts
1383
Hello</TT
1384
>, it splits this data into a command and its
1385
arguments. The command will be terminated by a newline or by a semicolon,
1386
unless one of the quoting mechanisms is used. The command and each
1387
of its arguments are separated by white space. So in the following
1388
example:</P
1389
><TABLE
1390
BORDER="5"
1391
BGCOLOR="#E0E0F0"
1392
WIDTH="70%"
1393
><TR
1394
><TD
1395
><PRE
1396
CLASS="SCREEN"
1397
>puts Hello
1398
set x 42 </PRE
1399
></TD
1400
></TR
1401
></TABLE
1402
><P
1403
>will result in two separate commands being executed. The first
1404
command is <TT
1405
CLASS="LITERAL"
1406
>puts</TT
1407
> and is passed a
1408
single argument, <TT
1409
CLASS="LITERAL"
1410
>Hello</TT
1411
>. The second
1412
command is <TT
1413
CLASS="LITERAL"
1414
>set</TT
1415
> and is passed two
1416
arguments, <TT
1417
CLASS="LITERAL"
1418
>x</TT
1419
> and <TT
1420
CLASS="LITERAL"
1421
>42</TT
1422
>.
1423
The intervening newline character serves to terminate the first
1424
command, and a semi-colon separator could be used instead: </P
1425
><TABLE
1426
BORDER="5"
1427
BGCOLOR="#E0E0F0"
1428
WIDTH="70%"
1429
><TR
1430
><TD
1431
><PRE
1432
CLASS="PROGRAMLISTING"
1433
>puts Hello;set x 42</PRE
1434
></TD
1435
></TR
1436
></TABLE
1437
><P
1438
>Any white space surrounding the semicolon is just ignored
1439
because it does not serve to separate arguments.</P
1440
><P
1441
>Now consider the following:</P
1442
><TABLE
1443
BORDER="5"
1444
BGCOLOR="#E0E0F0"
1445
WIDTH="70%"
1446
><TR
1447
><TD
1448
><PRE
1449
CLASS="SCREEN"
1450
>set x Hello world</PRE
1451
></TD
1452
></TR
1453
></TABLE
1454
><P
1455
>This is not valid Tcl. It is an attempt to invoke the <TT
1456
CLASS="LITERAL"
1457
>set</TT
1458
> command
1459
with three arguments: <TT
1460
CLASS="LITERAL"
1461
>x</TT
1462
>, <TT
1463
CLASS="LITERAL"
1464
>Hello</TT
1465
>,
1466
and <TT
1467
CLASS="LITERAL"
1468
>world</TT
1469
>. The <TT
1470
CLASS="LITERAL"
1471
>set</TT
1472
> only
1473
takes two arguments, a variable name and a value, so it is necessary
1474
to combine the data into a single argument by quoting:</P
1475
><TABLE
1476
BORDER="5"
1477
BGCOLOR="#E0E0F0"
1478
WIDTH="70%"
1479
><TR
1480
><TD
1481
><PRE
1482
CLASS="PROGRAMLISTING"
1483
>set x &#8220;Hello world&#8221;</PRE
1484
></TD
1485
></TR
1486
></TABLE
1487
><P
1488
>When the Tcl interpreter encounters the first quote character
1489
it treats all subsequent data up to but not including the closing
1490
quote as part of the current argument. The quote marks are removed
1491
by the interpreter, so the second argument passed to the <TT
1492
CLASS="LITERAL"
1493
>set</TT
1494
> command
1495
is just <TT
1496
CLASS="LITERAL"
1497
>Hello world</TT
1498
> without the
1499
quote characters. This can be significant in the context of <SPAN
1500
CLASS="PRODUCTNAME"
1501
>eCos</SPAN
1502
> savefiles.
1503
For instance, consider the following configuration option:</P
1504
><TABLE
1505
BORDER="5"
1506
BGCOLOR="#E0E0F0"
1507
WIDTH="70%"
1508
><TR
1509
><TD
1510
><PRE
1511
CLASS="SCREEN"
1512
>&#13;cdl_option CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE {
1513
# Flavor: data
1514
# No user value, uncomment the following line to provide one.
1515
# user_value &#8220;\&#8221;/dev/ttydiag\&#8221;&#8221;
1516
# value_source default
1517
# Default value: &#8220;\&#8221;/dev/ttydiag\&#8221;&#8221;
1518
}; &#13;</PRE
1519
></TD
1520
></TR
1521
></TABLE
1522
><P
1523
>The desired value of the configuration option should be a
1524
valid C string, complete with quote characters. If the savefile
1525
was edited to: </P
1526
><TABLE
1527
BORDER="5"
1528
BGCOLOR="#E0E0F0"
1529
WIDTH="70%"
1530
><TR
1531
><TD
1532
><PRE
1533
CLASS="SCREEN"
1534
>&#13;cdl_option CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE {
1535
# Flavor: data
1536
user_value &#8220;/dev/ttydiag&#8221;
1537
# value_source default
1538
# Default value: &#8220;\&#8221;/dev/ttydiag\&#8221;&#8221;
1539
}; &#13;</PRE
1540
></TD
1541
></TR
1542
></TABLE
1543
><P
1544
>then the Tcl interpreter would remove the quote marks when
1545
the savefile is read back in, so the option&#8217;s value would
1546
not have any quote marks and would not be a valid C string. The
1547
configuration system is not yet able to perform the required validation
1548
so the following <TT
1549
CLASS="LITERAL"
1550
>#define</TT
1551
> would
1552
be generated in the configuration header file:</P
1553
><TABLE
1554
BORDER="5"
1555
BGCOLOR="#E0E0F0"
1556
WIDTH="70%"
1557
><TR
1558
><TD
1559
><PRE
1560
CLASS="PROGRAMLISTING"
1561
>#define CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE /dev/ttydiag </PRE
1562
></TD
1563
></TR
1564
></TABLE
1565
><P
1566
>This is likely to cause a compile-time failure when building
1567
<SPAN
1568
CLASS="PRODUCTNAME"
1569
>eCos</SPAN
1570
>.</P
1571
><P
1572
>A quoted argument continues until the closing quote character
1573
is encountered, which means that it can span multiple lines. This
1574
can also be encountered in <SPAN
1575
CLASS="PRODUCTNAME"
1576
>eCos</SPAN
1577
> savefiles, for instance, in the <TT
1578
CLASS="LITERAL"
1579
>CYGDAT_UITRON_MEMPOOLVAR_EXTERNS</TT
1580
> example
1581
mentioned earlier. Newline or semicolon characters do not terminate
1582
the current command in such cases.</P
1583
><P
1584
>The Tcl interpreter supports much the same forms of backslash
1585
substitution as other common programming languages. Some backslash
1586
sequences such as <TT
1587
CLASS="LITERAL"
1588
>\n</TT
1589
> will
1590
be replaced by the appropriate character. The sequence <TT
1591
CLASS="LITERAL"
1592
>\\</TT
1593
> will
1594
be replaced by a single backslash. A backslash at the very end of
1595
a line will cause that backslash, the newline character, and any
1596
white space at the start of the next line to be replaced by a single
1597
space. Hence the following two Tcl commands are equivalent:</P
1598
><TABLE
1599
BORDER="5"
1600
BGCOLOR="#E0E0F0"
1601
WIDTH="70%"
1602
><TR
1603
><TD
1604
><PRE
1605
CLASS="PROGRAMLISTING"
1606
>puts  &#8220;Hello\nworld\n&#8221;
1607
puts \
1608
&#8220;Hello
1609
world
1610
&#8220;</PRE
1611
></TD
1612
></TR
1613
></TABLE
1614
><P
1615
>In addition to quote and backslash characters, the Tcl interpreter
1616
treats square brackets, the <TT
1617
CLASS="LITERAL"
1618
>$</TT
1619
> character,
1620
and braces specially. Square brackets are used for command substitution,
1621
for example:</P
1622
><TABLE
1623
BORDER="5"
1624
BGCOLOR="#E0E0F0"
1625
WIDTH="70%"
1626
><TR
1627
><TD
1628
><PRE
1629
CLASS="PROGRAMLISTING"
1630
>puts &#8220;The answer is [expr 6 * 9]&#8221;</PRE
1631
></TD
1632
></TR
1633
></TABLE
1634
><P
1635
>When the Tcl interpreter encounters the square brackets it
1636
will treat the contents as another command that should be executed
1637
first, and the result of executing that is used when continuing
1638
to process the script. In this case the Tcl interpreter will execute
1639
the command <TT
1640
CLASS="LITERAL"
1641
>expr 6 * 9</TT
1642
>,
1643
yielding a result of 54, and then the Tcl interpreter will execute
1644
<TT
1645
CLASS="LITERAL"
1646
>puts &#8220;The answer is 54&#8221;</TT
1647
>. It should be noted that
1648
the interpreter contains only one level of substitution: if the
1649
result of performing command substitution performs further special
1650
characters such as square brackets then these will not be treated
1651
specially.</P
1652
><P
1653
>Command line substitution is very unlikely to prove useful
1654
in the context of an <SPAN
1655
CLASS="PRODUCTNAME"
1656
>eCos</SPAN
1657
> savefile, but it is part of the Tcl language
1658
and hence cannot be easily suppressed while reading in a savefile.
1659
As a result care has to be taken when savefile data involves square
1660
brackets. Consider the following:</P
1661
><TABLE
1662
BORDER="5"
1663
BGCOLOR="#E0E0F0"
1664
WIDTH="70%"
1665
><TR
1666
><TD
1667
><PRE
1668
CLASS="PROGRAMLISTING"
1669
>&#13;cdl_option CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS {
1670
     ...
1671
     user_value \
1672
&#8220;static char fpool1[ 2000 ],
1673
fpool2[ 2000 ];&#8221;
1674
     ...
1675
};</PRE
1676
></TD
1677
></TR
1678
></TABLE
1679
><P
1680
>The Tcl interpreter will interpret the square brackets as
1681
an attempt at command substitution and hence it will attempt to
1682
execute the command <TT
1683
CLASS="LITERAL"
1684
>2000</TT
1685
> with no
1686
arguments. No such command is defined by the Tcl language or by
1687
the savefile-related extensions provided by the configuration system,
1688
so this will result in an error when an attempt is made to read
1689
back the savefile. Instead it is necessary to backslash-escape the
1690
square brackets and thus suppress command substitution:</P
1691
><TABLE
1692
BORDER="5"
1693
BGCOLOR="#E0E0F0"
1694
WIDTH="70%"
1695
><TR
1696
><TD
1697
><PRE
1698
CLASS="PROGRAMLISTING"
1699
>&#13;cdl_option CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS {
1700
     ...
1701
     user_value \
1702
&#8220;static char fpool1\[ 2000 \],
1703
fpool2\[ 2000 \];&#8221;
1704
     ...
1705
}; </PRE
1706
></TD
1707
></TR
1708
></TABLE
1709
><P
1710
>Similarly the <TT
1711
CLASS="LITERAL"
1712
>$</TT
1713
> character
1714
is used in Tcl scripts to perform variable substitution:</P
1715
><TABLE
1716
BORDER="5"
1717
BGCOLOR="#E0E0F0"
1718
WIDTH="70%"
1719
><TR
1720
><TD
1721
><PRE
1722
CLASS="PROGRAMLISTING"
1723
>set x [expr 6 * 9]
1724
puts &#8220;The answer is $x&#8221; </PRE
1725
></TD
1726
></TR
1727
></TABLE
1728
><P
1729
>Variable substitution, like command substitution, is very
1730
unlikely to prove useful in the context of an <SPAN
1731
CLASS="PRODUCTNAME"
1732
>eCos</SPAN
1733
> savefile. Should
1734
it be necessary to have a <TT
1735
CLASS="LITERAL"
1736
>$</TT
1737
> character
1738
in configuration data then again a backslash escape needs to be
1739
used.</P
1740
><TABLE
1741
BORDER="5"
1742
BGCOLOR="#E0E0F0"
1743
WIDTH="70%"
1744
><TR
1745
><TD
1746
><PRE
1747
CLASS="PROGRAMLISTING"
1748
>cdl_option FOODAT_MONITOR_PROMPT {
1749
     ...
1750
     user_value &#8220;\$ &#8220;
1751
     ...
1752
};</PRE
1753
></TD
1754
></TR
1755
></TABLE
1756
><P
1757
>Braces are used to collect a sequence of characters into a
1758
single argument, just like quotes. The difference is that variable,
1759
command and backslash substitution do not occur inside braces (with
1760
the sole exception of backslash substitution at the end of a line).
1761
So, for example, the <TT
1762
CLASS="LITERAL"
1763
>CYGDAT_UITRON_MEMPOOL_EXTERNFIXED_EXTERNS</TT
1764
> value
1765
could be written as:</P
1766
><TABLE
1767
BORDER="5"
1768
BGCOLOR="#E0E0F0"
1769
WIDTH="70%"
1770
><TR
1771
><TD
1772
><PRE
1773
CLASS="PROGRAMLISTING"
1774
>cdl_option CYGDAT_UITRON_MEMPOOLFIXED_EXTERNS {
1775
     ...
1776
     user_value \
1777
{static char fpool1[ 2000 ],
1778
fpool2[ 2000 ];}
1779
     ...
1780
};</PRE
1781
></TD
1782
></TR
1783
></TABLE
1784
><P
1785
>The configuration system does not use this when generating
1786
savefiles because for simple edits of a savefile by inexperienced
1787
users the use of brace characters is likely to be a little bit more
1788
confusing than the use of quotes.</P
1789
><P
1790
>At this stage it is worth noting that the basic format of
1791
each configuration option in the savefile makes use of braces:</P
1792
><TABLE
1793
BORDER="5"
1794
BGCOLOR="#E0E0F0"
1795
WIDTH="70%"
1796
><TR
1797
><TD
1798
><PRE
1799
CLASS="PROGRAMLISTING"
1800
>cdl_option &lt;name&gt; {
1801
     ...
1802
};</PRE
1803
></TD
1804
></TR
1805
></TABLE
1806
><P
1807
>The configuration system extends the Tcl language with a small
1808
number of additional commands such as <TT
1809
CLASS="LITERAL"
1810
>cdl_option</TT
1811
>.
1812
These commands take two arguments, a name and a body, where the
1813
body consists of all the text between the braces. First a check
1814
is made that the specified option is actually present in the configuration.
1815
Then the body is executed in a recursive invocation of the Tcl interpreter,
1816
this time with additional commands such as <TT
1817
CLASS="LITERAL"
1818
>user_value</TT
1819
> and <TT
1820
CLASS="LITERAL"
1821
>value_source</TT
1822
>.
1823
If, after editing, the braces are not correctly matched up then
1824
the savefile will no longer be a valid Tcl script and errors will
1825
be reported when the savefile is loaded again.</P
1826
><P
1827
>Comments in Tcl scripts are introduced by a hash character <TT
1828
CLASS="LITERAL"
1829
>#</TT
1830
>.
1831
However, a hash character only introduces a comment if it occurs
1832
where a command is expected. Consider the following:</P
1833
><TABLE
1834
BORDER="5"
1835
BGCOLOR="#E0E0F0"
1836
WIDTH="70%"
1837
><TR
1838
><TD
1839
><PRE
1840
CLASS="PROGRAMLISTING"
1841
># This is a comment
1842
puts &#8220;Hello&#8221; # world </PRE
1843
></TD
1844
></TR
1845
></TABLE
1846
><P
1847
>The first line is a valid comment, since the hash character
1848
occurs right at the start where a command name is expected. The
1849
second line does not contain a comment. Instead it is an attempt
1850
to invoke the <TT
1851
CLASS="LITERAL"
1852
>puts</TT
1853
> command with
1854
three arguments: <TT
1855
CLASS="LITERAL"
1856
>Hello</TT
1857
>, <TT
1858
CLASS="LITERAL"
1859
>#</TT
1860
> and <TT
1861
CLASS="LITERAL"
1862
>world</TT
1863
>.
1864
These are not valid arguments for the <TT
1865
CLASS="LITERAL"
1866
>puts</TT
1867
> command
1868
so an error will be raised.</P
1869
><P
1870
>If the second line was rewritten as:</P
1871
><TABLE
1872
BORDER="5"
1873
BGCOLOR="#E0E0F0"
1874
WIDTH="70%"
1875
><TR
1876
><TD
1877
><PRE
1878
CLASS="PROGRAMLISTING"
1879
>puts &#8220;Hello&#8221;; # world</PRE
1880
></TD
1881
></TR
1882
></TABLE
1883
><P
1884
>then this is a valid Tcl script. The semicolon identifies
1885
the end of the current command, so the hash character occurs at
1886
a point where the next command would start and hence it is interpreted
1887
as the start of a comment.</P
1888
><P
1889
>This handling of comments can lead to subtle behaviour. Consider
1890
the following:</P
1891
><TABLE
1892
BORDER="5"
1893
BGCOLOR="#E0E0F0"
1894
WIDTH="70%"
1895
><TR
1896
><TD
1897
><PRE
1898
CLASS="PROGRAMLISTING"
1899
>cdl_option WHATEVER {
1900
     # This is a comment }
1901
     user_value 42
1902
     ...
1903
}</PRE
1904
></TD
1905
></TR
1906
></TABLE
1907
><P
1908
>Consider the way the Tcl interpreter processes this. The command
1909
name and the first argument do not pose any special difficulties.
1910
The opening brace is interpreted as the start of the next argument,
1911
which continues until a closing brace is encountered. In this case
1912
the closing brace occurs on the second line, so the second argument
1913
passed to <TT
1914
CLASS="LITERAL"
1915
>cdl_option</TT
1916
> is <TT
1917
CLASS="LITERAL"
1918
>\n # This is a comment</TT
1919
> . This second argument
1920
is processed in a recursive invocation of the Tcl interpreter and
1921
does not contain any commands, just a comment. Toplevel savefile
1922
processing then resumes, and the next command that is encountered
1923
is <TT
1924
CLASS="LITERAL"
1925
>user_value</TT
1926
>. Since the
1927
relevant savefile code is not currently processing a configuration
1928
option this is an error. Later on the Tcl interpreter would encounter
1929
a closing brace by itself, which is also an error. Fortunately this
1930
sequence of events is very unlikely to occur when editing generated
1931
savefiles.</P
1932
><P
1933
>This should be sufficient information about Tcl to allow for
1934
safe editing of <SPAN
1935
CLASS="PRODUCTNAME"
1936
>eCos</SPAN
1937
> savefiles. Further information is available
1938
from a wide variety of sources, for example the book <SPAN
1939
CLASS="emphasis"
1940
><I
1941
CLASS="EMPHASIS"
1942
>Tcl
1943
and the Tk Toolkit </I
1944
></SPAN
1945
>by John K Ousterhout.</P
1946
></DIV
1947
></DIV
1948
><DIV
1949
CLASS="NAVFOOTER"
1950
><HR
1951
ALIGN="LEFT"
1952
WIDTH="100%"><TABLE
1953
SUMMARY="Footer navigation table"
1954
WIDTH="100%"
1955
BORDER="0"
1956
CELLPADDING="0"
1957
CELLSPACING="0"
1958
><TR
1959
><TD
1960
WIDTH="33%"
1961
ALIGN="left"
1962
VALIGN="top"
1963
><A
1964
HREF="fine-grained-configuration.html"
1965
ACCESSKEY="P"
1966
>Prev</A
1967
></TD
1968
><TD
1969
WIDTH="34%"
1970
ALIGN="center"
1971
VALIGN="top"
1972
><A
1973
HREF="ecos-user-guide.html"
1974
ACCESSKEY="H"
1975
>Home</A
1976
></TD
1977
><TD
1978
WIDTH="33%"
1979
ALIGN="right"
1980
VALIGN="top"
1981
><A
1982
HREF="editing-the-sources.html"
1983
ACCESSKEY="N"
1984
>Next</A
1985
></TD
1986
></TR
1987
><TR
1988
><TD
1989
WIDTH="33%"
1990
ALIGN="left"
1991
VALIGN="top"
1992
>Fine-grained Configuration</TD
1993
><TD
1994
WIDTH="34%"
1995
ALIGN="center"
1996
VALIGN="top"
1997
><A
1998
HREF="manual-configuration.html"
1999
ACCESSKEY="U"
2000
>Up</A
2001
></TD
2002
><TD
2003
WIDTH="33%"
2004
ALIGN="right"
2005
VALIGN="top"
2006
>Editing the Sources</TD
2007
></TR
2008
></TABLE
2009
></DIV
2010
></BODY
2011
></HTML
2012
>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.