1    /* 
     2     *  Copyright (c) 2008 Texas Instruments and others.
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     * 
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     * 
    11     * */
    12    /*
    13     *  ======== Program.xdc ========
    14     */
    15    package xdc.cfg;
    16    
    17    /*!
    18     *  ======== Program ========
    19     *  The Program object for the configuration object model.
    20     *
    21     *  This module defines the "root" of the configuration object model; all
    22     *  configuration settings are for the executable represented by this
    23     *  object. Program configuration scripts reference this module via the
    24     *  global variable `Program`; i.e., `Program` implicitly initialized as
    25     *  follows:
    26     *  @p(code)
    27     *      var Program = xdc.useModule('xdc.cfg.Program');
    28     *  @p
    29     *
    30     *  After a configuration script completes successfully, the XDC runtime
    31     *  generates the following files:
    32     *  @p(nlist)
    33     *      - package/cfg/<exe_name>.c
    34     *      - package/cfg/<exe_name>.xdl
    35     *  @p
    36     *  where `<exe_name>` is the name of the executable with the final '.'
    37     *  character replaced with an '_'.
    38     *
    39     *  The generated C file contains code and data from each module used by the
    40     *  program and must be compiled and linked with the other sources to
    41     *  produce the final executable.
    42     *
    43     *  The generated linker command file must also be used during this final
    44     *  link step.  This linker command file is produced by expanding a template
    45     *  specified by `{@link xdc.cfg.Program#linkTemplate}`.
    46     *  Each template is responsible for expanding templates specified by each
    47     *  imported package's `getSects` method (see `{@link xdc.IPackage#getSects}`).
    48     *  This allows each package participating in the configuration of an
    49     *  executable to contribute a portion of the executable's linker command file.
    50     */
    51    
    52    @Template("./Program.xdt")
    53    
    54    metaonly module Program {
    55    
    56        /*!
    57         *  ======== GenerationOptions ========
    58         *  Options that control the files generated as part of program
    59         *  configuration.
    60         *
    61         *  @field(debuggerFiles) If set to `true` in a configuration script,
    62         *          debugger project files will be generated as part of the
    63         *          configuration step.  If set to `false`, these files will not 
    64         *          be generated.
    65         *
    66         *          If it is not set (or set to undefined) and the environment
    67         *          variable `environment["xdc.cfg.gen.debuggerFiles"]` is
    68         *          non-`null`, then the default value of this parameter is taken
    69         *          to be the value of the following expression:
    70         *          @p(code)
    71         *              environment["xdc.cfg.gen.debuggerFiles"] == "true"
    72         *          @p
    73         *          This makes it is possible to enable the generation of
    74         *          debugger project files from build scripts by passing
    75         *          the option `-Dxdc.cfg.gen.debuggerFiles=true` to the
    76         *          configuration tool (see
    77         *          `{@link xdc.bld.Executable#Attrs.xsopts}` or
    78         *          `{@link xdc.bld.PackageContents#Attrs.xsopts}`).
    79         *
    80         *          Finally, if `debuggerFiles` is not set (or set to `undefined`)
    81         *          and the environment variable above is not defined,
    82         *          the generation of debugger project files occurs only if
    83         *          `{@link xdc.cfg.Program#build.profile}` contains
    84         *          the string `"debug"`.  So, unless otherwise specified, debug
    85         *          profiles result in debugger project files being generated.
    86         */
    87        struct GenerationOptions {
    88            Bool debuggerFiles; /*! if `true`, generate debugger "project" files */
    89        };
    90    
    91        /*!
    92         *  ======== SectionSpec ========
    93         *  Map that instructs the linker where to place output sections.
    94         *
    95         *  This structure contains some fields that are specific to TI targets.
    96         *  On non-TI targets, such fields are ignored.
    97         *
    98         *  @field(runSegment) Defines the memory segment where the section is
    99         *          to be run.
   100         *  
   101         *  @field(loadSegment) Defines the memory segment where the section is
   102         *          to be loaded. If 'runSegment' or 'loadSegment' is defined,
   103         *          but not both, the linker is instructed to use the defined
   104         *          field as the load and run allocation for the section. 
   105         *
   106         *  @field(runAddress) Defines the memory address where the section is
   107         *          to be run. It is an error if both 'runSegment' and 'runAddress'
   108         *          are specified.
   109         *  
   110         *  @field(loadAddress) Defines the memory address where the section is
   111         *          to be loaded. It is an error if both 'loadSegment' and
   112         *          'loadAddress' are specified. If 'runAddress' or 'loadAddress'
   113         *          is defined, but not both, the linker is instructed to use the
   114         *          defined field as the load and run address for the section.
   115         *
   116         *  @field(runAlign) If runSegment is specified, runAlign determines the
   117         *          alignment. It is an error if both 'runAlign' and 'runAddress'
   118         *          are specified.
   119         *  
   120         *  @field(loadAlign) If runSegment is specified, runAlign determins the
   121         *          alignment. It is an error if both 'loadAlign' and 'loadAddress'
   122         *          are specified.
   123         *
   124         *  @field(type) Defines flags for special section types (COPY, DSECT,
   125         *          NOLOAD).
   126         *
   127         *  @field(fill) Defines the value to initialize an uninitialized
   128         *  section.
   129         */
   130        struct SectionSpec {
   131            String runSegment;  /*! segment where section contents are run */
   132            String loadSegment; /*! segment where section contents are loaded */
   133            UInt runAddress;    /*! start address of section when run */
   134            UInt loadAddress;   /*! start address of section when loaded */
   135            UInt runAlign;      /*! alignment of section within runSegment */
   136            UInt loadAlign;     /*! alignment of section within loadSegment */
   137            String type;        /*! target-specific flags */
   138            UInt fill;          /*! fill value */
   139        };
   140    
   141        /*!
   142         *  ======== gen ========
   143         *  Generation options for this executable
   144         *
   145         *  This configuration parameter allows the program configuration script
   146         *  to control (to some extent) what files are generated as part of the
   147         *  configuration process.
   148         */
   149        config GenerationOptions gen;
   150        
   151        /*!
   152         *  ======== globalSection ========
   153         *  UNDER CONSTRUCTION
   154         *  @_nodoc
   155         *
   156         *  Section where `{@link #globals}` are placed.
   157         *
   158         *  All globals specified in the application configuration file
   159         *  are placed into this section.
   160         *
   161         *  The default is `null`, which means the `{@link #dataSection}` is used.
   162         */
   163        config String globalSection = null;
   164    
   165        /*!
   166         *  ======== sysStack ========
   167         *  The size of the executable's initial system stack
   168         *
   169         *  On architectures that maintain a separate "system stack" in addition
   170         *  to the normal `{@link #stack}`, this parameter sets its initial size
   171         *  (in units of chars).  This parameter is ignored for those
   172         *  architectures for which there is just a single stack; in other
   173         *  words, almost all known architectures.
   174         *
   175         *  This parameter is used on later generation TI/C55 16-bit DSPs where,
   176         *  in order to compatibly support 24-bit addresses, a separate
   177         *  system call/return stack that stores the upper address bits is
   178         *  employed.  
   179         */
   180        config UInt sysStack = 0x1000;
   181    
   182        /*!
   183         *  ======== stack ========
   184         *  The size of the executable's initial stack
   185         *
   186         *  On platforms that enable control of the initial stack size (the
   187         *  stack that exists immediately after reset), this parameter specifies
   188         *  its initial size (in units of chars).
   189         */
   190        config UInt stack = 0x1000;
   191    
   192        /*!
   193         *  ======== heap ========
   194         *  The size of the executable's initial heap
   195         *
   196         *  On platforms that enable control of the size of the heap managed by
   197         *  the run-time support function malloc(), this parameter specifies
   198         *  its initial size (in units of chars).
   199         */
   200        config UInt heap = 0x1000;
   201    
   202        /*!
   203         *  ======== argSize ========
   204         *  The size allocated for command line args to the executable
   205         *
   206         *  On platforms that require static allocation of space to hold
   207         *  command line arguments, this parameter specifies its maximum size
   208         *  (in units of chars).
   209         *
   210         *  Command line arguments are passed to C's `main` function when it's
   211         *  declared via the prototype: `int main(int argc, char *argv[])`.  the
   212         *  `argv` array points to an array of strings allocated from the
   213         *  memory block whose size is controlled by `argSize`.
   214         *
   215         *  Setting `argSize` to 0 means that no `argv` array will be allocated
   216         *  and the application `main()` function should be declared as
   217         *  `int main(void)`.
   218         */
   219        config UInt argSize = 0x200;
   220    
   221        /*!
   222         *  ======== execCmd ========
   223         *  The command used to run this executable
   224         *
   225         *  This string is used to create a command that runs the executable
   226         *  from the command line.  If it is not set by the configuration script,
   227         *  it is set by the program's platform package (during program
   228         *  configuration).
   229         *
   230         *  This command is run as follows:
   231         *  @p(code)
   232         *      execCmd <prog> <args>
   233         *  @p
   234         *  where, `<prog>` is the name of the executable and `<args>` are
   235         *  the arguments specified in the test (if any).
   236         *
   237         *  @a(Note)
   238         *  This parameter is ignored if the exec command is specified as part
   239         *  of the test; see `{@link xdc.bld.Test#Attrs}`.
   240         */
   241        config String execCmd;
   242    
   243        /*!
   244         *  ======== linkTemplate ========
   245         *  The template for the Program's linker command file
   246         *
   247         *  A template is used to create the linker command file for each
   248         *  program.  It can be optionally specified by setting this
   249         *  configuration parameter in the program's configuration script.  If
   250         *  `linkTemplate` it is not set or set to `null`, the template is
   251         *  obtained from the platform associated with this program (i.e., the
   252         *  platform named by the `{@link #platform}` config in this module).
   253         *  See `{@link xdc.platform.IPlatform#getLinkTemplate IPlatform.getLinkTemplate}`.
   254         *
   255         *  The `linkTemplate` string names a package path relative path; e.g.,
   256         *  if the linker template you want to specify is
   257         *  `"templates/big_n_hairy.xdt"` in the package `myCompany.myPackage`,
   258         *  `linkTemplate` should be set to:
   259         *  @p(code)
   260         *      "myCompany/myPackage/templates/big_n_hairy.xdt"
   261         *  @p
   262         *  If `linkTemplate` begins with the string `"./"`, the file is NOT
   263         *  searched for along the package path; instead the file name is taken
   264         *  to specify a file relative to the current working directory.
   265         *
   266         *  In any case, if `linkTemplate` is non-`null`, the file must exist; 
   267         *  otherwise, the configuration step will fail.
   268         */
   269        config String linkTemplate = null;
   270        
   271        /*!
   272         *  ======== main ========
   273         *  The main entry point for the program
   274         *
   275         *  This parameter is optionally set by the user's program
   276         *  configuration script.  If it is not set, then a "legacy" `main()`
   277         *  function is assumed to be linked into the program; otherwise,
   278         *  the value of `main` is used as the "main" entry point to the
   279         *  program.
   280         */
   281        config Int (*main)(Int, Char*[]);
   282    
   283        /*!
   284         *  ======== sectMap ========
   285         *  A section name to SectionSpec mapping
   286         *
   287         *  This is a program specific mapping of output section names to
   288         *  {@link #SectionSpec} objects. The map supports mapping of section
   289         *  names to memory names; see {@link xdc.platform.IPlatform#sectMap}.
   290         *
   291         *  This parameter enables program configurations to place named
   292         *  sections in platform specific memory regions.  During generation of
   293         *  the linker command file, sections are mapped to named memories by
   294         *  first consulting this table; if the table does not contain a mapping,
   295         *  the target classifies each section as either "code", "data" or
   296         *  "stack" {@link xdc.bld.ITarget#sectMap} and the platform defines a
   297         *  memory region for each of these section types
   298         *  ({@link xdc.platform.IPlatform#codeMemory}/
   299         *  {@link xdc.platform.IPlatform#dataMemory}).  If
   300         *  this does not produce a result, an error is generated.
   301         *  It is important to note that `sectMap` does not contain the complete
   302         *  section allocation for the program. It only contains the entries
   303         *  explicitly added to `sectMap`. To get the complete section
   304         *  allocation, a user should call {@link #getSectMap}.
   305         *
   306         *  Suppose for example that the platform defines a memory segment
   307         *  named "DDR2".  The following configuration statement places
   308         *  everything from the ".text" section into the "DDR2" segment.
   309         *
   310         *  @p(code)
   311         *      Program.sectMap[".text"] = new Program.SectionSpec();
   312         *      Program.sectMap[".text"].loadSegment = "DDR2";
   313         *  @p
   314         *
   315         *  @a(Note)
   316         *  If BIOS 5 configuration script (Tconf script) is executed, the
   317         *  section allocations configured in the Tconf script take precedence
   318         *  over any settings for the same sections in this parameter.
   319         *
   320         *  @see #SectionSpec
   321         *  @see xdc.platform.IPlatform#sectMap
   322         *  @see xdc.bld.ITarget#sectMap
   323         */
   324        config Any sectMap[string]; /* section name => SectionSpec */
   325    
   326        /*!
   327         *  ======== sectionsExclude ========
   328         *  Sections to exclude from linker command file generation
   329         *
   330         *  The `sectionsExclude` string is a JavaScript regular expression
   331         *  that is used to identify names of sections that should NOT be
   332         *  be handled by the normal linker command file generation process.
   333         *
   334         *  Sections whose name matches `sectionsExclude` must be handled
   335         *  using a custom linker command file or by specifying a custom template
   336         *  (see `{@link #sectionsTemplate}` or `{@link #linkTemplate}`).
   337         *  @a(Examples)
   338         *  To completely override the placement of all output sections you can
   339         *  define `sectionsExclude` to match any string.
   340         *  @p(code)
   341         *      // Note: the '.' below represents _any_ character, not just "."
   342         *      Program.sectionsExclude = ".*";
   343         *  @p
   344         *  To override output sections that begin with '.' you must specify
   345         *  the literal character '.' and use the '^' character to match the
   346         *  beginning of the string.
   347         *  @p(code)
   348         *      // the sequence '^\.' matches just "." at the start of the name
   349         *      Program.sectionsExclude = "^\.";
   350         *  @p
   351         *  To override a specific sections you should be careful to supply a
   352         *  regular expression that matches the entire section name.  You can
   353         *  use '$' to match the end of the name.
   354         *  @p(code)
   355         *      // match only ".const" or ".text"
   356         *      Program.sectionsExclude = "^\.const$|^\.text$";
   357         *  @p
   358         */
   359        config String sectionsExclude = null;
   360    
   361        /*!
   362         *  ======== sectionsTemplate ========
   363         *  Replace the sections portion of the generated linker command file
   364         *
   365         *  The `sectionsTemplate` string names a template that is used to replace
   366         *  the "`SECTIONS`" content to the generated linker command file.  This
   367         *  is useful especially when excluding specific sections via
   368         *  `{@link #sectionsExclude}` or when taking full control of the linker
   369         *  command file via `{@link #linkTemplate}` is unnecessary.  The original
   370         *  "`SECTIONS`" content is computed and passed as an argument to this
   371         *  template, which makes it relatively simple to perform small changes to
   372         *  the "`SECTIONS`" content without having to explicitly handle every
   373         *  section required by the compiler toolchain.
   374         *
   375         *  The `sectionsTemplate` string names a package path relative path; e.g.,
   376         *  if the linker template you want to specify is
   377         *  `"templates/mySections.xdt"` in the package `myCompany.myPackage`,
   378         *  `sectionsTemplate` should be set to:
   379         *  @p(code)
   380         *      "myCompany/myPackage/templates/mySections.xdt"
   381         *  @p
   382         *  If `sectionsTemplate` begins with the string `"./"`, the file is NOT
   383         *  searched for along the package path; instead the file name is taken
   384         *  to specify a file relative to the current working directory.
   385         *
   386         *  In any case, if `sectionsTemplate` is non-`null`, the file must exist; 
   387         *  otherwise, the configuration step will fail.
   388         *
   389         *  During expansion of this template, there are three "parameters"
   390         *  that can be referenced to generate new content.
   391         *  @p(dlist)
   392         *      - `this`
   393         *          reference to the `{@link Program}` object
   394         *      - `$args[0]`
   395         *         is the complete section map derived from
   396         *         `{@link Program#sectMap}`; some special sections relavent to
   397         *         XDCtools are added to the map defined by `Program.sectMap`.
   398         *      - `$args[1]`
   399         *         is a string that contains the content that would have been
   400         *         placed in the `SECTIONS` portion of the generated linker
   401         *         command file.  This allows templates to easily modify this
   402         *         content or simply add statements before or after it.
   403         *  @p
   404         *  @a(Example)
   405         *  The following template, specific to TI compiler tools, adds start
   406         *  and size symbols for the `.stack` section and ensures that the stack
   407         *  is the first section to be allocated in its designated memory segment.
   408         *  @p(code)
   409         *    %// first output allocation for the .stack section
   410         *    %var sectMap = $args[0];
   411         *    %var stack = sectMap[".stack"];
   412         *       .stack: >`stack.loadSegment` START(_stack_start) SIZE(_stack_size)
   413         *    %
   414         *    %// now append the normally generated content
   415         *    `$args[1]`
   416         *  @p
   417         *  Note: this example requires that the `.stack` section be excluded
   418         *  from the normal generation via `{@link sectionsExclude}`; otherwise
   419         *  this section will be specified twice by the template shown above.
   420         *  @p(code)
   421         *      Program.sectionsExclude = "^\.stack$";
   422         *  @p
   423         */
   424        config String sectionsTemplate = null;
   425        
   426        /*!
   427         *  ======== system ========
   428         *  @_nodoc
   429         *  A facade for the {@link xdc.runtime.System#SupportProxy} parameter
   430         *
   431         *  The program configuration script may select an implementation of
   432         *  the `xdc.runtime.ISystemSupport` interface and "bind" it by setting
   433         *  this parameter. If the module assigned to this parameter does not
   434         *  inherit from `xdc.runtime.ISystemSupport`, the configuration will fail.
   435         *
   436         *  If this parameter is not set (or set to `undefined`), then a default
   437         *  implementation is used: `xdc.runtime.SysStd` or, if
   438         *  `Program.build.target.os` is `null`, `xdc.runtime.SysMin`.  Recall that
   439         *  `Program.build.target.os` is specified in the Build Object Model;
   440         *  `Program.build.target` is the target specified when the executable was
   441         *  added to the package.
   442         *
   443         *  If this parameter is set to `null`, then the `System` module is not
   444         *  linked into the application (unless 'Memory' is used); any references
   445         *  to `System`'s methods will result in a linker error.  By setting this
   446         *  parameter to `null`, one is asserting that `System`'s methods will not 
   447         *  be used.
   448         */
   449        config Any system;
   450    
   451        /*!
   452         *  ======== name ========
   453         *  The name of the executable file
   454         *
   455         *  This is the full file name (relative to the package's base) of the
   456         *  executable that results from this configuration.
   457         *
   458         *  @a(readonly)
   459         *  This parameter is set by the generated program configuration script
   460         *  and must not be modified.
   461         */
   462        config String name;
   463    
   464        /*!
   465         *  ======== cfgBase ========
   466         *  UNDER CONSTRUCTION
   467         *  @_nodoc
   468         */
   469        config String cfgBase;
   470    
   471        /*!
   472         *  ======== buildPackage ========
   473         *  The name of the executable's package
   474         *
   475         *  This is the full package name (relative to the package's repository)
   476         *  of the package that contains the executable being configured.
   477         *
   478         *  @a(readonly)
   479         *  This parameter is set by the generated program configuration script
   480         *  and must not be modified.
   481         */
   482        config String buildPackage;
   483    
   484        /*!
   485         *  ======== endian ========
   486         *  The endianess of the executable
   487         *
   488         *  This parameter is an alias for `build.target.model.dataModel` and is
   489         *  set to one of the following values: `"big"`, `"little"`, or `null`.
   490         *
   491         *  @a(readonly)
   492         *  This parameter is set by the generated program configuration script
   493         *  and must not be modified.
   494         */
   495        config String endian = null;
   496    
   497        /*!
   498         *  ======== codeModel ========
   499         *  The memory model for code
   500         *
   501         *  This parameter is an alias for `build.target.model.codeModel` and is
   502         *  set to one of the following target-specific values: `"near"`, `"far"`,
   503         *  `"large"`, or `null`.
   504         *
   505         *  @a(readonly)
   506         *  This parameter is set by the generated program configuration script
   507         *  and must not be modified.
   508         */
   509        config String codeModel = null;
   510    
   511        /*!
   512         *  ======== dataModel ========
   513         *  The memory model for data
   514         *
   515         *  This parameter is an alias for `build.target.model.dataModel` and is
   516         *  set to one of the following target-specific values: `"near"`, `"far"`,
   517         *  `"large"`, or `null`.
   518         *
   519         *  @a(readonly)
   520         *  This parameter is set by the generated program configuration script
   521         *  and must not be modified.
   522         */
   523        config String dataModel = null;
   524    
   525        /*!
   526         *  ======== build ========
   527         *  This program's build attributes
   528         *
   529         *  This parameter allows arbitrary build attributes to be carried
   530         *  forward from the Build Object Model (BOM) into the configuration
   531         *  model for program configuration scripts to read.
   532         *
   533         *  Conceptually, this config parameter should be declared as follows:
   534         *  @p(code)
   535         *      struct BuildAttrs inherits xdc.bld.Executable.Attrs {
   536         *          config xdc.bld.ITarget.Module target;
   537         *      };
   538         *  @p
   539         *  All parameters of the target associated with the executable being
   540         *  configured are available through '`Program.build.target`'. Any config
   541         *  parameter set in the BOM's `{@link xdc.bld.Executable#attrs}` is also
   542         *  available through `{@link #build}`.  For example, the name of the
   543         *  target is `Program.build.target.name` and the name of the
   544         *  executable's configuration script is `Program.build.cfgScript`.
   545         *
   546         *  @a(readonly)
   547         *  This parameter is set by the generated program configuration script
   548         *  and must not be modified.
   549         */
   550        config Any build;   /*  BuildAttrs */
   551        
   552        /*!
   553         *  ======== cpu ========
   554         *  The execution context "seen" by the executable.
   555         *
   556         *  Since the execution context is largely determined by the CPU that
   557         *  runs the executable, this configuration parameter allows scripts with
   558         *  access to the program object to conditionally configure based on CPU
   559         *  characteristics (e.g., ISA or revision of a chip).
   560         *
   561         *  @a(readonly)
   562         *  This parameter is set by the platform's implementation of
   563         *  `xdc.IPackage` (i.e., `package.xs`).
   564         */
   565        config xdc.platform.IExeContext.Instance cpu;
   566    
   567        /*!
   568         *  ======== platformName ========
   569         *  The name of the executable's platform
   570         *
   571         *  This field is the name of the platform instance used to create the
   572         *  executable; e.g., `"ti.platforms.sim55xx"`, or
   573         *  `"ti.platforms.sim6xxx:TMS320C6416"`.
   574         *
   575         *  Platform instance names have the form:
   576         *  @p(code)
   577         *      <platform_pkg>:<instance_id>
   578         *  @p
   579         *  where `<platform_pkg>` is the name of the platform package 
   580         *  responsible for creating the platform instance and the optional
   581         *  "`:<instance_id>`" is a suffix that uniquely identifies the creation
   582         *  parameters for this instance.
   583         *
   584         *  The creation parameters are the values specified by the map
   585         *  `{@link xdc.bld.BuildEnvironment#platformTable}`;
   586         *  if this map does not contain the platform instance name, the
   587         *  instance is created with default values that are specific to the
   588         *  platform.
   589         *
   590         *  @a(readonly)
   591         *  This parameter is set by the generated program configuration script
   592         *  and must not be modified.
   593         */
   594        config String platformName;
   595    
   596        /*!
   597         *  ======== platform ========
   598         *  The executable's platform instance object
   599         *
   600         *  The platform instance that provided an execution context for the
   601         *  executable being configured.
   602         *
   603         *  @a(readonly)
   604         *  This parameter is set by the generated program configuration script
   605         *  and must not be modified.
   606         */
   607        config xdc.platform.IPlatform.Instance platform;
   608    
   609        /*!
   610         *  ======== global ========
   611         *  Global variable declarations
   612         *
   613         *  Assignments to this hash table become global symbols that can be
   614         *  used to directly reference objects.  These objects are declared
   615         *  in a generated header that is indirectly included by the header
   616         *  `xdc/cfg/global.h`.
   617         *
   618         *  Configuration scripts define symbols by adding new properties to
   619         *  `global`.
   620         *  @p(code)
   621         *      Program.global.myInstance = Mod.create();
   622         *      Program.global.myString = "hello world";
   623         *  @p
   624         *
   625         *  Programs can reference the symbols defined in `global` by including
   626         *  the C/C++ header `xdc/cfg/global.h` as follows:
   627         *  @p(code)
   628         *      #include <pkg/Mod.h>
   629         *      #include <xdc/cfg/global.h>
   630         *         :
   631         *      Mod_fxn(myInstance, ...);
   632         *      printf("greetings: %s\n", myString);
   633         *  @p
   634         *
   635         *  To compile sources that include `xdc/cfg/global.h`, one symbol must be
   636         *  defined before including this header:
   637         *  @p(dlist)
   638         *      - `xdc_cfg__header__`
   639         *          the package qualified name of the executable-specific C/C++
   640         *          header generated by the program configuration tool; e.g.,
   641         *          `local/examples/package/cfg/mycfg_x62.h`.
   642         *  @p
   643         *  For example, to compile sources that reference the values declared in
   644         *  `{@link #global}` for a TI C6x target with a generated
   645         *  configuration header named `package/cfg/mycfg_x62.h` in a package
   646         *  named `local.examples` the following command line is sufficient:
   647         *  @p(code)
   648         *      cl6x -Dxdc_cfg__header__=local/examples/package/cfg/mycfg_x62.h ...
   649         *  @p
   650         *
   651         *  The `xdc_cfg__header__` symbol is automatically defined when you use
   652         *  the the XDC Build Engine (`{@link xdc.bld}`) to create executables; see
   653         *  `{@link xdc.bld.Executable#addObjects}`
   654         *
   655         *  @see xdc.bld.Executable#addObjects
   656         */
   657        config Any global[string];
   658    
   659        /*!
   660         *  ======== symbol ========
   661         *  Global symbol specifications
   662         *
   663         *  UNDER CONSTRUCTION
   664         *  @_nodoc
   665         *
   666         *  This map contains symbol definitions that are used to define alises
   667         *  or constants.  Symbol names are the C symbol names; i.e., compiler name
   668         *  mangling, such as the addition of a leading "_", is performed
   669         *  automatically.
   670         *
   671         *  @a(Examples)
   672         *  To define a symbolic constant:
   673         *  @p(code)
   674         *      Program.symbol["ONE"] = 1;
   675         *  @p
   676         *  The line above causes the symbol "ONE" to be defined in the linker
   677         *  command file to be equal to 1.  Note this in contrast to defining a
   678         *  variable whose value is 1; symbols do not occupy space, they are just
   679         *  symbolic constants defined in the symbol table of the executable.
   680         *
   681         *  This is currently used by xdc.runtime.Startup to define symbols
   682         *  optionally referenced by boot files that support early startup
   683         *  "reset" functions.
   684         *
   685         *  The only other use of this map is to define symbolic names for 
   686         *  statically created instances as part of the support for legacy
   687         *  BIOS 5 instance names.
   688         */
   689        config Any symbol[string];
   690    
   691        /*!
   692         *  ======== exportModule ========
   693         *  Force all the symbols of a module to be part of a configuration
   694         *
   695         *  Although a call xdc.useModule() will force some of a module's methods
   696         *  to be part of a configuration, the linker is still free to omit any
   697         *  symbols that are not referenced.  Use of exportModule will force all
   698         *  methods of the specified module to be available.
   699         */
   700        Void exportModule(String modName);
   701    
   702        /*!
   703         *  ======== getSectMap ========
   704         *  Return the complete mapping of section names to `{@link #SectionSpec}`
   705         *  entries
   706         *
   707         *  The returned map is assembled from `{@link xdc.bld.ITarget#sectMap}`,
   708         *  `{@link xdc.platform.IPlatform#sectMap}`,
   709         *  `{@link xdc.platform.IPlatform#codeMemory}`,
   710         *  `{@link xdc.platform.IPlatform#dataMemory}`,
   711         *  `{@link xdc.platform.IPlatform#stackMemory}` and `{@link #sectMap}`.
   712         *  The function can be called at any time during configuration, but if
   713         *  it is called before all packages had a chance to change `sectMap`,
   714         *  the returned map may not correspond to the actual section
   715         *  allocation as configured in the linker command file.
   716         *
   717         *  @a(returns)
   718         *  `getSectMap` returns a map with section names as keys and
   719         *  `{@link #SectionSpec}` entries as values.
   720         *
   721         *  @a(Note)
   722         *  If BIOS 5 configuration script (Tconf script) is executed, the
   723         *  section allocations configured in the Tconf script are also being
   724         *  returned.
   725         */
   726        function getSectMap();
   727    
   728        /*!
   729         *  ======== importAssembly ========
   730         *  UNDER CONSTRUCTION
   731         *  @_nodoc
   732         */
   733        Void importAssembly(String asmName);
   734    
   735        /*!
   736         *  ======== targetModules ========
   737         *  UNDER CONSTRUCTION
   738         *  @_nodoc
   739         *
   740         *  This function returns a list of target modules. The list is completed
   741         *  only after all packages are closed, and runtime.finalized() is closed,
   742         *  so the only time when this function can be safely called is from
   743         *  within module$static$init and instance$static$init functions, package
   744         *  validate() functions, and templates.
   745         */
   746        function targetModules();
   747    
   748        /*!
   749         *  ======== freezeRomConfig ========
   750         *  UNDER CONSTRUCTION
   751         *  @_nodoc
   752         */
   753        Void freezeRomConfig(String modName, String cfgName);
   754    
   755        /*!
   756         *  ======== freezeRomConfig2 ========
   757         *  UNDER CONSTRUCTION
   758         *  @_nodoc
   759         */
   760        function freezeRomConfig2(mod, cfgName);
   761    
   762        /*!
   763         *  ======== freezeRomParams ========
   764         *  UNDER CONSTRUCTION
   765         *  @_nodoc
   766         */
   767        function freezeRomParams(mod);
   768    
   769        /*!
   770         *  ======== frozenRomConfig ========
   771         *  UNDER CONSTRUCTION
   772         *  @_nodoc
   773         */
   774        Bool frozenRomConfig(String modName, String cfgName);
   775    
   776        /*!
   777         *  ======== frozenRomConfig2 ========
   778         *  UNDER CONSTRUCTION
   779         *  @_nodoc
   780         */
   781        function frozenRomConfig2(mod, cfgName);
   782    }
   783    /*
   784     *  @(#) xdc.cfg; 1, 0, 2, 0,339; 7-14-2011 17:21:54; /db/ztree/library/trees/xdc/xdc-x16x/src/packages/
   785     */
   786