]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
storage fix, change in test app. should not impact other users
authorr-studio <r-studio>
Thu, 5 Nov 2009 12:42:34 +0000 (12:42 +0000)
committerr-studio <r-studio>
Thu, 5 Nov 2009 12:42:34 +0000 (12:42 +0000)
apps/tests/storage/Config/volumes-at45db.xml
tools/tinyos/misc/tos-storage-at45db.1
tools/tinyos/misc/tos-storage-at45db.in

index 7cc59802a58dd56c2db58d44d98fcce66c6fa761..e221874e19a1b1b295be8246ae5591420227c34e 100644 (file)
@@ -1,4 +1,4 @@
 <volume_table>
   <volume name="LOGTEST" size="262144"/>
-  <volume name="CONFIGTEST" size="4608"/>
+  <volume name="CONFIGTEST" size="5120"/>
 </volume_table>
index 885eabeaa5999f065455917d39a0708cfdca395b..22af233e0c3f68df6ea8fef22d46380e77a205a0 100644 (file)
@@ -5,7 +5,7 @@
 tos-storage-at45db - Generate storage volume description code
 .SH SYNOPSIS
 
-\fBtos-storage-at45db\fR [\fB-t\fR] \fIplatform-directory\fR
+\fBtos-storage-at45db\fR [\fB-t\fR] [\fB-s\fR <sector size>] [\fB-f\fR <flash size in sectors>] \fIplatform-directory\fR
 .SH DESCRIPTION
 
 \fBtos-storage-at45db\fR reads a user specification describing the layout
@@ -15,6 +15,8 @@ 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 optional \fB-s\fR flag specifies the sector size on the flash, the default is 256.
+The optional \fB-f\fR flag specifies the total number of sectors on the flash, the default is 2048.
 
 The mandatory \fIplatform-directory\fR argument should specify the platform 
 directory for the current compilation target; this is necessary for the correct 
index a58a962767198dc989ef630b88ececd2099fc7cb..0fe5872d1e3081c012df5d0b1ef0dddd9b80a02a 100644 (file)
@@ -18,15 +18,22 @@ import string
 import commands
 #New way of handling arguments........
 try:
-  opts, args = getopt(argv[1:], "t", [])
+  opts, args = getopt(argv[1:], "ts:f:", [])
 except GetoptError, err:
   print str(err) # will print something like "option -a not recognized"
-  stderr.write("Usage: tos-storage-at45db [-t] <platform directory>\n")
+  stderr.write("Usage: tos-storage-at45db [-t] [-s <sector size>] [-f <flash size in sectors>] <platform directory>\n")
   
+sector_size = 256
+flash_size = 2048 # in sectors
+
 cthreads = False
 for o, a in opts:
   if o == "-t":
     cthreads = True
+  elif o == "-s":
+    sector_size = int(a)
+  elif o == "-f":
+    flash_size = int(a)
   else:
     assert False, "unhandled option"
 
@@ -45,9 +52,6 @@ def nfail(s):
   stderr.write(s + "\n")
   exit(2)
 
-sector_size = 256
-flash_size = 2048 # in sectors
-
 volumes = {}
 volmap = []
 volumeNames = []
@@ -229,7 +233,7 @@ if cthreads == True:
   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 Mount as ConfigMount[uint8_t volumeId]; \n")
   outFile.write("    interface ConfigStorage[uint8_t volumeId]; \n")
   outFile.write("  } \n")
   outFile.write("} \n")
@@ -241,9 +245,6 @@ if cthreads == True:
   outFile.write("  BlockWrite = VolumeMapP; \n")
   outFile.write("  LogRead = VolumeMapP; \n")
   outFile.write("  LogWrite = VolumeMapP; \n")
-  outFile.write("  Mount = VolumeMapP; \n")
-  outFile.write("  ConfigStorage = VolumeMapP; \n")
-
 
   for i in range(len(volumeNames)):
     if volumeTypes[volumeNames[i]] == "block":
@@ -260,9 +261,9 @@ if cthreads == True:
       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")
+    elif volumeTypes[volumeNames[i]] == "config":
+      outFile.write("  components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n")
+      outFile.write("  ConfigMount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
+      outFile.write("  ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n")
   outFile.write("} \n")