So, you want it to STAY in the bootloader rather than running the currently-loaded application? Is erasing the current application an option? If so, you could do so in your code, then call this function:
- Code: Select all | TOGGLE FULL SIZE
*******************************************************************************************************************************************************************************************/
void reboot(void) {
//*DBL_TAP_PTR = DBL_TAP_MAGIC;
//SCB->AIRCR = (0x5FA << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk; // force reboot (I had to modify this as shown below for M4)
__DSB(); // Ensure all outstanding memory accesses included
// buffered write are completed before reset
SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
SCB_AIRCR_SYSRESETREQ_Msk); // Keep priority group unchanged
__DSB(); // Ensure completion of memory access
while(1); // wait until reset
} // reboot
If you don't want to erase your app, uncommenting this line may get you the effect you want:
- Code: Select all | TOGGLE FULL SIZE
//*DBL_TAP_PTR = DBL_TAP_MAGIC;
It's been over a year since I modified the bootloader, so you'll have to look at it to verify my recollection.