[ECOS] "Bad" and "good" GCC FLAGS for ECOS environment

Sergei Gavrikov sergei.gavrikov@gmail.com
Fri Nov 14 16:51:00 GMT 2008


Hello,

Trying new arm-eabi-gcc to build existen targets I noticed what it is
not possible to build some of them. Issue is it's CYGBLD_GLOBAL_CFLAGS.
Greeping, viming the hal*.cdl(s) I found no up-to-dated CFLAGS for GCC4
which I can use as the good example, at the least, it seemed for me.

I am not GCC expert and I know the very minimal CFLAGS set: -O{0,2}; -g;
-Wall :-) I ask experts, What FLAG is good for new GCC in eCos and what
FLAG is "bad"? I know only one "bad" for GCC-4: -mno-short-load-words,
but, a few targets still use it. I've known one good flag from Jonathan
Larmour: -Wno-write-strings. Can anyone distribute his knowledges about
other GCC-4 flags for _eCos_ environment? 

I wrote a simple Tcl script to build CFLAGS histograms (see the below)
just for expetrs who can "underline" the table's rows by a comment in
1-2 lines or even just mark the rows by asterisks. There are a head
(list of inspected targets) and 2 columns table: the 1st column contains
a meet GCC flag, the 2nd -- target's names (or aliases) which use this
flag on the screen Long lists are truncated.  If anybody interests in
the script I attach it. You can get same tables for powerpc, i386, etc.

Commentators, welcome use: egrep -v -- '-(mcpu|O2|g|Wall|endian)' for
your comments. I think all know about these GCC options even I know it.

All Experts, thank you for your knowledges!

All the best,

	Sergei

RFC

cma230|ebsa285|gps4020|aim711|aeb|snds|pid|integrator|e7t|edb7xxx

              -mthumb : cma230 aim711 pid
       -mcpu=arm7tdmi : cma230 gps4020 aim711 pid integrator e7t edb7xxx
    -mthumb-interwork : cma230 aim711 pid
                -Wall : cma230 ebsa285 gps4020 aim711 aeb pid integrator
      -Wpointer-arith : cma230 ebsa285 gps4020 aim711 aeb pid integrator
  -Wstrict-prototypes : cma230 ebsa285 gps4020 aim711 aeb pid integrator
             -Winline : cma230 ebsa285 gps4020 aim711 aeb pid integrator
              -Wundef : cma230 ebsa285 gps4020 aim711 aeb pid integrator
 -Woverloaded-virtual : cma230 ebsa285 gps4020 aim711 aeb pid integrator
                   -g : cma230 ebsa285 gps4020 aim711 aeb pid integrator
                  -O2 : cma230 ebsa285 gps4020 aim711 aeb pid integrator
  -ffunction-sections : cma230 ebsa285 gps4020 aim711 aeb pid integrator
      -fdata-sections : cma230 ebsa285 gps4020 aim711 aeb pid integrator
            -fno-rtti : cma230 ebsa285 gps4020 aim711 aeb pid integrator
      -fno-exceptions : cma230 ebsa285 gps4020 aim711 aeb pid integrator
          -fvtable-gc : cma230 ebsa285 gps4020 aim711 aeb pid integrator
      -finit-priority : cma230 ebsa285 gps4020 aim711 aeb pid integrator
      -mcpu=strongarm : ebsa285
         -mbig-endian : aim711 pid
-mno-short-load-words : aim711 e7t
         -mcpu=arm7di : aeb
           -mcpu=arm9 : pid integrator
  -fno-schedule-insns : integrator
        -mcpu=arm710c : edb7xxx

10 targe(s) processed

p2106|phycore229x|mcb2100|lpcmt|ea2468|nano|ipaq|cerfpda|brutus|assabet|
sa1100mm|flexanet|cerf|innovator|smdk2410|excalibur|aaed2000|uE250|mpc50
|xsengine|picasso|iop310|ixdp425|prpmc1100|iq80321|grg|eb55|eb42|at91sam

              -mthumb : p2106 phycore229x mcb2100 lpcmt ea2468 eb55 eb42
    -mthumb-interwork : p2106 phycore229x mcb2100 lpcmt ea2468 eb55 eb42
       -mcpu=arm7tdmi : p2106 phycore229x mcb2100 lpcmt ea2468 eb55 eb42
-mno-short-load-words : p2106 phycore229x mcb2100 lpcmt ea2468 eb55 eb42
                -Wall : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
      -Wpointer-arith : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
  -Wstrict-prototypes : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
             -Winline : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
              -Wundef : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
 -Woverloaded-virtual : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
                   -g : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
                  -O2 : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
  -ffunction-sections : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
      -fdata-sections : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
            -fno-rtti : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
      -fno-exceptions : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
          -fvtable-gc : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
      -finit-priority : p2106 phycore229x mcb2100 lpcmt ea2468 nano ipaq
  -mcpu=strongarm1100 : nano ipaq cerfpda brutus assabet sa1100mm flexanet
         -mapcs-frame : sa1100mm uE250 mpc50 xsengine picasso iop310 ixdp425
           -mcpu=arm9 : innovator smdk2410 excalibur aaed2000
         -fno-builtin : uE250 xsengine picasso
         -mcpu=xscale : mpc50 iop310 ixdp425 prpmc1100 iq80321 grg
         -mbig-endian : ixdp425 prpmc1100 grg mace1 mac7100evb
            -gdwarf-2 : mace1 mac7100evb

35 targe(s) processed

Note: the tables were got as "cflagseek hal/arm/*/*/*/*{,/*}"
-------------- next part --------------
#!/usr/bin/env tclsh

set program [file tail [info script]]

if {!$argc} {
    puts "Usage: $program pattern ?pattern ...?"
    puts "  pattern is: a glob like relative path to inspected CDL file(s)"
    puts ""
    puts "Example: $program hal/powerpc/*/*/*/*" 
    return 1
}

if {![info exists env(ECOS_REPOSITORY)]} {
    puts "The environment variable ECOS_REPOSITORY is not set"
    return 1
}

set top $env(ECOS_REPOSITORY)

proc reset_stats {} {
    foreach li {aliases found stats} {set ::$li [list]}
}

proc extract_flags {tcled_cflags alias} {
    global aliases found stats

    lappend aliases $alias; lappend stats $alias
    set flags {}
    foreach f [regexp -inline -all -expanded -- {(?:-[^ \"]+)} $tcled_cflags] {
	lappend flags $f
	if {[lsearch -exact $found $f] < 0} {
	    lappend found $f
	}
    }
    lappend stats $flags
}

proc print_stats {{cut 72}} {
    global aliases found stats

    if {[llength $stats] == 0} {return}

    # header | fmt -w 72
    set header [join $aliases "|"]
    if {[string length $header] >= $cut} {
	foreach row [regexp -all -inline [string repeat . $cut] $header] {
	    puts $row
	}
    } else {
	puts $header
    }
    puts {}

    # what is the longest flag?
    set width 0
    foreach flag $found {
	set len [string length $flag]
	if {$len > $width} {
	    set width $len
	}
    }

    # print a histogram: flag : target ?target ...?
    # Note: long lines will be truncated, look at 'cut' parameter.
    foreach flag $found {
	set line ""; set column 0;
	append line [format "%${width}s :" $flag]
	incr column 
	foreach {alias flags} $stats {
	    if {[lsearch -exact $flags $flag] >= 0} {
		if {[string length $line] >= $cut} {
		    #append line " ..."
		    break
		} else {
		    append line " $alias"
		}
	    }
	}
	puts $line
    }

    puts [format "\n%d targe(s) processed\n" [llength $aliases]]
}

# unknow -- 'eats' all unknow tokens, but processes one: cdl_option
# 	     CYGBLD_GLOBAL_CFLAGS
proc unknown args {
    foreach {cdl_type name body} $args {
	switch -glob -- $cdl_type {
	    cdl_* {
		if {$name eq {CYGBLD_GLOBAL_CFLAGS}} {
		    # get CFLAGS value
		    set where [expr {[lsearch -regexp $body {^default}] + 1}]
		    set tcled_cflags [lindex $body $where]
		    regexp -- {^.*_(.*?)\.cdl$} [info script] -> alias

		    extract_flags $tcled_cflags $alias

		    return ;# return from sourced CDL
		}
		eval $body ;# eval {...}
	    }
	    default {
		break
	    }
	}
    }
}

# MAIN
foreach arg $argv {
    reset_stats
    foreach cdl [glob -nocomplain -- [file join $top $arg]] {
	if {[file isfile $cdl] && [file extension $cdl] eq ".cdl"} {source $cdl}
    }
    print_stats
}

# vim: set filetype=tcl smarttab smartindent shiftwidth=4:

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