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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [doc/] [sgml/] [user-guide/] [configuration.sgml] - Blame information for rev 786

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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