I'm relatively new to STM32 series of SOCs and there seem to be pleothra of information on Bootloader and Device Firmware update. These are perhaps the two major reason, why I do not have a clear picture of DFU of STM32 (In my case STM32F072R8). My queries are:
1: Does ST Microelectronics releases some bootloader code with the appropriate memory layout (I assume that bootloader and the application firmware(s) will sit in the different flash memory region) that I can compile, build and flash using usual programming tools (KEIL uVision5, ST Link Debugger) ?
2: In the libraries package (STM32SnippetsF0) for STM32F0xxxx, I found one sample program that describes the method to program the STM32F0xx internal flash memory, which could be a starting point for writing a custom bootloader, but this is not complete, since this sample code (Flash_program) does not have logic to switch back and forth from Application firmware code or handling corrupted firmware download. For my application needs, I'm thinking of a trigger mechanism, that will boot STM into bootloader mode, where the Bootloader will download the new firmware over USART (Bootloader should be able to access peripherals and recieve application firmware binary over USARTx) and flash the internal user flash and switch to the new firmware, in case the new firmware flashing completes with success. Are there similar application guide and/or sample code?