public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] changing compile source in cdl based on platform
@ 2008-12-01 18:51 Tyler Wilson
  2008-12-01 19:40 ` Bart Veer
  0 siblings, 1 reply; 4+ messages in thread
From: Tyler Wilson @ 2008-12-01 18:51 UTC (permalink / raw)
  To: ecos-discuss

Good day,

FYI, I looked through the CDL guide, but could not find an answer. I
apologize if it is in there, but I think I did try.

I have a component I am adding to our eCos repository, via the CDL. One
of the modules has assembly language versions for different platforms -
x86, ARM, etc. I would like to know how to specify this in the CDL
properly. Something like

cdl_option CYG_USE_ASM {
    compile  {
        if is_defined(HAL_ARM) {
            arm_version.S
        }
        if is_defined(HAL_X86) {
            x86_version.S
        }
    }
}

I know these are really just Tcl scripts, but I am not familiar enough
with Tcl to know the proper syntax, and I thought it would be easier for
somebody on this list to give me an example.

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

Thank you,
Tyler

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] changing compile source in cdl based on platform
  2008-12-01 18:51 [ECOS] changing compile source in cdl based on platform Tyler Wilson
@ 2008-12-01 19:40 ` Bart Veer
  2008-12-01 20:55   ` Sergei Gavrikov
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Veer @ 2008-12-01 19:40 UTC (permalink / raw)
  To: Tyler Wilson; +Cc: ecos-discuss

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] changing compile source in cdl based on platform
  2008-12-01 19:40 ` Bart Veer
@ 2008-12-01 20:55   ` Sergei Gavrikov
  2008-12-02  0:41     ` Bart Veer
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Gavrikov @ 2008-12-01 20:55 UTC (permalink / raw)
  To: Bart Veer; +Cc: Tyler Wilson, ecos-discuss

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] changing compile source in cdl based on platform
  2008-12-01 20:55   ` Sergei Gavrikov
@ 2008-12-02  0:41     ` Bart Veer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Veer @ 2008-12-02  0:41 UTC (permalink / raw)
  To: Sergei Gavrikov; +Cc: ecos-discuss

>>>>> "Sergei" == Sergei Gavrikov <sergei.gavrikov@gmail.com> writes:

    <snip>
    Sergei> Nice tutorial! I would prefer option (2) too. I wonder
    Sergei> will it work

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

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

Not exactly. Replacing the "calculated" property with "requires" means
that both CYGBLD_BUILD_FOO_ARM and CYGBLD_BUILD_FOO_I386 now become a
user-editable options. It does not make sense for users to edit these.
For a given platform, and hence architecture, only one can be enabled.
Once the user has selected the platform there is no point in letting
the user edit these individual options.

Also, using is_substr(CYGBLD_GLOBAL_COMMAND_PREFIX) is probably a bad
idea compared with using CYGPKG_HAL_ARM or CYGPKG_HAL_I386. The test
for "arm" will succeed for both ARM and Cortex M3, so you could end up
trying to build ARM-specific assembler for Cortex. Similarly the test
for "i386" could succeed when cross-compiling the synthetic target on
Windows as well as for a real x86 target. Maybe that is what you want,
but then (CYGPKG_HAL_I386 || CYGPKG_HAL_SYNTH) would be a lot clearer
than trying to do clever stuff with COMMAND_PREFIX.

Bart

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-01 20:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-01 18:51 [ECOS] changing compile source in cdl based on platform Tyler Wilson
2008-12-01 19:40 ` Bart Veer
2008-12-01 20:55   ` Sergei Gavrikov
2008-12-02  0:41     ` Bart Veer

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