There are two most commonly used boot modes: One is boot to RAM, which jumps to the RAM at 0x000000 to start executing instructions, mainly for the simulation mode where the program is loaded in RAM; the other is boot to Flash, which jumps to 0x3F7FF6 to start executing code. Correspondingly, the program will put a jump instruction at these two entry addresses 0x000000 and 0x3F7FF6 in the codestart.asm source file. The reason is that there is only two units of space at the entry address of Flash, followed by the CSM module, so a jump is required; and the reason why a jump is also required in RAM is mainly because before jumping to main, a small piece of code _c_int00 needs to be executed. This code will use a section of RAM after 0x000003. If the code is placed there, the code will be damaged after executing _c_int00. In addition, there are some peripheral boot modes, such as SCI boot and SPI boot. For example, the C2PROG software we often use supports SCI boot, and then downloads the program through the serial port. How does the SelectBootMode function of the chip determine the boot mode of the chip? We can see that it first determines whether the chip is connected to the emulator, and determines it according to the state of the TRST pin. If the emulator is connected, it will enter the emulation boot (EmulaTIon Boot). At this time, the chip boot is mainly determined by two RAM units, namely EMU_BMODE and EMU_KEY, the addresses are 0xD01 and 0xD00, so after we connect the emulator, we can first modify these two EMU_BMODE and EMU_KEY to set the boot mode; If the emulator is not connected, it will enter the stand alone mode (stand alone). At this time, the chip boot is mainly determined by the status of GPIO34 and GPIO37, as well as the values of two OTP storage units. However, we often do not use these two OTP units, and the GPIO status is enough.