public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] How to modify CFLAGS within an ECM file?
@ 2007-09-11 22:54 Mike Arthur
  2007-09-12  7:01 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mike Arthur @ 2007-09-11 22:54 UTC (permalink / raw)
  To: ecos-discuss

Is there a way to adjust CFLAGS within an ECM file?  I want to be able
to adjust the optimization levels of configurations, without changing
the rest of the CFLAGS when using ecosconfig.  I don't want to have to
hand edit the .ecc file.

This is an example of what I want to do:
$ ecosconfig new pc_rltk8139
$ ecosconfig import file_that_modifies_optimization_to_O0.ecm
$ ecosconfig tree
$ make

Now the 'pc_rltk8139' target would be built with -O0 optimization. I
don't know what the contents of "file_that_modifies_optimization.ecm"
would be.

Any suggestions?

Mike

-- 
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] How to modify CFLAGS within an ECM file?
  2007-09-11 22:54 [ECOS] How to modify CFLAGS within an ECM file? Mike Arthur
@ 2007-09-12  7:01 ` Andrew Lunn
  2007-09-12 17:12   ` Mike Arthur
  2007-09-12 15:01 ` Sergei Gavrikov
  2007-09-12 15:17 ` [ECOS] " Grant Edwards
  2 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2007-09-12  7:01 UTC (permalink / raw)
  To: Mike Arthur; +Cc: ecos-discuss

On Tue, Sep 11, 2007 at 05:54:33PM -0500, Mike Arthur wrote:
> Is there a way to adjust CFLAGS within an ECM file?  I want to be able
> to adjust the optimization levels of configurations, without changing
> the rest of the CFLAGS when using ecosconfig.  I don't want to have to
> hand edit the .ecc file.
> 
> This is an example of what I want to do:
> $ ecosconfig new pc_rltk8139
> $ ecosconfig import file_that_modifies_optimization_to_O0.ecm
> $ ecosconfig tree
> $ make
> 
> Now the 'pc_rltk8139' target would be built with -O0 optimization. I
> don't know what the contents of "file_that_modifies_optimization.ecm"
> would be.
> 
> Any suggestions?

Take a look at:

http://ecos.sourceware.org/docs-latest/cdl-guide/language.values.html

In particular the first example after the table of operators, the
example in the section Functions, and the documentation for is_substr()

        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

* Re: [ECOS] How to modify CFLAGS within an ECM file?
  2007-09-11 22:54 [ECOS] How to modify CFLAGS within an ECM file? Mike Arthur
  2007-09-12  7:01 ` Andrew Lunn
@ 2007-09-12 15:01 ` Sergei Gavrikov
  2007-09-12 15:17 ` [ECOS] " Grant Edwards
  2 siblings, 0 replies; 6+ messages in thread
From: Sergei Gavrikov @ 2007-09-12 15:01 UTC (permalink / raw)
  To: Mike Arthur; +Cc: ecos-discuss

Mike Arthur writes:
> Is there a way to adjust CFLAGS within an ECM file?  I want to be able
> to adjust the optimization levels of configurations, without changing
> the rest of the CFLAGS when using ecosconfig.  I don't want to have to
> hand edit the .ecc file.
> 
> This is an example of what I want to do:
> $ ecosconfig new pc_rltk8139
> $ ecosconfig import file_that_modifies_optimization_to_O0.ecm
> $ ecosconfig tree
> $ make
> 
> Now the 'pc_rltk8139' target would be built with -O0 optimization. I
> don't know what the contents of "file_that_modifies_optimization.ecm"
> would be.
> 
> Any suggestions?
> 
> Mike

It seems, it exists the ECos way for that (to make it with own CDL
rule), but Unix way is just to filter that

I did prepare same NOOPTIM.ECM using 'sed' and then import it

ecosconfig new target

sed -ne '/CYGBLD_GLOBAL_CFLAGS {/,/^}/p' ecos.ecc |
sed  -e '/# user_value/s/# //;s/-g -O2/-g -O0/;/#/d;/^$/d' >NOOPTIM.ECM

ecosconfig import NOOPTIM.ECM
ecosconfig resolve


	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: How to modify CFLAGS within an ECM file?
  2007-09-11 22:54 [ECOS] How to modify CFLAGS within an ECM file? Mike Arthur
  2007-09-12  7:01 ` Andrew Lunn
  2007-09-12 15:01 ` Sergei Gavrikov
@ 2007-09-12 15:17 ` Grant Edwards
  2 siblings, 0 replies; 6+ messages in thread
From: Grant Edwards @ 2007-09-12 15:17 UTC (permalink / raw)
  To: ecos-discuss

On 2007-09-11, Mike Arthur <arth2219@gmail.com> wrote:
> Is there a way to adjust CFLAGS within an ECM file?  I want to be able
> to adjust the optimization levels of configurations, without changing
> the rest of the CFLAGS when using ecosconfig.  I don't want to have to
> hand edit the .ecc file.
>
> This is an example of what I want to do:
> $ ecosconfig new pc_rltk8139
> $ ecosconfig import file_that_modifies_optimization_to_O0.ecm
> $ ecosconfig tree
> $ make
>
> Now the 'pc_rltk8139' target would be built with -O0 optimization. I
> don't know what the contents of "file_that_modifies_optimization.ecm"
> would be.
>
> Any suggestions?

The only way I've figured out is to use sed to modify the
ecos.ecc file just before the doing the "tree" command.  I
always use a shellscript to create a new tree.  Here's a sample
where I modify the CFLAGS value:

----------------------------------------------------------------------
#!/bin/bash

[ecosconfig new/add/remove stuff here]

# need to add -G0 option to compiler flags to fix the linker error:
#    Unable to reach __RedBoot_IDLE_TAB_END__ (at 0x08013428) from the global pointer (at 0x0801b$
# hopefully, someday Altera will fix this bug...
sed 's/# user_value "-g -O3/user_value "-g -G0 -O3/g' <ecos.ecc >ecos.ecc.new
mv ecos.ecc ecos.ecc.orig
mv ecos.ecc.new ecos.ecc

ecosconfig tree

[more sed commands to fix problems in Makefile and .ldi files]

----------------------------------------------------------------------


-- 
Grant Edwards                   grante             Yow! Yes, but will I
                                  at               see the EASTER BUNNY in
                               visi.com            skintight leather at an
                                                   IRON MAIDEN concert?


-- 
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] How to modify CFLAGS within an ECM file?
  2007-09-12  7:01 ` Andrew Lunn
@ 2007-09-12 17:12   ` Mike Arthur
  2007-09-12 18:02     ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Arthur @ 2007-09-12 17:12 UTC (permalink / raw)
  To: andrew, ecos-discuss

> Take a look at:
>
> http://ecos.sourceware.org/docs-latest/cdl-guide/language.values.html
>
> In particular the first example after the table of operators, the
> example in the section Functions, and the documentation for is_substr()
>


I get this error while trying to import my .ecm file:
---------------------------------------------------------------------
option CYGBLD_GLOBAL_CFLAGS: error
    invalid command name "requires"




The ecm file looks like this:
--------------------------------------
cdl_option CYGBLD_GLOBAL_CFLAGS {
    requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -O2") }
};


Do .ecm files have the same commands as .cdl?

Thanks!
Mike

-- 
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] How to modify CFLAGS within an ECM file?
  2007-09-12 17:12   ` Mike Arthur
@ 2007-09-12 18:02     ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2007-09-12 18:02 UTC (permalink / raw)
  To: Mike Arthur; +Cc: ecos-discuss

On Wed, Sep 12, 2007 at 12:12:36PM -0500, Mike Arthur wrote:
> > Take a look at:
> >
> > http://ecos.sourceware.org/docs-latest/cdl-guide/language.values.html
> >
> > In particular the first example after the table of operators, the
> > example in the section Functions, and the documentation for is_substr()
> >
> 
> 
> I get this error while trying to import my .ecm file:
> ---------------------------------------------------------------------
> option CYGBLD_GLOBAL_CFLAGS: error
>     invalid command name "requires"
> 
> 
> 
> 
> The ecm file looks like this:
> --------------------------------------
> cdl_option CYGBLD_GLOBAL_CFLAGS {
>     requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -O2") }
> };
> 
> 
> Do .ecm files have the same commands as .cdl?

Ah, my error. I thought you wanted this in one of your .cdl files.

You probably need to add some cdl somewhere, something like

cdl_option CYGBLD_GLOBAL_CFLAGS_O2 {
           display  "Compile with -02"
           default  0
           no_define
           requires { is_substr(CYGBLD_GLOBAL_CFLAGS, " -O2") }
}

And then in your .ecm file

cdl_option CYGBLD_GLOBAL_CFLAGS_O2 {
    user_value 1
}

        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

end of thread, other threads:[~2007-09-12 18:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-11 22:54 [ECOS] How to modify CFLAGS within an ECM file? Mike Arthur
2007-09-12  7:01 ` Andrew Lunn
2007-09-12 17:12   ` Mike Arthur
2007-09-12 18:02     ` Andrew Lunn
2007-09-12 15:01 ` Sergei Gavrikov
2007-09-12 15:17 ` [ECOS] " Grant Edwards

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