From 0730740add19d3afe3d96ead50ba7d29e5dcb109 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 15 Jan 2023 15:04:32 +0000 Subject: Add mmoskal/uf2-stm32f103 bootloader support (#19594) --- platforms/chibios/bootloaders/uf2boot.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 platforms/chibios/bootloaders/uf2boot.c (limited to 'platforms/chibios/bootloaders') diff --git a/platforms/chibios/bootloaders/uf2boot.c b/platforms/chibios/bootloaders/uf2boot.c new file mode 100644 index 0000000000..f5b1a64334 --- /dev/null +++ b/platforms/chibios/bootloaders/uf2boot.c @@ -0,0 +1,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) {} -- cgit v1.2.3