
74 Chapter 6: Memory
Unfortunately, it is not always possible to write memory tests in a high-level lan-
guage. For example, C and C++ both require the use of a stack. But a stack itself
requires working memory. This might be reasonable in a system that has more
than one memory device. For example, you might create a stack in an area of
RAM that is already known to be working, while testing another memory device.
In a common such situation, a small SRAM could be tested from assembly and the
stack could be created there afterward. Then a larger block of DRAM could be
tested using a nicer test algorithm, like the one shown earlier. If you cannot
assume enough working RAM for the stack and data needs of the test program,
then you will need to rewrite these memory test routines entirely in assembly
language.
Another option is to run the memory test program from an emulator. In this case,
you could choose to place the stack in an area of the emulator’s own internal
memory. By moving the emulator’s internal memory around in the target memory
map, you could systematically test each memory device on the target.
The need for memory testing is perhaps most apparent during product develop-
ment, when the reliability of the hardware and its design are still unproved. How-
ever, memory is one of the most critical resources in any embedded system, so it
might also be desirable to include a memory test in the ...