6.2. Startup procedure
Every time the microcontroller powers on or is reset for any reason, the bootloader’s startup code runs. First, the code sets all of the bytes in RAM to 0, which can help make the behavior of the bootloader and the application more predictable. Second, it reads the first word of the application’s flash section. If that word is 0xFFFF, it considers the application to be missing and it runs the bootloader. Third, it reads pin RB6 and runs the bootloader if RB6 is high. Finally, if none of these tests have caused it to go into bootloader mode, it runs the application.
Going through this startup procedure is the only way that the application can run.
The startup logic for the P-Star USB bootloader.