tools: nand writer: fix read verify bug
authorHao Zhang <hzhang@ti.com>
Fri, 11 Sep 2015 19:27:05 +0000 (15:27 -0400)
committerHao Zhang <hzhang@ti.com>
Fri, 11 Sep 2015 19:27:05 +0000 (15:27 -0400)
Nand writer uses DDR memory to store the read buffer (for verification)
and the write buffer of the written file. The maximum buffer size is the
size of the NAND device. If the NAND device size is 2GB (e.g. K2L EVM),
it will exceed the DDR size (2GB) and report an error.

The fix will only allow maximum size of 1GB for the buffer size.

Signed-off-by: Hao Zhang <hzhang@ti.com>
writer/nand/src/nandwriter.c

index 458796be306167549b6ef0ef762d399d86d35d6a..d520410f370deabe17be82302113300b56cf2e01 100755 (executable)
@@ -626,6 +626,8 @@ void main ()
         return;\r
     }\r
     nandWriterInfo.deviceTotalBytes = p_device->block_count * p_device->page_count * p_device->page_size;\r
+    if (nandWriterInfo.deviceTotalBytes > 0x40000000)\r
+        nandWriterInfo.deviceTotalBytes = 0x40000000; /* Max write size 1 GB */\r
     nandWriterInfo.blockSizeBytes   = p_device->page_count * p_device->page_size;\r
 \r
     if ((nandWriterInfo.startAddr % nandWriterInfo.blockSizeBytes) != 0)\r