summaryrefslogtreecommitdiff
path: root/platforms/chibios/bootloaders/uf2boot.c
blob: f5b1a64334cf724c0dd73b9b302d99e1cb2362d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later

#include "bootloader.h"

// From mmoskal/uf2-stm32f103's backup.c
#define MAGIC_BOOT 0x544F4F42UL

// defined by linker script
extern uint32_t _board_magic_reg[];
#define MAGIC_REG _board_magic_reg[0]

void bootloader_jump(void) {
    MAGIC_REG = MAGIC_BOOT;
    NVIC_SystemReset();
}

void mcu_reset(void) {
    NVIC_SystemReset();
}

/* not needed, no two-stage reset */
void enter_bootloader_mode_if_requested(void) {}