25 #include <libopencm3/cm3/scb.h> 26 #include <libopencm3/stm32/rcc.h> 27 #include <libopencm3/stm32/gpio.h> 38 bool dfu_force =
false;
40 if (0==(RCC_CSR&0xfc000000)) {
44 #if (GPIO(B)==GPIO(DFU_FORCE_PORT)) && (GPIO(4)==GPIO(DFU_FORCE_PIN)) 45 gpio_primary_remap(AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST, 0);
46 #elif ((GPIO(B)==GPIO(DFU_FORCE_PORT)) && (GPIO(3)==GPIO(DFU_FORCE_PIN))) || ((GPIO(A)==GPIO(DFU_FORCE_PORT)) && (GPIO(15)==GPIO(DFU_FORCE_PIN))) 47 gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, 0);
48 #elif ((GPIO(A)==GPIO(DFU_FORCE_PORT)) && (GPIO(14)==GPIO(DFU_FORCE_PIN))) || ((GPIO(A)==GPIO(DFU_FORCE_PORT)) && (GPIO(13)==GPIO(DFU_FORCE_PIN))) 49 gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_OFF, 0);
54 #if (DFU_FORCE_VALUE==1) 75 if (!dfu_force && (((*application)&0xFFFE0000)==0x20000000)) {
76 SCB_VTOR = (
volatile uint32_t)(application);
77 __asm__
volatile (
"MSR msp,%0" : :
"r"(*application));
78 (*(void(**)(void))(application + 1))();
81 rcc_clock_setup_in_hse_8mhz_out_72mhz();
83 #if defined(BUSVOODOO) void board_setup(void)
setup board peripherals
void main(void)
bootloader entry point
#define RCC_GPIO(x)
get RCC for GPIO based on GPIO identifier
global definitions and methods (API)
#define GPIO(x)
get GPIO based on GPIO identifier
void usb_dfu_start(void)
start USB DFU handling
void usb_dfu_setup(void)
setup USB DFU peripheral
library for USB DFU to write on internal flash (API)
uint32_t __application_beginning
symbol for beginning of the application
void led_on(void)
switch on board LED