Hi My customer wants to test unused XRAM after startup of the Embedded Application. How can I automatically find the top of assigned memory? I want to add this defined value into my "for" loop My XRAM is 8K and 0x0000 to 0x1FFF.
There are a couple of KB and app notes articles, as well as past forum discussions.
Briefly, you should create a file with one variable in it, so that you get a specific segment, and then use linker directives to locate that segment as the last one in your program. You can then take the address of that variable as the start of unused xdata.
I did wonder why you say "after" the application starts. It would be useful to be able to test all of xdata. You could replace the code in STARTUP.A51 that zeros out memory with code that tests it, and test all of the xdata, not just the unused portion. This would delay the start time of the application, of course.
If you try hard, you can actually test all of xdata while the application is running as a background process. You have to save the existing value of the word that you're testing and put it back when you're done. You also have to be very very sure that other code isn't going to use that word while you're testing, so you need to make sure interrupts are masked and so on.
Thanks VERY much This will do the trick
"you can actually test all of xdata while the application is running as a background process. You have to save the existing value of the word that you're testing and put it back when you're done"
But, if you feel the need to test it, then you must suspect a non-trivial risk of it failng.
So how do you know that the location you use to save your data won't be the faulty one?
Similarly, one common failure mechanism is in the addressing - so that when you address one location, another location (or locations) gets corrupted...
There's a frequently-cited paper by Michael Barr that discusses these failure mechanisms, and reliable ways to detect them...