1    /* 
     2     *  Copyright (c) 2013 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     *  ======== Main ========
    14     *  Command-line configuration tool for IAR Embedded Workbench
    15     *
    16     *  This command-line tool computes the appropriate configuro options from the
    17     *  set of options passed from the IAR Workbench (for ex. target/platform
    18     *  from compile options). With these options, the xdc.tools.configuro tool
    19     *  is executed to compute the set of libraries, command-line flags and
    20     *  the other artifacts needed to build the application in IAR Workbench.
    21     *
    22     *  @a(INPUTS)
    23     *  @p(dlist)
    24     *    - `-o outdir (Optional)`
    25     *      Optionally an output directory can be provided.
    26     *    - `-c codegen_dir`
    27     *      Root directory of the code generation tools.
    28     *    - `--device device_name_string`
    29     *      The name of the device.
    30     *    - `--compileOptions compile_options_string`
    31     *      The command line options passed to the compiler.
    32     *    - `--linkOptions linker_options_string`
    33     *      The command line options passed to the linker.
    34     *    - `--profile profile`
    35     *      The build profile.
    36     *    - `--projFile project_file (Optional)`
    37     *      IAR Embedded Workbench project file. This is optional when 
    38     *      infile.cfg is passed on command line.
    39     *    - `infile.cfg (Optional)`
    40     *      A user-supplied configuration script that names a set of RTSC
    41     *      modules, and optionally changes their configuration settings. 
    42     *      If provided, it will override the --projFile option.
    43     *  @p
    44     *
    45     *  @a(OUTPUTS)
    46     *  @p(dlist)
    47     *    - `outdir/`
    48     *      A directory containing all generated build artifacts.
    49     *    - `outdir/compiler.defs`
    50     *      A file containing C compiler command-line flags. These flags must
    51     *      included on the compiler command line for any C source file that
    52     *      directly accesses the RTSC content. The flags define the header file
    53     *      and include paths to ensure object code compatibility between all
    54     *      all included content.
    55     *    - `outdir/linker.cmd`
    56     *      A file containing linker command-line flags. These flags must be
    57     *      included on the linker command line for the final link of the
    58     *      application. The flags list needed libraries and object files,
    59     *      and on some platforms define the embedded system memory map.
    60     *  @p
    61     *
    62     *  For example:
    63     *  @p(code)
    64     *      xs iar.tools.configuro -c "<codegen_dir>" --cc "<compiler>"
    65     *         --device "<device_name>" -compileOptions "<compiler_options>"
    66     *         --linkOptions "<link_options>" --profile "<profile>" infile.cfg
    67     *  @p
    68     */
    69    metaonly module Main inherits xdc.tools.ICmd {
    70    
    71        /*!
    72         * usage help message
    73         */
    74        override config String usage[] = [
    75            '[-o outdir (optional)]',
    76            '[-c codegen_dir]',
    77            '[--cc compiler_name_string]',
    78            '[--device device_name]',
    79            '[--compileOptions compile_options_string]',
    80            '[--linkOptions linker_options_string]',
    81            '[--profile profile]',
    82            '[--projFile project_file (optional)]',
    83            'infile.cfg (optional)'
    84        ];
    85    
    86    instance:
    87    
    88        /*!
    89         *  ======== output ========
    90         *  Pathname of the output directory
    91         *
    92         *  A directory containing the generated build artifacts, in particular
    93         *  the `compiler.defs` and `linker.cmd` files.
    94         *
    95         *  The last component of the output directory path must be a valid
    96         *  ANSI C identifier; i.e., it must consist entirely of alphanumeric or
    97         *  '_' characters and must not start with a number.  So, the names
    98         *  '0app' and 'app-test' are not valid but '0app/config' and
    99         *  'app-test/config' are valid.
   100         *
   101         *  This is optional parameter. By default, the output directory has the
   102         *  name `configPkg` and will be  within the `{#cfgDir}` directory.
   103         */
   104        @CommandOption("o")
   105        config String output = "";
   106    
   107        /*!
   108         *  ======== rootDir ========
   109         *  Root directory of the code generation tools
   110         *
   111         *  The path to the installation directory of the compiler and linker
   112         *  for the selected target. The definition of "installation directory"
   113         *  can vary from compiler to compiler, but is most commonly the
   114         *  directory that contains a "bin" subdirectory.
   115         */
   116        @CommandOption("c")
   117        config String rootDir = null;
   118    
   119        /*!
   120         *  ======== compiler ========
   121         *  @_nodoc
   122         *  The name of the compiler
   123         *
   124         *  The compiler name is required to find the target and platform
   125         *  xdc.tools.configuro options.
   126         */
   127        @CommandOption("cc")
   128        config String compiler = "";
   129    
   130        /*!
   131         *  ======== device ========
   132         *  The name of the device
   133         *
   134         *  The device name has to be passed to the xdc.tools.configuro tool.
   135         */
   136        @CommandOption("device")
   137        config String device = null;
   138    
   139        /*!
   140         *  ======== compileOptions ========
   141         *  Compile options used for building C files
   142         *
   143         *  The compiler options are required to find the target and platform
   144         *  options for xdc.tools.configuro. 
   145         */
   146        @CommandOption("compileOptions")
   147        config String compileOptions = null;
   148    
   149        /*!
   150         *  ======== linkOptions ========
   151         *  Linker options used for linking libraries
   152         *
   153         *  The linker options are required to pull in the correct libraries 
   154         *  during link. 
   155         */
   156        @CommandOption("linkOptions")
   157        config String linkOptions = null;
   158    
   159        /*!
   160         *  ======== profile ========
   161         *  Build profile
   162         */
   163        @CommandOption("profile")
   164        config String profile = "";
   165    
   166        /*!
   167         *  ======== projFile ========
   168         *  IAR Embedded project file.
   169         *
   170         *  This file is searched for the RTSC configuration file (.cfg).
   171         */
   172        @CommandOption("projFile")
   173        config String projFile = "";
   174    }
   175    /*
   176     *  @(#) iar.tools.configuro; 1, 0, 0,39; 5-30-2015 10:00:46; /db/ztree/library/trees/xdctools/xdctools-f62x/src/
   177     */
   178