Is there a way for a program to know if it's executed under the simulator and not on an actual CPU?
In Cortex-M3
if(CoreDebug->DHCSR & 1) { // Debugging with ULIK or similar ! } else { // No debugging tool }