I want to copy code using bootloader fail safe, means if somehow UART communication stops while loading code using bootloader i can be able to upload code again after reset of controller.I want to copy code firstly in some different location of Flash than after my code upload successfully i will write it to the location where my existing code is running.so that no risk of losing code.In my existing scenario if communication during boot loading process stops, my controller stops working and i am not able to enter in boot mode.I this case i need to erase whole flash and than need to upload bootloader after that only i am able to proceed further. Please help or refer some helpful piece of code/example.I am using boot_serial example as bootloader.
I am entering to boot loader mode using UART Command in application.