[Tinyos8051wg-commit] SF.net SVN: tinyos8051wg:[1104] trunk/diku
Status: Alpha
Brought to you by:
mleopold
From: <mle...@us...> - 2010-01-30 21:15:40
|
Revision: 1104 http://tinyos8051wg.svn.sourceforge.net/tinyos8051wg/?rev=1104&view=rev Author: mleopold Date: 2010-01-30 21:15:33 +0000 (Sat, 30 Jan 2010) Log Message: ----------- Mangle script not handles reentrant even after CIL Modified Paths: -------------- trunk/diku/mcs51/doc/ChangeLog trunk/diku/mcs51/support/make/mcs51/inline.extra trunk/diku/mcs51/support/make/mcs51/mangleAppC.pl trunk/diku/tiny15four/support/make/tiny15four.extra Removed Paths: ------------- trunk/diku/mcs51/tos/platforms/cc2430em/PlatformStdOutC.nc Property Changed: ---------------- trunk/diku/tiny15four/apps/debugConsoleTest/ Modified: trunk/diku/mcs51/doc/ChangeLog =================================================================== --- trunk/diku/mcs51/doc/ChangeLog 2010-01-30 21:13:40 UTC (rev 1103) +++ trunk/diku/mcs51/doc/ChangeLog 2010-01-30 21:15:33 UTC (rev 1104) @@ -71,9 +71,11 @@ - Runtime configurable clock (for low-power modes) Sleep modes - Hvad g\xF8r TinyOS - UartC (kompatibilitet m. TEP113) SerialByteComm, SerialFlush - Serial Stack: eksisterende kode afhænger af den != UartC - PlatformSerialC: UartStream, UartByte, ... + UartC and PlatformSerial for all chips and platforms + Comptibile with printf and TOS codebase + PlatformSerialC: UartStream, UartByte, ... + Comptatibe with TEP113 and TEP117: + UartC: UartByteStream, SerialByteComm, SerialFlush SDCC virkende for simple programmer Move Jan debug libraries to common Jan: Reentrant problem: @@ -81,8 +83,18 @@ * L\xF8sn 1: Alle er reentrant * L\xF8ns 2: Marker hver for sig => TOS "mellem funtioner" virker ikke => Hvad med CIL? - Til n\xE6ste gang: CIL, IAR, + NesC async l\xF8sning: + Seperat output fil giver problemer med CIL omskrivninger + Output direkte i app.c => CIL videref\xF8rer attributes + + Til n\xE6ste gang: CIL, IAR, + TOSSIM Tiny4 timer model (missing: radio) + +Krav til release: + UART + printf + CIL + attribute((reentrant)) + 0.2 Timer precision as advertized SimpleMac idle-power-consumption problem Modified: trunk/diku/mcs51/support/make/mcs51/inline.extra =================================================================== --- trunk/diku/mcs51/support/make/mcs51/inline.extra 2010-01-30 21:13:40 UTC (rev 1103) +++ trunk/diku/mcs51/support/make/mcs51/inline.extra 2010-01-30 21:15:33 UTC (rev 1104) @@ -5,7 +5,7 @@ INLINE_FLAGS = --8051 --auto --clean --shorten endif -HOST_SWITCH=`uname -s | tr "[:upper:]" "[:lower:]" ` +HOST_SWITCH=$(shell uname -s | tr "[:upper:]" "[:lower:]") .PHONY: inline inline_target: ncc Modified: trunk/diku/mcs51/support/make/mcs51/mangleAppC.pl =================================================================== --- trunk/diku/mcs51/support/make/mcs51/mangleAppC.pl 2010-01-30 21:13:40 UTC (rev 1103) +++ trunk/diku/mcs51/support/make/mcs51/mangleAppC.pl 2010-01-30 21:15:33 UTC (rev 1104) @@ -98,6 +98,23 @@ @input = <FILE>; # +# CIL has a very annoying habbit of inserting newlines and " " after , +# + +my $prevLine = ""; +my @pass = (); +foreach(@input) { + if (s{,\n\s*}{, }g) { + $prevLine = $prevLine . $_; + } else { + s{^\s+}{}g; + push (@pass,($prevLine . $_)); + $prevLine = ""; + } +} +@input = @pass; + +# # Reentrant functions # @@ -131,14 +148,15 @@ # First pass of source: find all functions marked as reentrant foreach (@input) { - if (/([^\s]+?)\(.*?\).*?\s+__attribute(?:__)?\(\(.*?(?:__)?reentrant(?:__)?.*\)\).*?\;/g) { - my $func = $1; - $func =~ s/\$/__/g; - chomp ($func); - push(@reentrantFunctions, "$func"); - printf STDERR "Found reentrant function: '%s'\n",$func; + if (/([\w_\$]+)\([\w\s,\*]+\)\s+__attribute(?:__)?\(\(.*?(?:__)?reentrant(?:__)?.*\)\)\s*;/) { + my $func = $1; + $func =~ s/\$/__/g; + chomp ($func); + push(@reentrantFunctions, "$func"); + printf STDERR "Found reentrant function: '%s'\n",$func; } } + # Eliminate duplicates @reentrantFunctions = map ( lc, @reentrantFunctions); my @new_array = (); @@ -148,11 +166,11 @@ } @reentrantFunctions = @new_array; -print STDERR "Rentrant\n"; +print STDERR "Rentrant functions:\n"; foreach my $ln (@reentrantFunctions) { print STDERR "$ln\n"; } -print STDERR "Rentrant slut\n"; +print STDERR "Reentrant stop\n"; if (open (RFILE, ">$reentFile")) { @@ -365,22 +383,35 @@ # Handle reentrant functions # - if($KEIL && ! m{/\*(?:.*?)\;\*/}) { - s{(.*)__attribute\(\((reentrant)\)\)([^\;\n]*)}{$1$3 __attribute__((__$2__))}; - s{(.*)__attribute(?:__)?\(\((.*?)(?:__)?reentrant(?:__)?,?(.*)\)\)(.*)}{$1reentrant __attribute__(($2$3))$4}; - } - + # We do a relatively complicated match. Any attributes will be commented out later + # here we only mark function as reentrant and move on - the annotation is removed + # elsewhere. This is in part because of the way that CIL handles attributes. + # + # CIL seems to think that __attributes are part of the return type + # and copies them to the front of the expression and propagates the + # reentrant attributes and other undesired places + # + + if ($KEIL) { - # Append the "reentrant" keyword to function prototypes as well. - if (!$braceLevel && !m{reentrant}g) { + # Append the "reentrant" keyword to function prototypes and function + # definitions + if (!$braceLevel){ foreach my $reentrantFunc (@reentrantFunctions) { my $funcName = quotemeta($reentrantFunc); - if (m{$funcName\s*\(}gi) { - if (tr/\(// != tr/\)//) { + # Match a functioname (that is not a substring + if (m{[\s^\*]$funcName\s*\(}gi) { + # Check that this is a one-line definition + if ( tr/\(// != tr/\)// ) { # Paranthesis levels do not match. Wait for ")". + # We are not at the end of the line (; not found) $reentrantWait = 1; } else { - if (!s{([^\;\{]+)}{$1 reentrant}) { + # Put reentrant definition: + # 1. before ; or before { + # 2. after ) + if (!s{([^;\{]+)}{$1 reentrant}) { + $_ = "zzz" . $_; s{\)}{\) reentrant}; } printf STDERR "Fixed reentrant function: '%s'\n",$funcName; @@ -388,10 +419,9 @@ } # $i++; } - } + } - if ($reentrantWait && m{\)}) { - print STDERR "WAIT\n"; + if (!$braceLevel && $reentrantWait && m{\)}) { s{\)}{\) reentrant}; $reentrantWait = 0; } @@ -426,13 +456,14 @@ # # First check if the line has been uncommmented sinces comments in comments # are a nono... + # Removes any attributes including empty ones # Remove empty attributes (a leftover from reentrant and interrupt handling). - s{(__attribute(?:__)?\s*\(\(.*\)\))}{}g; + s{(__attribute(?:__)?\s*\(\(\)\))}{}g; if (! (m{^.*/\*} || # /* style comment m{^.*//})){ # // style comment - s{(__attribute(?:__)?\s*\(\(.*?\)\))}{/*$1*/}g; + s{(__attribute(?:__)?\s*\(\([,\w_\s]*\)\))}{/*$1*/}g; } # @@ -550,7 +581,7 @@ if($IAR) { s/(?!x)(.)data/$1atad/g; } else { - s/(?!x)(.)data/$1_data/g; + s/data/_data/g; } } $memory_att_match=0; # One line at a time... Deleted: trunk/diku/mcs51/tos/platforms/cc2430em/PlatformStdOutC.nc =================================================================== --- trunk/diku/mcs51/tos/platforms/cc2430em/PlatformStdOutC.nc 2010-01-30 21:13:40 UTC (rev 1103) +++ trunk/diku/mcs51/tos/platforms/cc2430em/PlatformStdOutC.nc 2010-01-30 21:15:33 UTC (rev 1104) @@ -1,50 +0,0 @@ - -/* - * Copyright (c) 2007 University of Copenhagen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - Neither the name of University of Copenhagen nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY - * OF COPENHAGEN OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/** - * - * @author Marcus Chang <ma...@di...> - */ - -configuration PlatformStdOutC { - - provides interface SerialByteComm; - -} - -implementation { - - components MainC, HalCC2430SimpleUartC; - MainC.SoftwareInit -> HalCC2430SimpleUartC; - - SerialByteComm = HalCC2430SimpleUartC; - -} Property changes on: trunk/diku/tiny15four/apps/debugConsoleTest ___________________________________________________________________ Added: svn:ignore + build Modified: trunk/diku/tiny15four/support/make/tiny15four.extra =================================================================== --- trunk/diku/tiny15four/support/make/tiny15four.extra 2010-01-30 21:13:40 UTC (rev 1103) +++ trunk/diku/tiny15four/support/make/tiny15four.extra 2010-01-30 21:15:33 UTC (rev 1104) @@ -32,7 +32,7 @@ TINY15FOUR_DIR := $(realpath $(dir $(filter %tiny15four.extra,$(MAKEFILE_LIST)))../../) endif -NESC_FLAGS=-Wnesc-data-race -Wnesc-async -Wno-nesc-fnptr -Wnesc-combine +NESC_FLAGS += -Wnesc-data-race -Wnesc-async -Wno-nesc-fnptr -Wnesc-combine # Using SDCC for the 8051 platform requires additional arguements # to disable the wird "runtime stack" and a wierd local variable location This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |