From: https://community.st.com/t5/others-hardware-and-software/how-to-write-boot-loader/td-p/494349
This bootloader receives data until NUMBYTES is reached. NUMBYTES obviously needs to be replaced by the program that injects the bootloader based on the actual program size.
The program that is received could be another program that implements an actual transmission protocol with error recovery to finally receive the actual firmware that needs to be run on the ST10X CPU. Just like what the ST10Flasher tool does.