U9 is a 74HC00. When power is turned on U9A pin 1 and BOOT0 are low. Thus NRST is LOW. After a short time U9Ap1 goes high and NRST high. The processor starts from flash. Pressing S2 will produce new NRST low pulses, resetting into flash program again.
If pressing S1 the inputs to U9B goes high U)Ap2 low and NRST low. C31c will quickly charge BOOT0 to a high level. Release S1 and U9B pins will go low and NRST go high while BOT0 still is high, thererfore entering boot loader mode. After a short while BOOT0 will go low again, but that is after the rising edge og NRST and does not influence the boot mode.
R17, R24, R25 4k7
C25, C31 100n
Enjoy this project?