805bb886c0
* Boot: switch to DFU routines. Implements #132 part 1 of 2. * Boot: boot to DFU shortcut, hard reset USB on each boot. Implements #132 part 2 of 2. * Deploy scripts: fix path for deploy dfu. * Bootloader: initial version. Target_f2: rebase, update deployment scripts. * Bootloader: cleanup, refactor switch2 proc. Readme,wiki: document bootloader. * Wiki: deploy symlinks as files, bootloader info. * Target_f2: valid flash size in linker script. * Github CI: bootloader build and artifacts. * Bootloader: rename platforms to targets. * Bootloader: change dfu/os colors. * disable set -e * lint code * add bootloader testing page Co-authored-by: Aleksandr Kutuzov <aku@plooks.com> Co-authored-by: aanper <mail@s3f.ru>
20 lines
495 B
C
20 lines
495 B
C
#include "boot.h"
|
|
#include "stm32l4xx_ll_bus.h"
|
|
#include "stm32l4xx_ll_rcc.h"
|
|
#include "stm32l4xx_ll_rtc.h"
|
|
#include "stm32l4xx_ll_pwr.h"
|
|
|
|
#define BOOT_REQUEST_DFU 0xDF00B000
|
|
|
|
void boot_restart_in_dfu() {
|
|
// Request DFU on boot
|
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
|
|
LL_PWR_EnableBkUpAccess();
|
|
// Enable RTC
|
|
LL_RCC_EnableRTC();
|
|
// Write backup registry
|
|
LL_RTC_BAK_SetRegister(RTC, LL_RTC_BKP_DR0, BOOT_REQUEST_DFU);
|
|
// Reset
|
|
NVIC_SystemReset();
|
|
}
|