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