[Tinyos-2-commits] CVS: tinyos-2.x/tools/tinyos/misc Makefile.am, 1.7, 1.8 tos-storage-at45db.1, 1.4, 1.5 tos-storage-at45db.in, 1.3, 1.4 tos-storage-pxa27xp30, 1.4, 1.5 tos-storage-pxa27xp30.1, 1.2, 1.3 tos-storage-pxa27xp30.in, 1.4, 1.5 tos-storage-stm25p.1, 1.3, 1.4 tos-storage-stm25p.in, 1.5, 1.6
Kevin Klues
klueska at users.sourceforge.net
Thu May 22 18:04:42 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27902/tinyos/misc
Modified Files:
Makefile.am tos-storage-at45db.1 tos-storage-at45db.in
tos-storage-pxa27xp30 tos-storage-pxa27xp30.1
tos-storage-pxa27xp30.in tos-storage-stm25p.1
tos-storage-stm25p.in
Log Message:
Update to tos-storage-* tools to support a '-t' flag to generate a VolumeMapC.nc file that exports interfaces from all the volumes described in the XML file for a particular storage chip. Also fixed the make system to create and install the tos-storage-pxa27xp30 script
Index: Makefile.am
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Makefile.am 19 May 2008 21:25:08 -0000 1.7
--- Makefile.am 23 May 2008 01:04:36 -0000 1.8
***************
*** 12,15 ****
--- 12,16 ----
tos-storage-at45db.1 \
tos-storage-stm25p.1 \
+ tos-storage-pxa27xp30.1 \
tos-write-image.1 \
tos-build-deluge-image.1 \
***************
*** 29,32 ****
--- 30,34 ----
tos-storage-stm25p \
tos-storage-at45db \
+ tos-storage-pxa27xp30 \
tos-build-deluge-image \
tos-deluge
Index: tos-storage-at45db.1
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-storage-at45db.1,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tos-storage-at45db.1 11 Apr 2007 21:29:29 -0000 1.4
--- tos-storage-at45db.1 23 May 2008 01:04:36 -0000 1.5
***************
*** 6,10 ****
.SH SYNOPSIS
! \fBtos-storage-at45db\fR \fIplatform-directory\fR
.SH DESCRIPTION
--- 6,10 ----
.SH SYNOPSIS
! \fBtos-storage-at45db\fR [\fB-t\fR] \fIplatform-directory\fR
.SH DESCRIPTION
***************
*** 12,21 ****
of storage volumes on an Atmel AT45DB-family flash chip, and generates code
describing that layout for use by the TinyOS 2.0 storage subsystem. The
! user specification is in XML and is read from standard input. The code is
! written to standard output.
! The argument should specify the platform directory for the current
! compilation target; this is necessary for the correct handling of
! file include statements in the XML input.
This program is normally invoked automatically by the TinyOS build system
--- 12,23 ----
of storage volumes on an Atmel AT45DB-family flash chip, and generates code
describing that layout for use by the TinyOS 2.0 storage subsystem. The
! user specification is in XML and is read from standard input. With all options,
! the code for a header file is written to standard output. With the
! optional \fB-t\fR flag specified, a VolumeMapC.nc file is generated that provides
! interfaces to all the storage volume abstractions defined in the XML file.
! The mandatory \fIplatform-directory\fR argument should specify the platform
! directory for the current compilation target; this is necessary for the correct
! handling of file include statements in the XML input.
This program is normally invoked automatically by the TinyOS build system
***************
*** 23,29 ****
.SH EXAMPLES
! tos-storage-at45db /opt/tinyos-2.x/tos/platforms/mica2 \\
<volumes-at45db.xml >build/mica2/StorageVolumes.h
.SH SEE ALSO
! .IR tos-storage-stm25p (1)
--- 25,32 ----
.SH EXAMPLES
! tos-storage-at45db -t /opt/tinyos-2.x/tos/platforms/mica2 \\
<volumes-at45db.xml >build/mica2/StorageVolumes.h
.SH SEE ALSO
! .IR tos-storage-stm25p (1)
! .IR tos-storage-pxa27xp30 (1)
Index: tos-storage-at45db.in
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-storage-at45db.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tos-storage-at45db.in 11 Apr 2007 21:06:58 -0000 1.3
--- tos-storage-at45db.in 23 May 2008 01:04:36 -0000 1.4
***************
*** 14,31 ****
from subprocess import Popen, PIPE
! # print an error message and exit
! def nfail(s):
! stderr.write(s + "\n")
! exit(2)
! if len(argv) == 2:
! platformdir = argv[1]
# This gives the whole string when there's no / in platformdir
! platform = platformdir[platformdir.rfind("/") + 1:]
! elif len(argv) == 1:
platformdir = ""
platform = ""
else:
! nfail("Usage: tos-storage-at45db <platform directory>")
sector_size = 256
--- 14,48 ----
from subprocess import Popen, PIPE
! from getopt import *
! import string
! import commands
! #New way of handling arguments........
! try:
! opts, args = getopt(argv[1:], "t", [])
! except GetoptError, err:
! print str(err) # will print something like "option -a not recognized"
! stderr.write("Usage: tos-storage-at45db [-t] <platform directory>\n")
!
! cthreads = False
! for o, a in opts:
! if o == "-t":
! cthreads = True
! else:
! assert False, "unhandled option"
! if len( args ) == 1:
! platformdir = args[0]
# This gives the whole string when there's no / in platformdir
! platform = platformdir[platformdir.rfind( "/" ) + 1:]
! elif len( args ) == 0:
platformdir = ""
platform = ""
else:
! stderr.write("Usage: tos-storage-at45db [-t] <platform directory>\n")
!
! # print an error message and exit
! def nfail(s):
! stderr.write(s + "\n")
! exit(2)
sector_size = 256
***************
*** 34,37 ****
--- 51,57 ----
volumes = {}
volmap = []
+ volumeNames = []
+ volumeTypes = dict()
+ volumeOptions = dict()
def check_volume(name, base, size):
***************
*** 131,134 ****
--- 151,158 ----
size = volume.getAttribute("size")
base = volume.getAttribute("base")
+ type = string.lower(volume.getAttribute("type"))
+ isCircular = string.upper(volume.getAttribute("circular"))
+ if isCircular == "":
+ isCircular = "FALSE"
if name == None:
nfail("name omitted in volume " + fname)
***************
*** 136,139 ****
--- 160,168 ----
nfail("size omitted in volume %s %s" % (name, fname))
check_volume(name, base, size)
+
+ volumeNames.append( "VOLUME_" + name )
+ volumeTypes["VOLUME_" + name] = type
+ volumeOptions["VOLUME_" + name] = isCircular
+
for include in dom.documentElement.getElementsByTagName("include"):
included = include.firstChild
***************
*** 190,191 ****
--- 219,265 ----
print "#endif"
+ # output nc file for threads
+ if cthreads == True:
+ outFile = open(commands.getstatusoutput("pwd")[1] + "/VolumeMapC.nc", "w")
+ outFile.write("#include \"StorageVolumes.h\" \n")
+ outFile.write("\n")
+ outFile.write("configuration VolumeMapC { \n")
+ outFile.write(" provides { \n")
+ outFile.write(" interface BlockRead[uint8_t volume_id]; \n")
+ outFile.write(" interface BlockWrite[uint8_t volume_id]; \n")
+ outFile.write(" interface LogRead[uint8_t volumeId]; \n")
+ outFile.write(" interface LogWrite[uint8_t volumeId]; \n")
+ # outFile.write(" interface Mount[uint8_t volumeId]; \n")
+ # outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
+ outFile.write(" } \n")
+ outFile.write("} \n")
+ outFile.write("\n")
+ outFile.write("implementation { \n")
+ outFile.write(" components VolumeMapP; \n")
+ outFile.write("\n")
+ outFile.write(" BlockRead = VolumeMapP; \n")
+ outFile.write(" BlockWrite = VolumeMapP; \n")
+ outFile.write(" LogRead = VolumeMapP; \n")
+ outFile.write(" LogWrite = VolumeMapP; \n")
+
+ for i in range(len(volumeNames)):
+ if volumeTypes[volumeNames[i]] == "block":
+ outFile.write("\n")
+ outFile.write(" components new BlockStorageC(" + volumeNames[i] + ") as BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubBlockRead[" + volumeNames[i] + "] -> BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubBlockWrite[" + volumeNames[i] + "] -> BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("\n")
+
+ elif volumeTypes[volumeNames[i]] == "log":
+ outFile.write("\n")
+ outFile.write(" components new LogStorageC(" + volumeNames[i] + ", " + volumeOptions[volumeNames[i]] + ") as LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubLogRead[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubLogWrite[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("\n")
+
+ # elif volumeTypes[volumeNames[i]] == "config":
+ # outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
+ # outFile.write(" Mount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ # outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("} \n")
+
Index: tos-storage-pxa27xp30
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-storage-pxa27xp30,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tos-storage-pxa27xp30 12 Dec 2006 18:23:02 -0000 1.4
--- tos-storage-pxa27xp30 23 May 2008 01:04:36 -0000 1.5
***************
*** 1,3 ****
! #!/usr/bin/python
# -*- python -*-
# Copyright (c) 2005-2006 Arch Rock Corporation
--- 1,3 ----
! #!/Library/Frameworks/Python.framework/Versions/Current/bin/python
# -*- python -*-
# Copyright (c) 2005-2006 Arch Rock Corporation
***************
*** 41,44 ****
--- 41,71 ----
from xml.dom import minidom
+ from getopt import *
+ import string
+ import commands
+ #New way of handling arguments........
+ try:
+ opts, args = getopt(argv[1:], "t", [])
+ except GetoptError, err:
+ print str(err) # will print something like "option -a not recognized"
+ stderr.write( "Usage: tos-storage-stm25p [-t] <platform directory>\n" )
+
+ if len( args ) == 1:
+ platformdir = args[0]
+ # This gives the whole string when there's no / in platformdir
+ platform = platformdir[platformdir.rfind( "/" ) + 1:]
+ elif len( args ) == 0:
+ platformdir = ""
+ platform = ""
+ else:
+ stderr.write( "Usage: tos-storage-stm25p [-t] <platform directory>\n" )
+
+ cthreads = False
+ for o, a in opts:
+ if o == "-t":
+ cthreads = True
+ else:
+ assert False, "unhandled option"
+
NUM_SECTORS = 16
SECTOR_SIZE = 2097152
***************
*** 49,52 ****
--- 76,81 ----
volumeSizes = []
volumeOffsets = []
+ volumeTypes = dict()
+ volumeOptions = dict()
freeSectors = NUM_SECTORS*[ True ]
***************
*** 65,68 ****
--- 94,98 ----
volumeSizes.append( 1 )
volumeOffsets.append( 0 )
+ volumeTypes[ "VOLUME_PXARESERVED" ] = ""
freeSectors[ 0 ] = False
***************
*** 72,75 ****
--- 102,110 ----
size = volume.getAttribute( "size" )
base = volume.getAttribute( "base" )
+ type = string.lower(volume.getAttribute("type"))
+ isCircular = string.upper(volume.getAttribute("circular"))
+ if isCircular == "":
+ isCircular = "FALSE"
+
if name == "":
error_exit( "volume has no name" )
***************
*** 102,105 ****
--- 137,143 ----
volumeNames.append( "VOLUME_" + name )
volumeSizes.append( size / SECTOR_SIZE )
+ volumeTypes["VOLUME_" + name] = type
+ volumeOptions["VOLUME_" + name] = isCircular
+
if base == "":
volumeOffsets.append( -1 )
***************
*** 151,152 ****
--- 189,235 ----
print ""
print "#endif"
+
+ # output nc file for threads
+ if cthreads == True:
+ outFile = open(commands.getstatusoutput("pwd")[1] + "/VolumeMapC.nc", "w")
+ outFile.write("#include \"StorageVolumes.h\" \n")
+ outFile.write("\n")
+ outFile.write("configuration VolumeMapC { \n")
+ outFile.write(" provides { \n")
+ outFile.write(" interface BlockRead[uint8_t volume_id]; \n")
+ outFile.write(" interface BlockWrite[uint8_t volume_id]; \n")
+ outFile.write(" interface LogRead[uint8_t volumeId]; \n")
+ outFile.write(" interface LogWrite[uint8_t volumeId]; \n")
+ # outFile.write(" interface Mount[uint8_t volumeId]; \n")
+ # outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
+ outFile.write(" } \n")
+ outFile.write("} \n")
+ outFile.write("\n")
+ outFile.write("implementation { \n")
+ outFile.write(" components VolumeMapP; \n")
+ outFile.write("\n")
+ outFile.write(" BlockRead = VolumeMapP; \n")
+ outFile.write(" BlockWrite = VolumeMapP; \n")
+ outFile.write(" LogRead = VolumeMapP; \n")
+ outFile.write(" LogWrite = VolumeMapP; \n")
+
+ for i in range(len(volumeNames)):
+ if volumeTypes[volumeNames[i]] == "block":
+ outFile.write("\n")
+ outFile.write(" components new BlockStorageC(" + volumeNames[i] + ") as BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubBlockRead[" + volumeNames[i] + "] -> BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubBlockWrite[" + volumeNames[i] + "] -> BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("\n")
+
+ elif volumeTypes[volumeNames[i]] == "log":
+ outFile.write("\n")
+ outFile.write(" components new LogStorageC(" + volumeNames[i] + ", " + volumeOptions[volumeNames[i]] + ") as LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubLogRead[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubLogWrite[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("\n")
+
+ # elif volumeTypes[volumeNames[i]] == "config":
+ # outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
+ # outFile.write(" Mount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ # outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("} \n")
Index: tos-storage-pxa27xp30.1
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-storage-pxa27xp30.1,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tos-storage-pxa27xp30.1 6 Nov 2006 11:57:03 -0000 1.2
--- tos-storage-pxa27xp30.1 23 May 2008 01:04:36 -0000 1.3
***************
*** 9,18 ****
.SH DESCRIPTION
! \fBtos-storage-pxa27xp30\fR reads a user specification describing the
! layout of storage volumes on an embedded P30 flash in the Intel Xscale
! PXA27X series processor, and generates code describing that layout for
! use by the TinyOS 2.0 storage subsystem. The user specification is in
! XML and is read from standard input. The code is written to standard
! output.
This program is normally invoked automatically by the TinyOS build system
--- 9,24 ----
.SH DESCRIPTION
! \fBtos-storage-pxa27xp30\fR reads a user specification describing the layout of
! storage volumes on an embedded P30 flash in the Intel Xscale PXA27X series
! processor, and generates code describing that layout for use by the TinyOS 2.0
! storage subsystem. The user specification is in XML and is read from standard
! input. With all options, the code for a header file is written to standard
! output. With the optional \fB-t\fR flag specified, a VolumeMapC.nc file is
! generated that provides interfaces to all the storage volume abstractions
! defined in the XML file.
!
! The mandatory \fIplatform-directory\fR argument should specify the platform
! directory for the current compilation target; this is necessary for the correct
! handling of file include statements in the XML input.
This program is normally invoked automatically by the TinyOS build system
***************
*** 20,25 ****
.SH EXAMPLES
! tos-storage-pxa27xp30 <volumes-pxa27xp30.xml >build/telosb/StorageVolumes.h
.SH SEE ALSO
! .IR tos-storage-pxa27xp30 (1)
--- 26,33 ----
.SH EXAMPLES
! tos-storage-pxa27xp30 -t /opt/tinyos-2.x/tos/platforms/intelmote2 \\
! <volumes-pxa27xp30.xml >build/telosb/StorageVolumes.h
.SH SEE ALSO
! .IR tos-storage-stm25p (1)
! .IR tos-storage-at45db (1)
\ No newline at end of file
Index: tos-storage-pxa27xp30.in
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-storage-pxa27xp30.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tos-storage-pxa27xp30.in 12 Dec 2006 18:23:02 -0000 1.4
--- tos-storage-pxa27xp30.in 23 May 2008 01:04:36 -0000 1.5
***************
*** 1,3 ****
! #!@pythonpath@
# -*- python -*-
# Copyright (c) 2005-2006 Arch Rock Corporation
--- 1,3 ----
! #!@pathpython@
# -*- python -*-
# Copyright (c) 2005-2006 Arch Rock Corporation
***************
*** 41,44 ****
--- 41,71 ----
from xml.dom import minidom
+ from getopt import *
+ import string
+ import commands
+ #New way of handling arguments........
+ try:
+ opts, args = getopt(argv[1:], "t", [])
+ except GetoptError, err:
+ print str(err) # will print something like "option -a not recognized"
+ stderr.write( "Usage: tos-storage-stm25p [-t] <platform directory>\n" )
+
+ if len( args ) == 1:
+ platformdir = args[0]
+ # This gives the whole string when there's no / in platformdir
+ platform = platformdir[platformdir.rfind( "/" ) + 1:]
+ elif len( args ) == 0:
+ platformdir = ""
+ platform = ""
+ else:
+ stderr.write( "Usage: tos-storage-stm25p [-t] <platform directory>\n" )
+
+ cthreads = False
+ for o, a in opts:
+ if o == "-t":
+ cthreads = True
+ else:
+ assert False, "unhandled option"
+
NUM_SECTORS = 16
SECTOR_SIZE = 2097152
***************
*** 49,52 ****
--- 76,81 ----
volumeSizes = []
volumeOffsets = []
+ volumeTypes = dict()
+ volumeOptions = dict()
freeSectors = NUM_SECTORS*[ True ]
***************
*** 65,68 ****
--- 94,98 ----
volumeSizes.append( 1 )
volumeOffsets.append( 0 )
+ volumeTypes[ "VOLUME_PXARESERVED" ] = ""
freeSectors[ 0 ] = False
***************
*** 72,75 ****
--- 102,110 ----
size = volume.getAttribute( "size" )
base = volume.getAttribute( "base" )
+ type = string.lower(volume.getAttribute("type"))
+ isCircular = string.upper(volume.getAttribute("circular"))
+ if isCircular == "":
+ isCircular = "FALSE"
+
if name == "":
error_exit( "volume has no name" )
***************
*** 102,105 ****
--- 137,143 ----
volumeNames.append( "VOLUME_" + name )
volumeSizes.append( size / SECTOR_SIZE )
+ volumeTypes["VOLUME_" + name] = type
+ volumeOptions["VOLUME_" + name] = isCircular
+
if base == "":
volumeOffsets.append( -1 )
***************
*** 151,152 ****
--- 189,235 ----
print ""
print "#endif"
+
+ # output nc file for threads
+ if cthreads == True:
+ outFile = open(commands.getstatusoutput("pwd")[1] + "/VolumeMapC.nc", "w")
+ outFile.write("#include \"StorageVolumes.h\" \n")
+ outFile.write("\n")
+ outFile.write("configuration VolumeMapC { \n")
+ outFile.write(" provides { \n")
+ outFile.write(" interface BlockRead[uint8_t volume_id]; \n")
+ outFile.write(" interface BlockWrite[uint8_t volume_id]; \n")
+ outFile.write(" interface LogRead[uint8_t volumeId]; \n")
+ outFile.write(" interface LogWrite[uint8_t volumeId]; \n")
+ # outFile.write(" interface Mount[uint8_t volumeId]; \n")
+ # outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
+ outFile.write(" } \n")
+ outFile.write("} \n")
+ outFile.write("\n")
+ outFile.write("implementation { \n")
+ outFile.write(" components VolumeMapP; \n")
+ outFile.write("\n")
+ outFile.write(" BlockRead = VolumeMapP; \n")
+ outFile.write(" BlockWrite = VolumeMapP; \n")
+ outFile.write(" LogRead = VolumeMapP; \n")
+ outFile.write(" LogWrite = VolumeMapP; \n")
+
+ for i in range(len(volumeNames)):
+ if volumeTypes[volumeNames[i]] == "block":
+ outFile.write("\n")
+ outFile.write(" components new BlockStorageC(" + volumeNames[i] + ") as BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubBlockRead[" + volumeNames[i] + "] -> BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubBlockWrite[" + volumeNames[i] + "] -> BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("\n")
+
+ elif volumeTypes[volumeNames[i]] == "log":
+ outFile.write("\n")
+ outFile.write(" components new LogStorageC(" + volumeNames[i] + ", " + volumeOptions[volumeNames[i]] + ") as LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubLogRead[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubLogWrite[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("\n")
+
+ # elif volumeTypes[volumeNames[i]] == "config":
+ # outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
+ # outFile.write(" Mount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ # outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("} \n")
Index: tos-storage-stm25p.1
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-storage-stm25p.1,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tos-storage-stm25p.1 11 Apr 2007 21:29:29 -0000 1.3
--- tos-storage-stm25p.1 23 May 2008 01:04:36 -0000 1.4
***************
*** 12,21 ****
of storage volumes on an ST M25P80 flash chip, and generates code
describing that layout for use by the TinyOS 2.0 storage subsystem. The
! user specification is in XML and is read from standard input. The code is
! written to standard output.
! The argument should specify the platform directory for the current
! compilation target; this is necessary for the correct handling of
! file include statements in the XML input.
This program is normally invoked automatically by the TinyOS build system
--- 12,23 ----
of storage volumes on an ST M25P80 flash chip, and generates code
describing that layout for use by the TinyOS 2.0 storage subsystem. The
! user specification is in XML and is read from standard input. With all options,
! the code for a header file is written to standard output. With the
! optional \fB-t\fR flag specified, a VolumeMapC.nc file is generated that provides
! interfaces to all the storage volume abstractions defined in the XML file.
! The mandatory \fIplatform-directory\fR argument should specify the platform
! directory for the current compilation target; this is necessary for the correct
! handling of file include statements in the XML input.
This program is normally invoked automatically by the TinyOS build system
***************
*** 23,29 ****
.SH EXAMPLES
! tos-storage-stm25p /opt/tinyos-2.x/tos/platforms/telosb \\
<volumes-stm25p.xml >build/telosb/StorageVolumes.h
.SH SEE ALSO
! .IR tos-storage-stm25p (1)
--- 25,32 ----
.SH EXAMPLES
! tos-storage-stm25p -t /opt/tinyos-2.x/tos/platforms/telosb \\
<volumes-stm25p.xml >build/telosb/StorageVolumes.h
.SH SEE ALSO
! .IR tos-storage-pxa27xp30 (1)
! .IR tos-storage-at45db (1)
Index: tos-storage-stm25p.in
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/misc/tos-storage-stm25p.in,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** tos-storage-stm25p.in 11 Apr 2007 21:29:29 -0000 1.5
--- tos-storage-stm25p.in 23 May 2008 01:04:36 -0000 1.6
***************
*** 40,43 ****
--- 40,44 ----
# @author Jonathan Hui <jhui at archedrock.com>
# @author David Gay
+ # @author Kevin Klues <klueska at cs.stanford.edu>
#
# $Revision$
***************
*** 51,54 ****
--- 52,82 ----
from subprocess import Popen, PIPE
+ from getopt import *
+ import string
+ import commands
+ #New way of handling arguments........
+ try:
+ opts, args = getopt(argv[1:], "t", [])
+ except GetoptError, err:
+ print str(err) # will print something like "option -a not recognized"
+ stderr.write( "Usage: tos-storage-stm25p [-t] <platform directory>\n" )
+
+ if len( args ) == 1:
+ platformdir = args[0]
+ # This gives the whole string when there's no / in platformdir
+ platform = platformdir[platformdir.rfind( "/" ) + 1:]
+ elif len( args ) == 0:
+ platformdir = ""
+ platform = ""
+ else:
+ stderr.write( "Usage: tos-storage-stm25p [-t] <platform directory>\n" )
+
+ cthreads = False
+ for o, a in opts:
+ if o == "-t":
+ cthreads = True
+ else:
+ assert False, "unhandled option"
+
def error_exit( s ):
stderr.write( "ERROR: " + s + "\n" )
***************
*** 93,108 ****
volumeSizes = []
volumeOffsets = []
freeSectors = NUM_SECTORS*[ True ]
- if len( argv ) == 2:
- platformdir = argv[1]
- # This gives the whole string when there's no / in platformdir
- platform = platformdir[platformdir.rfind( "/" ) + 1:]
- elif len( argv ) == 1:
- platformdir = ""
- platform = ""
- else:
- error_exit( "Usage: tos-storage-stm25p <platform directory>" )
-
def volumeparse( file, fname, depth ):
if depth > 10:
--- 121,128 ----
volumeSizes = []
volumeOffsets = []
+ volumeTypes = dict()
+ volumeOptions = dict()
freeSectors = NUM_SECTORS*[ True ]
def volumeparse( file, fname, depth ):
if depth > 10:
***************
*** 120,123 ****
--- 140,148 ----
size = volume.getAttribute( "size" )
base = volume.getAttribute( "base" )
+ type = string.lower(volume.getAttribute("type"))
+ isCircular = string.upper(volume.getAttribute("circular"))
+ if isCircular == "":
+ isCircular = "FALSE"
+
if name == "":
error_exit( "volume has no name" )
***************
*** 149,152 ****
--- 174,180 ----
volumeNames.append( "VOLUME_" + name )
volumeSizes.append( size / SECTOR_SIZE )
+ volumeTypes["VOLUME_" + name] = type
+ volumeOptions["VOLUME_" + name] = isCircular
+
if base == "":
volumeOffsets.append( -1 )
***************
*** 208,209 ****
--- 236,282 ----
print ""
print "#endif"
+
+ # output nc file for threads
+ if cthreads == True:
+ outFile = open(commands.getstatusoutput("pwd")[1] + "/VolumeMapC.nc", "w")
+ outFile.write("#include \"StorageVolumes.h\" \n")
+ outFile.write("\n")
+ outFile.write("configuration VolumeMapC { \n")
+ outFile.write(" provides { \n")
+ outFile.write(" interface BlockRead[uint8_t volume_id]; \n")
+ outFile.write(" interface BlockWrite[uint8_t volume_id]; \n")
+ outFile.write(" interface LogRead[uint8_t volumeId]; \n")
+ outFile.write(" interface LogWrite[uint8_t volumeId]; \n")
+ # outFile.write(" interface Mount[uint8_t volumeId]; \n")
+ # outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n")
+ outFile.write(" } \n")
+ outFile.write("} \n")
+ outFile.write("\n")
+ outFile.write("implementation { \n")
+ outFile.write(" components VolumeMapP; \n")
+ outFile.write("\n")
+ outFile.write(" BlockRead = VolumeMapP; \n")
+ outFile.write(" BlockWrite = VolumeMapP; \n")
+ outFile.write(" LogRead = VolumeMapP; \n")
+ outFile.write(" LogWrite = VolumeMapP; \n")
+
+ for i in range(len(volumeNames)):
+ if volumeTypes[volumeNames[i]] == "block":
+ outFile.write("\n")
+ outFile.write(" components new BlockStorageC(" + volumeNames[i] + ") as BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubBlockRead[" + volumeNames[i] + "] -> BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubBlockWrite[" + volumeNames[i] + "] -> BlockStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("\n")
+
+ elif volumeTypes[volumeNames[i]] == "log":
+ outFile.write("\n")
+ outFile.write(" components new LogStorageC(" + volumeNames[i] + ", " + volumeOptions[volumeNames[i]] + ") as LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubLogRead[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write(" VolumeMapP.SubLogWrite[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("\n")
+
+ # elif volumeTypes[volumeNames[i]] == "config":
+ # outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
+ # outFile.write(" Mount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ # outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+ outFile.write("} \n")
More information about the Tinyos-2-commits
mailing list