Format code according to conventions (#15593)
This commit is contained in:
parent
1127e0da6b
commit
be2265d0d1
15 changed files with 37 additions and 46 deletions
|
@ -40,7 +40,8 @@ void bootloader_jump(void) {
|
|||
*MAGIC_ADDR = BOOTLOADER_MAGIC; // Set magic number into RAM
|
||||
NVIC_SystemReset(); // Perform system reset
|
||||
|
||||
while (1); // Won't get here
|
||||
while (1)
|
||||
; // Won't get here
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,17 +51,22 @@ void bootloader_jump(void) {
|
|||
void bootloader_jump(void) {
|
||||
WDT->CTRLA.bit.ENABLE = 0;
|
||||
|
||||
while (WDT->SYNCBUSY.bit.ENABLE);
|
||||
while (WDT->CTRLA.bit.ENABLE);
|
||||
while (WDT->SYNCBUSY.bit.ENABLE)
|
||||
;
|
||||
while (WDT->CTRLA.bit.ENABLE)
|
||||
;
|
||||
|
||||
WDT->CONFIG.bit.WINDOW = 0;
|
||||
WDT->CONFIG.bit.PER = 0;
|
||||
WDT->EWCTRL.bit.EWOFFSET = 0;
|
||||
WDT->CTRLA.bit.ENABLE = 1;
|
||||
|
||||
while (WDT->SYNCBUSY.bit.ENABLE);
|
||||
while (!WDT->CTRLA.bit.ENABLE);
|
||||
while (WDT->SYNCBUSY.bit.ENABLE)
|
||||
;
|
||||
while (!WDT->CTRLA.bit.ENABLE)
|
||||
;
|
||||
|
||||
while (1); // Wait on timeout
|
||||
while (1)
|
||||
; // Wait on timeout
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
#include <avr/eeprom.h>
|
||||
#include <avr/wdt.h>
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
// force bootloadHID to stay in bootloader mode, so that it waits
|
||||
// for a new firmware to be flashed
|
||||
// NOTE: this byte is part of QMK's "magic number" - changing it causes the EEPROM to be re-initialized
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
#include <avr/wdt.h>
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
// this block may be optional
|
||||
// TODO: figure it out
|
||||
|
||||
|
@ -35,5 +34,6 @@ void bootloader_jump(void) {
|
|||
wdt_enable(WDTO_60MS);
|
||||
|
||||
// wait for watchdog timer to trigger
|
||||
while (1) { }
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
#define BOOTLOADER_RESET_KEY 0xB007B007
|
||||
uint32_t reset_key __attribute__((section(".noinit,\"aw\",@nobits;")));
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
UDCON = 1;
|
||||
USBCON = (1 << FRZCLK); // disable USB
|
||||
UCSR1B = 0;
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
// http://www.pjrc.com/teensy/jump_to_bootloader.html
|
||||
|
||||
cli();
|
||||
|
|
|
@ -16,5 +16,4 @@
|
|||
|
||||
#include "bootloader.h"
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) { }
|
||||
__attribute__((weak)) void bootloader_jump(void) {}
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
// Taken with permission of Stephan Baerwolf from https://github.com/tinyusbboard/API/blob/master/apipage.c
|
||||
|
||||
wdt_enable(WDTO_15MS);
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
__IO uint32_t *DBGMCU_KEY = (uint32_t *)DBGMCU_BASE + 0x0CU;
|
||||
__IO uint32_t *DBGMCU_CMD = (uint32_t *)DBGMCU_BASE + 0x08U;
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
/* The MTIMER unit of the GD32VF103 doesn't have the MSFRST
|
||||
* register to generate a software reset request.
|
||||
* BUT instead two undocumented registers in the debug peripheral
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
#include <ch.h>
|
||||
#include "wait.h"
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
wait_ms(100);
|
||||
__BKPT(0);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
void *volatile vbat = (void *)VBAT;
|
||||
__builtin_memcpy(vbat, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic));
|
||||
|
||||
|
|
|
@ -16,5 +16,4 @@
|
|||
|
||||
#include "bootloader.h"
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) { }
|
||||
__attribute__((weak)) void bootloader_jump(void) {}
|
||||
|
|
|
@ -41,8 +41,7 @@ extern uint32_t __ram0_end__;
|
|||
# define STM32_BOOTLOADER_DUAL_BANK_DELAY 100000
|
||||
# endif
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
// For STM32 MCUs with dual-bank flash, and we're incapable of jumping to the bootloader. The first valid flash
|
||||
// bank is executed unconditionally after a reset, so it doesn't enter DFU unless BOOT0 is high. Instead, we do
|
||||
// it with hardware...in this case, we pull a GPIO high/low depending on the configuration, connects 3.3V to
|
||||
|
@ -72,8 +71,7 @@ void enter_bootloader_mode_if_requested(void) { }
|
|||
# define BOOTLOADER_MAGIC 0xDEADBEEF
|
||||
# define MAGIC_ADDR (unsigned long *)(SYMVAL(__ram0_end__) - 4)
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
*MAGIC_ADDR = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,4 @@
|
|||
|
||||
#include <ch.h>
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
__attribute__((weak)) void bootloader_jump(void) { NVIC_SystemReset(); }
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
extern uint32_t _board_dfu_dbl_tap[];
|
||||
#define DBL_TAP_REG _board_dfu_dbl_tap[0]
|
||||
|
||||
__attribute__((weak))
|
||||
void bootloader_jump(void) {
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
DBL_TAP_REG = DBL_TAP_MAGIC;
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue