From 9d1bd142b64b7dc0d68382c29b9e0e6464106778 Mon Sep 17 00:00:00 2001 From: klueska Date: Thu, 17 Jan 2008 23:18:59 +0000 Subject: [PATCH] Added functionality for setting the TOS scheduler via flag to ncc. Updated .platform files to be backwards compatible, but by default no longer explicitly set the -fnesc-scheduler-flag unless using an older version of ncc --- tools/tinyos/ncc/ncc.1 | 16 ++++++++++++++++ tools/tinyos/ncc/ncc.in | 14 ++++++++++++++ tos/platforms/btnode3/.platform | 2 +- tos/platforms/eyesIFX/.family | 4 ++-- tos/platforms/intelmote2/.platform | 2 +- tos/platforms/iris/.platform | 2 +- tos/platforms/mica2/.platform | 2 +- tos/platforms/mica2dot/.platform | 2 +- tos/platforms/micaz/.platform | 2 +- tos/platforms/null/.platform | 3 ++- tos/platforms/telosa/.platform | 2 +- tos/platforms/telosb/.platform | 3 +-- tos/platforms/tinynode/.platform | 4 ++-- 13 files changed, 44 insertions(+), 14 deletions(-) diff --git a/tools/tinyos/ncc/ncc.1 b/tools/tinyos/ncc/ncc.1 index 25995a82..b0fb7745 100644 --- a/tools/tinyos/ncc/ncc.1 +++ b/tools/tinyos/ncc/ncc.1 @@ -45,6 +45,22 @@ given, \fBncc\fR uses the value specified with the option. If neither the environment variable or option are specified, ncc uses its compiled-in TinyOS directory. .TP +\fB-tosscheduler=\fIcomponent,unique-string,interface-name,interface-definition,run-event,post-command\fR +By default, nesC compiles uses of \fBtask void\fR \fItaskname\fR\fB() ...\fR to \fBvoid\fR +\fItaskname\fR\fB()\fR, +and \fBpost\fR \fItaskname\fR\fB()\fR to \fBTOS_post\fR\fB(\fR\fItaskname\fR\fB)\fR. +.IP +With this option, each task gets its own \fIinterface-definition\fR interface, +the task implementation is transformed into a \fIrun-event event\fR and posts becomes a +call to the \fIpost-command\fR command. This per-task interface is automatically +connected to the parameterised \fIinterface-name\fR interface of scheduler +\fIcomponent\fR component. The parameter id for the connection is chosen with +\fBunique\fR("\fIunique-string\fR"). +.IP +If this option is not set explicity, its parameters are assigned by default as follows: +.IP +-tosscheduler=\fITinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask\fR +.TP \fB-tossim\fR Compile for the TOSSIM environment rather than a native platform. Every directory in the search path will be duplicated, with the first copy having diff --git a/tools/tinyos/ncc/ncc.in b/tools/tinyos/ncc/ncc.in index 2adbaa52..4c8d908b 100644 --- a/tools/tinyos/ncc/ncc.in +++ b/tools/tinyos/ncc/ncc.in @@ -14,10 +14,13 @@ $TOSDIR = "@TOSDIR@"; $TOSDIR = $ENV{"TOSDIR"} if defined($ENV{"TOSDIR"}); $nescc = "@nescc_prefix@/bin/nescc"; $tossim = 0; +$is_tos_1 = 0; +$with_scheduler_flag = 1; # Support platform directory renaming for 2.x if (-d "$TOSDIR/platform") { $platform = "platform"; + $is_tos_1 = 1; } else { $platform = "platforms"; @@ -38,6 +41,10 @@ for ($i = 0; $i <= $#ARGV; $i++) { $TOSDIR = $1; $strip = 1; } + elsif (/^-tosscheduler=(.*)/) { + $scheduler = $1; + $strip = 1; + } elsif (/^-nostdinc$/) { $nostdinc = 1; } @@ -113,6 +120,10 @@ if (!defined $target) { } } +if (!defined $scheduler && !$is_tos_1) { + $scheduler = "TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask"; +} + if ($print_target) { print $target, "\n"; exit 0; @@ -202,6 +213,9 @@ do $family_def if -f $family_def; unshift @new_args, "-DPLATFORM_\U$target"; push @new_args, @opts; +if(!$is_tos_1) { + unshift @new_args, "-fnesc-scheduler=$scheduler"; +} # old nesdoc: set the default topdir based on TOSDIR my ($tosparent) = ($TOSDIR =~ m!^(.*)/.*?$!); diff --git a/tos/platforms/btnode3/.platform b/tos/platforms/btnode3/.platform index ac67392e..33cfd8b6 100644 --- a/tos/platforms/btnode3/.platform +++ b/tos/platforms/btnode3/.platform @@ -40,8 +40,8 @@ push( @includes, qw( -mmcu=atmega128 -fnesc-target=avr -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/eyesIFX/.family b/tos/platforms/eyesIFX/.family index cba3afb1..de546863 100644 --- a/tos/platforms/eyesIFX/.family +++ b/tos/platforms/eyesIFX/.family @@ -34,7 +34,7 @@ push (@opts, qw( -gcc=msp430-gcc -fnesc-target=msp430 -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ) ); -push @opts, "-mingw-gcc" if $cygwin; \ No newline at end of file +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; +push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/intelmote2/.platform b/tos/platforms/intelmote2/.platform index 023615a2..e349c3a9 100644 --- a/tos/platforms/intelmote2/.platform +++ b/tos/platforms/intelmote2/.platform @@ -49,10 +49,10 @@ push ( @includes, qw( -nostartfiles -fnesc-target=env -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; $ENV{NESC_MACHINE} = "pointer=4,4 float=4,4 double=8,4 long_double=8,4 short=2,2 int=4,4 long=4,4 long_long=8,4 int1248_align=1,2,4,4 wchar_size_size=4,4 char_wchar_signed=false,true"; diff --git a/tos/platforms/iris/.platform b/tos/platforms/iris/.platform index 9943593d..fb79ce37 100644 --- a/tos/platforms/iris/.platform +++ b/tos/platforms/iris/.platform @@ -40,9 +40,9 @@ push( @includes, qw( -mmcu=atmega1281 -fnesc-target=avr -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/mica2/.platform b/tos/platforms/mica2/.platform index cfe7022f..8b52498b 100644 --- a/tos/platforms/mica2/.platform +++ b/tos/platforms/mica2/.platform @@ -34,9 +34,9 @@ push( @includes, qw( -mmcu=atmega128 -fnesc-target=avr -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/mica2dot/.platform b/tos/platforms/mica2dot/.platform index 7d4b0ec4..b894fc2f 100644 --- a/tos/platforms/mica2dot/.platform +++ b/tos/platforms/mica2dot/.platform @@ -37,9 +37,9 @@ push( @includes, qw( -mmcu=atmega128 -fnesc-target=avr -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/micaz/.platform b/tos/platforms/micaz/.platform index 4338a714..f8b6be67 100644 --- a/tos/platforms/micaz/.platform +++ b/tos/platforms/micaz/.platform @@ -46,9 +46,9 @@ push( @includes, qw( -mmcu=atmega128 -fnesc-target=avr -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/null/.platform b/tos/platforms/null/.platform index ddb80d41..9ae17389 100644 --- a/tos/platforms/null/.platform +++ b/tos/platforms/null/.platform @@ -17,6 +17,7 @@ push( @includes, qw( -gcc=gcc -fnesc-target=pc -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ); + +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; diff --git a/tos/platforms/telosa/.platform b/tos/platforms/telosa/.platform index 252f2e1a..8e511343 100644 --- a/tos/platforms/telosa/.platform +++ b/tos/platforms/telosa/.platform @@ -45,8 +45,8 @@ push( @includes, qw( -mmcu=msp430x149 -fnesc-target=msp430 -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask ); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/telosb/.platform b/tos/platforms/telosb/.platform index f196d238..27593f80 100644 --- a/tos/platforms/telosb/.platform +++ b/tos/platforms/telosb/.platform @@ -46,9 +46,8 @@ push( @includes, qw( -mmcu=msp430x1611 -fnesc-target=msp430 -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask - ); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; diff --git a/tos/platforms/tinynode/.platform b/tos/platforms/tinynode/.platform index 6dc436ef..08829375 100644 --- a/tos/platforms/tinynode/.platform +++ b/tos/platforms/tinynode/.platform @@ -37,9 +37,9 @@ push( @includes, qw( -gcc=msp430-gcc -mmcu=msp430x1611 -fnesc-target=msp430 - -fnesc-no-debug - -fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask); + -fnesc-no-debug); +push @opts, "-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask" if !$with_scheduler_flag; push @opts, "-mingw-gcc" if $cygwin; #@commonplatforms = ("msp430"); -- 2.39.2