Hi,
you can write short asm code in bootloader project which will be executed immediately after reset. It can check state of a pin to decide if bootloader or user application will be executed.
If bootloader is supposed to be executed, just continue in execution of bootloader. If user application is supposed to be executed, jump to entry point of application.
If bootloader downloads new firmware to flash and you want to run it now, there are two options:
1. Ensure that the state of pin is set accordingly and trigger software reset.
2. Jump directly to entry point of application without reset. In this case, it is necessary to disabled all interrupts and put all the modules to default reset state. Or the user application must be aware that it is possible that modules are not necessarily in reset state.
Regards,
Lukas