public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Sergei Gavrikov <sergei.gavrikov@gmail.com>
To: Bart Veer <bartv@ecoscentric.com>
Cc: Tyler Wilson <TWilson@ugobe.com>, ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] changing compile source in cdl based on platform
Date: Mon, 01 Dec 2008 20:55:00 -0000	[thread overview]
Message-ID: <20081201193924.GA21262@ubuntu.local> (raw)
In-Reply-To: <pn4p1nrack.fsf@delenn.bartv.net>

On Mon, Dec 01, 2008 at 06:58:35PM +0000, Bart Veer wrote:
> >>>>> "Tyler" == Tyler Wilson <TWilson@ugobe.com> writes:
> 
>     Tyler> FYI, I looked through the CDL guide, but could not find an
>     Tyler> answer. I apologize if it is in there, but I think I did
>     Tyler> try.
> 
>     Tyler> I have a component I am adding to our eCos repository, via
>     Tyler> the CDL. One of the modules has assembly language versions
>     Tyler> for different platforms - x86, ARM, etc. I would like to
>     Tyler> know how to specify this in the CDL properly. Something
>     Tyler> like
> 
>     Tyler> cdl_option CYG_USE_ASM {
>     Tyler>     compile  {
>     Tyler>         if is_defined(HAL_ARM) {
>     Tyler>             arm_version.S
>     Tyler>         }
>     Tyler>         if is_defined(HAL_X86) {
>     Tyler>             x86_version.S
>     Tyler>         }
>     Tyler>     }
>     Tyler> }
> 
>     Tyler> I know these are really just Tcl scripts, but I am not
>     Tyler> familiar enough with Tcl to know the proper syntax, and I
>     Tyler> thought it would be easier for somebody on this list to
>     Tyler> give me an example.
> 
> Right now there is no easy way of doing this. The syntax should be
> something like:
> 
>   cdl_option CYG_USE_ASM {
>       when { CYGPKG_HAL_ARM } {
>           compile arm_version.S
>       }
>       when { CYGPKG_HAL_I386 } {
>           compile  x86_version.S
>       }
>   }
> 
> But as with many other parts of the CDL language, the "when" property
> is not currently implemented it. There are two work-arounds:
> 
> 1) create some dummy calculated options and put the compile properties
>    in there.
> 
>    cdl_component CYG_USE_ARM {
>        ...
>        cdl_option CYG_USE_ASM_ARM {
>            calculated CYGPKG_HAL_ARM
> 	   compile arm_version.S
>        }
>        cdl_option CYG_USE_ASM_I386 {
>            calculated CYGPKG_HAL_I386
> 	   compile x86_version.S
>        }
>    }
> 
>    The disadvantage is that you end up with yet more "options" which
>    serve no real purpose, i.e. which clutter up the display in the
>    configtool but cannot be changed by the user.
> 
> 2) just build all of them, but put #ifdef's in each module, e.g. in
>    arm_version.S: 
> 
>      #include <pkgconf/system.h>
>      #ifdef CYGPKG_HAL_ARM
>      <main body of file>
>      #endif
> 
>    The disadvantage is that you end up compiling more files than
>    needed, but compiling a file that ends up all #ifdef'd out adds
>    very little to the system build time.  
> 
> On the whole I would prefer option (2).   
 
Nice tutorial! I would prefer option (2) too. I wonder will it work

cdl_option CYGBLD_BUILD_FOO_ARM {
    requires { is_substr(CYGBLD_GLOBAL_COMMAND_PREFIX, "arm" }
    compile arm_version.S
}

cdl_option CYGBLD_BUILD_FOO_I386 {
    requires { is_substr(CYGBLD_GLOBAL_COMMAND_PREFIX, "i386" }
    compile x86_version.S
}

Thank you,

Sergei

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

  reply	other threads:[~2008-12-01 19:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 18:51 Tyler Wilson
2008-12-01 19:40 ` Bart Veer
2008-12-01 20:55   ` Sergei Gavrikov [this message]
2008-12-02  0:41     ` Bart Veer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081201193924.GA21262@ubuntu.local \
    --to=sergei.gavrikov@gmail.com \
    --cc=TWilson@ugobe.com \
    --cc=bartv@ecoscentric.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).