I declare my variable volatile and set optimization to none and it seems the compiler is still ditching code it does not think is useful. Out of frustration I output a debug variable to a GPIO pin just so it would persist. Is there no other way? Seems it would leave stuff alone if it a debug build instead of release.