X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tools%2Ftinyos%2Fncc%2Fncc.in;h=b1fee5cec0c51ee8ec6bafcf3759295c7d93471c;hb=5aa4581b60d743142f85f0e27e0e3d541c83b084;hp=6a9ed35e74ad9eb856b7b6d703478270856afc68;hpb=985b17e79cd670abbd4e0a7bfd6a6d30f3b3cd97;p=tinyos-2.x.git diff --git a/tools/tinyos/ncc/ncc.in b/tools/tinyos/ncc/ncc.in index 6a9ed35e..b1fee5ce 100644 --- a/tools/tinyos/ncc/ncc.in +++ b/tools/tinyos/ncc/ncc.in @@ -82,10 +82,6 @@ for ($i = 0; $i <= $#ARGV; $i++) { $strip = 1; push @includes, $file; } - elsif (/^-safe$/) { - $safe = 1; - $strip = 1; - } elsif (/^-fnesc-cfile=(.*)/){ $appfilename=$1; } @@ -139,72 +135,6 @@ if (!defined $target) { } } -my $cpp; -my $deputyasmexe; -my $gcc; - -if(defined $safe) { - my $safe_home = $TOSDIR."/lib/safe"; - push @new_args, "-fnesc-include=${safe_home}/include/annots_stage1"; - push @new_args, "-fnesc-genprefix=#include \"${safe_home}/include/annots_stage2.h\""; -} - -if ($safe) { - - if (($target eq "mica2") or ($target eq "micaz")) { - $mcu = "avr"; - } elsif ($target eq "telosb") { - $mcu = "msp430"; - } else { - print STDERR "Safe TinyOS does not (yet) support the ${target} target.\n"; - print STDERR "Supported targets: "; - print STDERR "mica2, micaz, telosb\n"; - exit 2; - } - - my $deputy_include = $ENV{'DEPUTY_HOME'}."/include"; - - push @new_args, "-DSAFE_TINYOS"; - push @new_args, "-conly"; - push @new_args, "-fnesc-deputy"; - - if (!defined $appfilename) { - $appfilename="build/${target}/app.c"; - } - if (!defined $exefilename) { - $exefilename="build/${target}/main.exe"; - } - - $appfilename =~ m/^((.*\/)?)[^\/]+$/; - my $directory = $1; - - # Might be useful to keep this app.c somewhere... - # This could probably be avoided by using the deputy script - # instead of the executable directly... - $cpp = "${mcu}-gcc -E -DSAFE_TINYOS $appfilename -o ${directory}deputy-in.c -I${safe_home}/include"; - - # Not worrying about racing protection, for now... - # --checksnescatomic racing.txt - $deputyasmexe = "deputy-${mcu} --FLIDs --out ${directory}deputy-out.c ${directory}deputy-in.c"; - - $failfile = "${TOSDIR}/lib/safe/${mcu}/fail.c"; - - my $gccflags; - if (($target eq "mica2") or ($target eq "micaz")) { - $gccflags = ("-mmcu=atmega128 -Os -fdollars-in-identifiers " . - "-finline-limit=1000000 -Winline " . - "--param inline-unit-growth=1000000 " . - "--param large-function-growth=1000000"); - } - elsif($target eq "telosb"){ - $gccflags = "-Os -mdisable-hwmul -mmcu=msp430x1611"; - } - - $gcc = ("${mcu}-gcc $gccflags -I${deputy_include} ${directory}deputy-out.c " . - "$failfile -o $exefilename $libs"); - -} - if (!defined $scheduler && !$is_tos_1) { $scheduler = "TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask"; } @@ -218,6 +148,15 @@ if ($print_target) { foreach $dir (@includes) { if ($dir =~ m!/$target/?$! && -f "$dir/.platform") { $platform_def = "$dir/.platform"; + # Check to see if the platform is a member of a family + if (-f "$dir/.family") { + $family_def = "$dir/.family"; + } + else { + if (-f "$dir/../.family") { + $family_def = "$dir/../.family"; + } + } last; } } @@ -294,7 +233,11 @@ $platform_dir = $platform_def; $platform_dir =~ s!/\.platform$!!; push @includes, $platform_dir unless $nostdinc; do $platform_def; -do $family_def if -f $family_def; +if (-f $family_def) { + $family_dir = $family_def; + $family_dir =~ s!/\.family$!!; + do $family_def +} unshift @new_args, "-DPLATFORM_\U$target"; push @new_args, @opts; @@ -334,28 +277,9 @@ foreach $idir (@includes) { print STDERR join(' ', @new_args), "\n" if $verbose; - -if ($safe) { - - # nescc runs and puts in annotations like COUNT etc... - system(@new_args)==0 or die "Couldn't execute nescc\n"; - - # cpp changes annotations into attributes for deputy - print STDERR "${cpp}\n" if $verbose; - system($cpp)==0 or die "gcc preprocess error!\n"; - - # deputy inserts the checks - print STDERR "${deputyasmexe}\n" if $verbose; - system($deputyasmexe)==0 or die "deputy error!\n"; - - print STDERR "${gcc}\n" if $verbose; - system($gcc)==0 or die "cil error!\n"; - -} else { - exec @new_args; - print STDERR "Couldn't execute nescc\n"; - exit 2; -} +exec @new_args; +print STDERR "Couldn't execute nescc\n"; +exit 2; sub extractarg { local ($i) = @_; @@ -380,6 +304,7 @@ sub idir_subst { $rep = $TOSDIR if $char eq "T"; $rep = $target if $char eq "p"; $rep = $platform_dir if $char eq "P"; + $rep = $family_dir if $char eq "F"; &fail("unknown include-path substitution %" . $char) if !$rep; substr($idir, $idx, 2) = $rep; $idx += length $rep;