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
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
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"
stderr.write(s + "\n")
exit(2)
-sector_size = 256
-flash_size = 2048 # in sectors
-
volumes = {}
volmap = []
volumeNames = []
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")
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":
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")