Added DDR check to program_evm, updated userguide
authorCasey Smith <c-smith@ti.com>
Mon, 24 Sep 2012 18:36:28 +0000 (14:36 -0400)
committerCasey Smith <c-smith@ti.com>
Mon, 24 Sep 2012 18:36:28 +0000 (14:36 -0400)
program_evm/program_evm.js
program_evm/program_evm_userguide.doc
program_evm/program_evm_userguide.pdf

index b5d6d52d11f8bd287b922cec02c58c4b6ec33e57..b7412422e5cf13071470f7596c2d24a827121489 100644 (file)
@@ -78,6 +78,7 @@ function getErrorCode(exception)
        }
        return 0;
 }
+
 function fileCopy(source,destination)
 {
        inputFile = new File(source);
@@ -104,6 +105,63 @@ function pausecomp(millis)
   }
 }
 
+function getFilesizeinBytes(file)
+{
+  inputFile = new File(file);
+  return inputFile.length();
+}
+
+function fileCompare(file1,file2,bytes)
+{
+    a = new File(file1);
+    b = new File(file2);
+    infile1 = new  java.io.FileReader(a);
+    infile2 = new java.io.FileReader(b);
+    var c;
+    while(bytes) {
+        c = infile1.read();
+        d = infile2.read();
+        if (c != d)
+            return 1;
+        bytes--;
+    }
+    infile1.close();
+    infile2.close();
+    return 0
+}
+
+// Check the content loaded into DDR against the original file
+function checkDdrContent(nPage, nAddress, nSize, nTypeSize, sFilename, saveByteSwap)
+{
+    script.traceWrite("Comparing DDR content with " + sFilename + " ...");
+    file = new File(sFilename);
+    cfile = file.getParent() + "\\ddr-out";
+    script.traceWrite("cfile is " + cfile);
+    debugSession.memory.saveRaw(nPage, nAddress, cfile, nSize/4, nTypeSize, saveByteSwap); // Get content from DDR and load it into file at ../ddr-out
+    script.traceWrite("File size is eeprom " + getFilesizeinBytes(sFilename));
+    script.traceWrite("File size is " + cfile + " " + getFilesizeinBytes(cfile));
+    var cmp = fileCompare(sFilename, cfile, nSize)
+    script.traceWrite("Compare returns " + cmp);
+    delete(cfile);
+    return cmp;
+}
+
+function cleanup()
+{
+       if (testEnv.cioFile != null)
+       {
+         // Stop CIO logging.
+         debugSession.endCIOLogging();
+       }
+
+       debugSession.terminate();
+       debugServer.stop()
+
+       // Stop logging and exit.
+       script.traceEnd();
+       java.lang.System.exit(0);
+}
+
 //*******************************************
 // Declarations and Inititalizations
 var nandwriter_dir    = java.lang.System.getProperty("user.dir");
@@ -121,6 +179,8 @@ var targetConfig = "unknown";
 var emul560 = false;
 var xds200 = false;
 var emulation_spec = "onboard XDS100";
+var verifyDdr = false;
+
 testEnv.cioFile = null;
 
 if (java.lang.System.getProperty("os.name").match(/Linux/i))
@@ -129,7 +189,7 @@ if (java.lang.System.getProperty("os.name").match(/Linux/i))
 }
 
 // Parse the arguments
-if (arguments.length > 0 && arguments.length < 3)
+if (arguments.length > 0 && arguments.length < 4)
 {
     // parse the board spec
     var board_spec = arguments[0].toLowerCase();
@@ -189,14 +249,17 @@ if (arguments.length > 0 && arguments.length < 3)
     }
     
     if(arguments[1])
-        writerImages = arguments[1];
+        verifyDdr = (arguments[1] == 1) ? true : false;
+    
+    if(arguments[2])
+        writerImages = arguments[2];
     else
         writeAll = true;   
 }
 else
 {
   print("Syntax error in command line");
-       print("Syntax: program_evm.js [tmdx|tmds]evm[c](<device>)l[x][e][-le|-be] [images_to_write]")
+       print("Syntax: program_evm.js [tmdx|tmds]evm[c](<device>)l[x][e][-le|-be] [1|0] [images_to_write]")
   
        print("    tmdx: TMDX type EVM")
        print("    tmds: TMDS type EVM")
@@ -208,7 +271,8 @@ else
        print("    le: Little Endian")
        print("    be: Big Endian")
 
-       print("    example: TMDXEVM6678L-le")   
+       print("    example: TMDXEVM6678L-le")
+       print("    [1|0] OPTIONAL. If 1, ddr contents are verified against file to be written else ddr contents are not verified. Recommended to set to 1 for use with 560 Mezzanine Emulator daughter card only ")     
        print("    [images_to_write] OPTIONAL is a list of the images to be written")
        print("    example: eeprom50,nor")
        print("    If not specified all (eeprom50,eeprom51,nand,nor) will be written")
@@ -319,6 +383,7 @@ if(writeAll || writerImages.match(/eeprom50/))
                var sFilename = eeprom50 ;
                var nTypeSize = 32;
                var bByteSwap = false;
+               var nSize = getFilesizeinBytes(sFilename);
                try
                {
                        debugSession.memory.loadRaw(nPage, nAddress, sFilename, nTypeSize, bByteSwap);
@@ -330,6 +395,12 @@ if(writeAll || writerImages.match(/eeprom50/))
                                        " to target memory!");
                }
                debugSession.target.run()
+               if (verifyDdr){
+                       if(checkDdrContent(nPage, nAddress, nSize, nTypeSize, sFilename, bByteSwap) == 1) {
+                               script.traceWrite("Programming eeprom50 has failed. Please retry programming \n");
+                               cleanup();
+                       }
+               }
                end = localTime();
        }
        else
@@ -356,6 +427,7 @@ if(writeAll || writerImages.match(/eeprom51/))
                var sFilename = eeprom51;
                var nTypeSize = 32;
                var bByteSwap = iblByteSwap;
+               var nSize = getFilesizeinBytes(sFilename);
                try
                {
                        debugSession.memory.loadRaw(nPage, nAddress, sFilename, nTypeSize, bByteSwap);
@@ -368,6 +440,12 @@ if(writeAll || writerImages.match(/eeprom51/))
                }
 
                debugSession.target.run()
+               if (verifyDdr){
+                       if(checkDdrContent(nPage, nAddress, nSize, nTypeSize, sFilename, bByteSwap) == 1) {
+                               script.traceWrite("Programming eeprom51 has failed. Please retry programming \n");
+                               cleanup();
+                       }
+               }
                end = localTime();
        }
        else
@@ -398,6 +476,7 @@ if(writeAll || writerImages.match(/nand/))
                var sFilename = nand;
                var nTypeSize = 32;
                var bByteSwap = false;
+               var nSize = getFilesizeinBytes(sFilename);
     
                try
                {   
@@ -413,6 +492,12 @@ if(writeAll || writerImages.match(/nand/))
                }
                script.traceWrite("Start programming NAND");
                debugSession.target.run()
+               if (verifyDdr){
+                       if(checkDdrContent(nPage, nandNorAddress, nSize, nTypeSize, sFilename, bByteSwap) == 1) {
+                               script.traceWrite("Programming nand has failed. Please retry programming \n");
+                               cleanup();
+                       }
+               }
                script.traceWrite("End programming NAND");
                end_nand = localTime();
        }
@@ -498,6 +583,7 @@ if(writeAll || writerImages.match(/nor/))
                var sFilename = nor ;
                var nTypeSize = 32;
                var bByteSwap = false;
+               var nSize = getFilesizeinBytes(sFilename);
                try
                {   
                        script.traceWrite("Start loading nor.bin");
@@ -513,6 +599,12 @@ if(writeAll || writerImages.match(/nor/))
                script.traceWrite("Start programming NOR");
                script.traceWrite(localTime());
                debugSession.target.run()
+               if (verifyDdr){
+                       if(checkDdrContent(nPage, nandNorAddress, nSize, nTypeSize, sFilename, bByteSwap) == 1) {
+                               script.traceWrite("Programming nor has failed. Please retry programming \n");
+                               cleanup();
+                       }
+               }
                script.traceWrite("End programming NOR");
                end_nor = localTime();
     }
index edf1cc8e26bef08943be3fb732723cfb60b5a575..3013fc49b7168e512e72d06ba1645aee4a421893 100644 (file)
Binary files a/program_evm/program_evm_userguide.doc and b/program_evm/program_evm_userguide.doc differ
index f37a6755cc741d3f0d97662e9265dae30a7f313f..5e87d68ab88634771e97cd014eac5769ce067706 100755 (executable)
Binary files a/program_evm/program_evm_userguide.pdf and b/program_evm/program_evm_userguide.pdf differ