When the ECU is turned on (or is recovering from a powered reset), the bootloader performs various tests. These include:
Tests on memory devices, looking for hard faults such as shorts on address lines, or memory locations which cannot hold their contents;
Tests on the code to run, looking for hard faults in the contents of code and data;
Tests on the frequency of reset, looking for unexpected resets which occur back to back in a short period of time.
If the tests fail then the bootloader will either reset or attempt to enter reprogramming mode, flashing a code to indicate the cause (see the technical specification for each ECU for details about code flashing). If the tests pass, then the bootloader will determine what mode to enter next (see Section 4.4.2, “Reprogramming mode” and Section 4.4.3, “Application mode” for details on how each mode is chosen).