public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] CDL question
@ 2006-08-01  2:37 Grant Edwards
  2006-08-01 16:27 ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Grant Edwards @ 2006-08-01  2:37 UTC (permalink / raw)
  To: eCos Discussion

I've read through the CDL sections of the component developer's
guide, but I can't figure out what the command is to set a data
flavored option to an expression involving it's default value
or it's current value.

Assume I've got an ecos.ecc file that I generated via an
"ecosconfig new whatever" command.  Now I want to change the
value of CYGBLD_GLOBAL_CFLAGS (which has its default value) to
add "-DFooBar".  This needs to be done in a shell script so
that I can automate the entire build process.  Usually when I
need to make automated changes to ecos.ecc I create a .cdl file
and import it like this:

   cat >.tmp$$.cdl <<EOF
   cdl_option CYGBLD_BUILD_REDBOOT_WITH_GDB {user_value 0}
   cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB {user_value 0}
   EOF
   ecosconfig import .tmp$$.cdl

However, I can't figure out what the TCL expression is for "the
current value of option CYG_WHATEVER".  I thought perhaps something like
   
   option CYGBLD_GLOBAL_CFLAGS {user_value "$CYGBLD_GLOBAL_CFLAGS -DFooBar"}

But that doesn't work.  I'm sure it's something obvious, but
I've never been able to grok TCL no matter how hard I try...

-- 
Grant Edwards
grante@visi.com



-- 
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] 6+ messages in thread

* Re: [ECOS] CDL question
  2006-08-01  2:37 [ECOS] CDL question Grant Edwards
@ 2006-08-01 16:27 ` Andrew Lunn
  2006-08-01 18:08   ` [ECOS] " Grant Edwards
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2006-08-01 16:27 UTC (permalink / raw)
  To: Grant Edwards; +Cc: eCos Discussion

On Mon, Jul 31, 2006 at 09:36:58PM -0500, Grant Edwards wrote:
> I've read through the CDL sections of the component developer's
> guide, but I can't figure out what the command is to set a data
> flavored option to an expression involving it's default value
> or it's current value.
> 
> Assume I've got an ecos.ecc file that I generated via an
> "ecosconfig new whatever" command.  Now I want to change the
> value of CYGBLD_GLOBAL_CFLAGS (which has its default value) to
> add "-DFooBar".  This needs to be done in a shell script so
> that I can automate the entire build process.  Usually when I
> need to make automated changes to ecos.ecc I create a .cdl file
> and import it like this:
> 
>    cat >.tmp$$.cdl <<EOF
>    cdl_option CYGBLD_BUILD_REDBOOT_WITH_GDB {user_value 0}
>    cdl_option CYGBLD_BUILD_REDBOOT_WITH_ZLIB {user_value 0}
>    EOF
>    ecosconfig import .tmp$$.cdl
> 
> However, I can't figure out what the TCL expression is for "the
> current value of option CYG_WHATEVER".  I thought perhaps something like
>    
>    option CYGBLD_GLOBAL_CFLAGS {user_value "$CYGBLD_GLOBAL_CFLAGS -DFooBar"}
> 
> But that doesn't work.  I'm sure it's something obvious, but
> I've never been able to grok TCL no matter how hard I try...

This method will not work. tcl has no access to CDL
variables. $CYGBLD_GLOBAL_CFLAGS means nothing to tcl.

You could use the cdl_option CYGPKG_KERNEL_CFLAGS_REMOVE,
CYGPKG_KERNEL_LDFLAGS_ADD etc to add FooBar to specific packages, in
this example the kernel. 

Another idea would be something like adding a custom package with CDL
something like:

cdl_option CYGBLD_DIDDLE_THE_FLAGS {
     flavor data
     default_value ""
     requires { is_substr(CYGBLD_GLOBAL_CFLAGS, CYGBLD_DIDDLE_THE_FLAGS) }
}

Then you can set CYGBLD_DIDDLE_THE_FLAGS from your import file and the
inference engine will do the rest.

          Andrew

-- 
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] 6+ messages in thread

* [ECOS] Re: CDL question
  2006-08-01 16:27 ` Andrew Lunn
@ 2006-08-01 18:08   ` Grant Edwards
  0 siblings, 0 replies; 6+ messages in thread
From: Grant Edwards @ 2006-08-01 18:08 UTC (permalink / raw)
  To: ecos-discuss

In gmane.os.ecos.general, you wrote:

>> I've read through the CDL sections of the component developer's
>> guide, but I can't figure out what the command is to set a data
>> flavored option to an expression involving it's default value
>> or it's current value.

>> However, I can't figure out what the TCL expression is for "the
>> current value of option CYG_WHATEVER".  I thought perhaps something like
>>    
>>    option CYGBLD_GLOBAL_CFLAGS {user_value "$CYGBLD_GLOBAL_CFLAGS -DFooBar"}
>> 
>> But that doesn't work.  I'm sure it's something obvious, but
>> I've never been able to grok TCL no matter how hard I try...
>
> This method will not work. tcl has no access to CDL
> variables. $CYGBLD_GLOBAL_CFLAGS means nothing to tcl.

I've decided I'm attacking this from the wrong direction.  What
I really ought to do is just add a separate CDL option and
change the C code to check for that option instead of for
"FooBar".

-- 
Grant Edwards                   grante             Yow!  Four thousand
                                  at               different MAGNATES, MOGULS
                               visi.com            & NABOBS are romping in my
                                                   gothic solarium!!

-- 
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] 6+ messages in thread

* [ECOS] Re: CDL question
  2009-06-06 17:47   ` Sergei Gavrikov
@ 2009-06-07 10:04     ` Sergei Gavrikov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Gavrikov @ 2009-06-07 10:04 UTC (permalink / raw)
  To: John Dallaway; +Cc: eCos discuss list

On Sat, Jun 06, 2009 at 08:47:41PM +0300, Sergei Gavrikov wrote:
> I will going to try some stupid? thing. I wonder, if I will create some
> fake tree (~ecos repository):

[snip]

> Will ecosconfig complain? Well, I'll try it.

It works if set up the sandbox properly. And what did I expect :-) ? So,
it's easy to setup sandbox repository with one or few study-packages,
and learn CDL insides, use `ecosconfig' as CDL lint, and even observe
sandbox tree in CT. All toy-options after `ecosconfig tree' a pupil will
find in include/pkgconf/foo.h. What a nice thing this eCos!

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] 6+ messages in thread

* [ECOS] Re: CDL question
  2009-06-06 15:17 ` [ECOS] " John Dallaway
@ 2009-06-06 17:47   ` Sergei Gavrikov
  2009-06-07 10:04     ` Sergei Gavrikov
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Gavrikov @ 2009-06-06 17:47 UTC (permalink / raw)
  To: John Dallaway; +Cc: eCos discuss list

John Dallaway wrote:
 
> The following should work, but there may be a more elegant approach:
> 
>   default_value { (board == "A") ? "A" : "X" }
>   legal_values {
>     ((board == "A") ? "A" : "")
>     ((board == "A") ? "B" : "")
>     ((board == "A") ? "C" : "")
>     ((board == "B") ? "X" : "")
>     ((board == "B") ? "Y" : "")
>     ((board == "B") ? "Z" : "")
>   }

Hi,

Thank you. I'm sorry, I was being AFK. Hm, your pseudo-CDL code is like
mine. Perhaps, my mixture was too comprecated and I missed the brackets
in the expression, true speaking in my check were many many is_substr()
concatenations, I will try it again.

I will going to try some stupid? thing. I wonder, if I will create some
fake tree (~ecos repository):

.
|-- ecos.db
|-- baz
|   `-- current
|       `-- cdl
|           `-- baz.cdl
`-- templates
    `-- bar
        `-- current.cdl

and my ecos.db will be contain only single fake target `foo' with
CYGPKG_BAR. Will I be able to validate CDL-pseudo code just using
`ecosconfig' as

ECOS_REPOSITORY=`pwd` ecosconfig new foo bar

Will ecosconfig complain? Well, I'll try it.

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] 6+ messages in thread

* [ECOS] Re: CDL question
  2009-06-06 14:01 [ECOS] " Sergei Gavrikov
@ 2009-06-06 15:17 ` John Dallaway
  2009-06-06 17:47   ` Sergei Gavrikov
  0 siblings, 1 reply; 6+ messages in thread
From: John Dallaway @ 2009-06-06 15:17 UTC (permalink / raw)
  To: Sergei Gavrikov; +Cc: eCos discuss list

Hi Sergei

Sergei Gavrikov wrote:

> What I try to do using CDL expressions
> 
> if {board == A} {
> 	default_value A
> 	legal_values {A B C}
> } else if {board == B} {
> 	default_value X
> 	legal_values {X Y Z}
> }
> 
> and using in two-lines coding I could get only, for example,
> 
> 	default_value B
> 	legal_values {A B C X Y Z}
> 
> Thanks for any comments on it.

The following should work, but there may be a more elegant approach:

  default_value { (board == "A") ? "A" : "X" }
  legal_values {
    ((board == "A") ? "A" : "")
    ((board == "A") ? "B" : "")
    ((board == "A") ? "C" : "")
    ((board == "B") ? "X" : "")
    ((board == "B") ? "Y" : "")
    ((board == "B") ? "Z" : "")
  }

John Dallaway

-- 
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] 6+ messages in thread

end of thread, other threads:[~2009-06-07 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-01  2:37 [ECOS] CDL question Grant Edwards
2006-08-01 16:27 ` Andrew Lunn
2006-08-01 18:08   ` [ECOS] " Grant Edwards
2009-06-06 14:01 [ECOS] " Sergei Gavrikov
2009-06-06 15:17 ` [ECOS] " John Dallaway
2009-06-06 17:47   ` Sergei Gavrikov
2009-06-07 10:04     ` Sergei Gavrikov

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