Chapter 55. Tests and utilities
55.1. Unit and functional tests
The NAND library includes a number of tests. The most useful to
driver writers are
the others are only likely to be of interest to library maintainers.
Performs a read-write-erase cycle on the first NAND device it finds, checking that its operations have had the expected effect on the device contents. This is a potentially destructive test; do not run it on a device containing data you care about!
A more involved version of
readwrite, this is a timing test which performs multiple reads, writes and erases and applies statistical techniques to the results in the same way that
tm_basicinstruments the speed of various eCos kernel functions. This is a potentially destructive test; do not run it on a device containing data you care about!
Repeatedly makes single-bit changes to a data buffer and checks that the software ECC implementation correctly repairs them.
This test can be adapted to test out hardware ECC implementations. The test outputs the raw ECC codes as it goes, which is useful in confirming that the bits in the computed ECC are what you think they are.
Some unit tests which do not require any NAND device: ECC known answer vectors, and OOB area packing/unpacking correctness.
Attempts to read a block outside of a partition, confirming that it doesn't work.
There are some further tests of the library which require the synthetic NAND device.
55.2. Ancillary NAND utilities
The following utilities are included with the NAND library.
They are standalone eCos applications; for convenience, you can set
CYGBLD_IO_NAND_BUILD_UTILS in your eCos configuration
and they will be built and placed into
It is particularly dangerous to run the utility
Loops over all the blocks of a partition, erasing all the blocks  which are not marked as bad. The device and partition to erase are set by #define.
Erases the NAND blocks comprising the primary and mirror bad-block tables of a device. The device to erase is set by #define. (The tables are detected by the library in the usual way. If none are present, the library will scan the device for factory-bad blocks to create such a table, then this code will immediately erase it.)
 This will not normally erase the Bad Block Table. This is because
the BBT reports its own blocks as "Reserved" when queried via
cyg_nand_bbt_query, which makes them inaccessible
to applications. However, if
CYGSEM_IO_NAND_USE_BBT is turned off, then any BBT
present will not be detected and hence will be erased.
 Note the warning regarding running this on a production device
|2018-07-27||Open Publication License|