MCSDK 3.0: Update to NAND writer for multiple ECC formats
authorCasey Smith <c-smith@ti.com>
Fri, 5 Apr 2013 21:43:51 +0000 (17:43 -0400)
committerCasey Smith <c-smith@ti.com>
Fri, 5 Apr 2013 21:43:51 +0000 (17:43 -0400)
writer/nand/evmk2h/bin/nand_writer_input.txt
writer/nand/src/nandwriter.c

index 009e6a154a81cc4f7f1ab334c8757b1d7a11c7f3..340b140cd137db7127562279d8ae48827f4d6f65 100755 (executable)
@@ -1,5 +1,6 @@
 file_name  = app.bin
-start_addr = 16384
+start_addr = 0
+rbl_ecc    = 0
 
 
 
index b8fe3c0035327688faa982cabe4683d49f63fe82..af89f9ae0f9406318d11fbb1ad64f1dc768290d3 100755 (executable)
@@ -58,6 +58,7 @@ volatile uint32_t nand_erase_flag = 0;
 /* Parameters defined in the input_file */
 #define FILE_NAME      "file_name"
 #define START_ADDR     "start_addr"
+#define RBL_ECC        "rbl_ecc"
 
 /* Memory address to store the write data */
 #define WRITE_DATA_ADDRESS     0x80000000
@@ -79,6 +80,7 @@ typedef struct NAND_WRITER_INFO_tag
     uint32_t    deviceTotalBytes;           /* Total number of bytes available in the device */
     uint32_t    startAddr;                  /* Start address to write */
     uint32_t    writeBytes;                 /* Number of bytes to be written into the device */
+    uint8_t     flags;                      /* Flag used for EVMK2H for multiple ECC formats */
     uint8_t     *writeData;                 /* Address to store the write data */
     uint8_t     *readData;                  /* Address to store the read data */
 
@@ -434,6 +436,19 @@ parse_input_file
     }
 
     nandWriterInfo.startAddr = (uint32_t)atoi(data);
+    
+    fgets(line, MAX_LINE_LENGTH, fp);
+    key = (char *)strtok(line, tokens);
+    data = (char *)strtok(NULL, tokens);
+    
+    if(strlen(data) != 0 && (strcmp(key, RBL_ECC) == 0))
+    {
+        nandWriterInfo.flags = (uint8_t)atoi(data);
+    }
+    else
+    {
+        nandWriterInfo.flags = 0;
+    }
 
     return TRUE;
 }
@@ -551,7 +566,7 @@ void main ()
         return;
     }
 #if (defined(_EVMC6657L_) || defined(DEVICE_K2H) || defined(DEVICE_K2K))
-    p_device = platform_device_open(PLATFORM_DEVID_MT29F1G08ABCHC, 0);
+    p_device = platform_device_open(PLATFORM_DEVID_MT29F1G08ABCHC, nandWriterInfo.flags);
 #else
     p_device = platform_device_open(PLATFORM_DEVID_NAND512R3A2D, 0);
 #endif