[ECOS] changing compile source in cdl based on platform

Bart Veer bartv@ecoscentric.com
Mon Dec 1 19:40:00 GMT 2008

>>>>> "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

     #include <pkgconf/system.h>
     #ifdef CYGPKG_HAL_ARM
     <main body of file>

   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).   

    Tyler> Also, I have tried just adding a .S file to a component,
    Tyler> but it is not being included in the build when 'make'ing.
    Tyler> Is there any other magic I need to enable the assembly of
    Tyler> .S files? Also, does the case of the .S matter? I am using
    Tyler> cygwin, btw.

There should not be any problems in this area. Check your
configuration. I suspect that the option or component containing the
"compile" property is either inactive or disabled.

Bart Veer                                   eCos Configuration Architect
eCosCentric Limited    The eCos experts      http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK.      Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.

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

More information about the Ecos-discuss mailing list