Why is execution on the microcontroller so important?
Embedded firmware is usually developed on a desktop PC. Code that is not directly dependent on hardware can be compiled with a standard desktop compiler and executed on the development computer (off-target). This approach is often selected, in order to avoid long compile-flash-debug loops on the microcontroller.
However, it should be noted that the code tested by means of this method may demonstrate different behavior when executed on the real target system (on-target). In the best case, an error may already be detected when compiling with the cross-compiler. If you are less lucky, the compiled code will behave differently in terms of details. Code that was “verified” in the off-target procedure is suddenly no longer correct.