Does anyone know how to make the compiler not overlay unused subroutine parameter locations with local variables? It's obvious to just set it to something after the point in which you want to look at it. But, optimization 0, doesn't prevent it.
Define and declare your functions with the reentrant attribute.
"make the compiler not overlay unused subroutine parameter locations with local variables" Why? If they're not used, what does it matter? What exactly do you mean by "unused parameter locations" anyway? Have you looked at the NOOVERLAY option?
The best way to avoid that is to avoid having any unused parameters in the first place. Or if you have to have them, say, because there's some externally forced API spec to work with, avoid looking at things that have no useful meaning.
I have unused parameters for a very specific reason. I am commanding a chip to perform a function, which fails every once and a while. When a failed condition occurs in my routine, I would like to view on which command the chip failed. Otherwise, the command variable is not used in the routine. This is strictly for debugging the routine. However, since it is unused, it gets corrupted by local variables by the compiler. The easy answer is to always assign the variable to some bogus value as the last statement in the routine. That way the compiler things you are using it. I just wanted to know if there was any way of not having to do that.
Flagging it "volatile" should have the desired effect.
Couldn't you just make it the return value? 'C' is perfectly happy with not using return values.
Andy already suggested the NOOVERLAY directive. That will do what you want. Jon