Index: emcore/trunk/tools/emcore.py |
— | — | @@ -841,28 +841,27 @@ |
842 | 842 | except IOError:
|
843 | 843 | raise ArgumentError("Can not open input files!")
|
844 | 844 | try:
|
845 | | - buf = self.emcore.memalign(0x10, banks * ppb * 0x844)
|
| 845 | + buf = self.emcore.memalign(0x10, 0x844)
|
846 | 846 | for block in range(info["blocks"]):
|
847 | 847 | for bank in range(info["banks"]):
|
848 | | - self.logger.info("\r Erasing block %d bank %d" % (block, bank))
|
| 848 | + self.logger.info("\r Erasing block %d bank %d " % (block, bank))
|
849 | 849 | self.emcore.ipodnano2g_nanderase(buf, block * banks + bank, 1)
|
850 | 850 | rc = struct.unpack("<I", self.emcore.read(buf, 4))[0]
|
851 | 851 | if rc != 0: self.logger.info("\rBlock %d bank %d erase failed with RC %08X\n" % (block, bank, rc))
|
852 | | - self.logger.info("\r Uploading block %d data " % block)
|
853 | | - self.emcore.write(buf, datafile.read(banks * ppb * 2048))
|
854 | | - self.emcore.write(buf + banks * ppb * 2048, sparefile.read(banks * ppb * 64))
|
855 | | - self.logger.info("\rProgramming block %d " % block)
|
856 | | - self.emcore.ipodnano2g_nandwrite(buf, block * banks * ppb, banks * ppb, 0)
|
857 | | - rc = struct.unpack("<%dI" % (banks * ppb), self.emcore.read(buf + banks * ppb * 2112, banks * ppb * 4))
|
858 | 852 | for page in range(ppb):
|
859 | | - for bank in range(banks):
|
860 | | - if rc[banks * page + bank] != 0:
|
861 | | - self.logger.info("\rBlock %d bank %d page %d programming failed with RC %08X\n" % (block, bank, page, rc[banks * page + bank]))
|
| 853 | + for bank in range(banks):
|
| 854 | + data = datafile.read(2048) + sparefile.read(64)
|
| 855 | + if data == "\xff" * 2112: continue
|
| 856 | + self.emcore.write(buf, data)
|
| 857 | + self.logger.info("\rProgramming block %d page %d bank %d" % (block, page, bank))
|
| 858 | + self.emcore.ipodnano2g_nandwrite(buf, ((block * ppb) + page) * banks + bank, 1, 0)
|
| 859 | + rc = struct.unpack("<I", self.emcore.read(buf + 2112, 4))[0]
|
| 860 | + if rc != 0: self.logger.info("\rBlock %d bank %d page %d programming failed with RC %08X\n" % (block, bank, page, rc))
|
862 | 861 | finally:
|
863 | 862 | self.emcore.free(buf)
|
864 | 863 | datafile.close()
|
865 | 864 | sparefile.close()
|
866 | | - self.logger.info("\rdone\n")
|
| 865 | + self.logger.info("\ndone\n")
|
867 | 866 |
|
868 | 867 | @command
|
869 | 868 | def ipodnano2g_wipenand(self, filename, force=False):
|