Newbie question:
Have generated a .BIN file using two user commands: elfdwt .\Debug\Target.axf fromelf --bin -o .\Output\Target.bin .\Output\Target.axf
Resulting .BIN file has size of 11,848 bytes.
Is it possible to divide these 11,848 by 4,096 (size of one flash sector) and use 'Copy RAM to Flash' three times to overwrite sector 0, 1 and 2 of program flash?
Of course, code doing this is located in f.e. sector 7 (or RAM).
Best regards, Juergen
First of, you don't want to "jump" to your reset vector. Use a watchdog reset to start anew, otherwise there is no guarantee that the processor's internal state will be consistent.
So the question: Am I always able to get the (development) target run again via its USB bootloader mechanism, in case my IAP goes wrong?
You should implement a CRC check before starting to program. Consider maintaining a backup of the firmware software in a non-volatile memory section in case of trouble. You can split your bootloader in two: a permanent one that restores the main bootloader (USB enabled, can program itself and firmware) and the firmware itself or jumps to the firmware's entry point if the system is ready to startup.