Writing bootloader for STM32 by C language in Keil
A bootloader is no different from a normal program. You will need to think of the following things first:


What do I want my bootloader to do?
Since it usually takes care of upgrading software, where do I get the new application image from?
Do I want to be able to communicate with the bootloader via UART/USB/?
How do I make sure that a valid program is loaded at the specific memory address?
How do I make sure that I am always able to enter the bootloader somehow?


There is no single "bootloader" - it depends on your requirements.