use right DBL_TAP_REG when resetting to bootloader

This helps my development scripts work better, and probably also fixes
a problem switching from the circuitpython environment back to arduino.
(specifically, the "1200 baud" serial trick was not rebooting into
the bootloader but was just resetting)
This commit is contained in:
Jeff Epler 2023-03-03 10:05:28 -06:00
parent 8a8579a9b9
commit b2a08e2cce
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
3 changed files with 2 additions and 3 deletions

View File

@ -39,8 +39,6 @@
#include "supervisor/shared/safe_mode.h"
#include "supervisor/shared/translate/translate.h"
#define DBL_TAP_REG SNVS->LPGPR[3]
void common_hal_mcu_delay_us(uint32_t delay) {
mp_hal_delay_us(delay);
}

View File

@ -33,6 +33,7 @@
#include "py/mpconfig.h"
// Copied from inc/uf2.h in https://github.com/Microsoft/uf2-samd21
#define DBL_TAP_REG SNVS->LPGPR[3]
#define DBL_TAP_MAGIC 0xf01669ef // Randomly selected, adjusted to have first and last bit set
#define DBL_TAP_MAGIC_QUICK_BOOT 0xf02669ef

View File

@ -301,7 +301,7 @@ void reset_port(void) {
}
void reset_to_bootloader(void) {
SNVS->LPGPR[0] = DBL_TAP_MAGIC;
DBL_TAP_REG = DBL_TAP_MAGIC;
reset();
}