It can be hardware failure
Since the test memory cmd is not working
try first by giving "show startup-con" or sh nvram cmd..
try for "write erase" and reload the router.
if still both show error then it can be hardware failure.. :(
Hope u have got backup 4 the startup configuration