Upgrade user application using custom bootloader via UART (STM32)
You want to write your own bootloader but you cite the app note for the built in one. Forget this one. 

Write the bootloader and read only the Reference Manual. Forget the built in bootlader and its "commands"