You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use atsamd_hal::pac::SCB;/// RAM size (32 kB for ATSAMD21E18A)constHMCRAMC0_SIZE:u32 = 0x00008000;/// RAM base addressconstHMCRAMC0_ADDR:u32 = 0x20000000;/// Writing this value into `BOOTLOADER_DBL_TAP_PTR` and resetting will/// cause the bootloader to 'stick'constBOOTLOADER_DBL_TAP_MAGIC:u32 = 0xF01669EF;/// Writing this value into `BOOTLOADER_DBL_TAP_PTR` and resetting will/// cause the bootloader pass right through to the appconstBOOTLOADER_DBL_TAP_MAGIC_QUICK_BOOT:u32 = 0xF02669EF;/// Bootloader magic values need to be written hereconstBOOTLOADER_DBL_TAP_PTR:*mutu32 = (HMCRAMC0_ADDR + HMCRAMC0_SIZE - 4)as*mut_;/// Reset into the bootloader, and stay there in order to flash a new/// firmware image.#[inline]pubfnreset() -> ! {unsafe{
core::ptr::write_volatile(BOOTLOADER_DBL_TAP_PTR,BOOTLOADER_DBL_TAP_MAGIC);}SCB::sys_reset();}