There is often a need to stress-test random access memory (RAM) for errors. OpenOCD comes with a Tcl implementation of well-known memory testing procedures allowing the detection of all sorts of issues with electrical wiring, defective chips, PCB layout and other common hardware problems.
To use them, you usually need to initialise your RAM controller first; consult your SoC's documentation to get the recommended list of register operations and translate them to the corresponding mww/mwb commands.
Load the memory testing functions with
source [find tools/memtest.tcl]
to get access to the following facilities:
Test the data bus wiring in a memory region by performing a walking 1's test at a fixed address within that region.
Perform a walking 1's test on the relevant bits of the address and check for aliasing. This test will find single-bit address failures such as stuck-high, stuck-low, and shorted pins.
Test the integrity of a physical memory device by performing an increment/decrement test over the entire region. In the process every storage bit in the device is tested as zero and as one.
Run all of the above tests over a specified memory region.
OpenOCD includes an easy-to-use script to facilitate mass-market devices recovery with JTAG.
For quickstart instructions run:
openocd -f tools/firmware-recovery.tcl -c firmware_help