The ota_upgrade application is designed to run from RAM as the STM32 microprocessor cannot execute from flash while it is being reprogrammed.
I would recommend modifying your application to accept the reception of a new firmware image that is written to external flash. Once the entire image is downloaded and verified you can do a soft reset and utilize the bootloader to load a small reflash app into RAM that will reprogram the STM32 flash with the image in external memory.
The ota_upgrade application is an example of doing a download and reprogram from a single application running from RAM however we recommend utilizing external flash for temporary storage.
Thanks I will look at his, but I don't really understand how to launch the ota_upgrade program in RAM ? I managed to compile it but then how to upload it and launch it ?