From f345cd24dc2bf57ee4386ae506c876374ae4e9bd Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Mon, 25 Sep 2017 10:04:05 +1300 Subject: [PATCH 1/2] Update libopencm3 pointer --- libopencm3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libopencm3 b/libopencm3 index 67242de..db7a8d7 160000 --- a/libopencm3 +++ b/libopencm3 @@ -1 +1 @@ -Subproject commit 67242de60dec0227739cd549e8a78e1a3c15dbf5 +Subproject commit db7a8d71ca30dd9ce7947aa036897b910bdc4ad2 From 0ed66547d53afd08edf35a53f60a6162fac201ce Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Mon, 25 Sep 2017 10:27:29 +1300 Subject: [PATCH 2/2] Fix libopencm3 breakage --- src/platforms/f4discovery/platform.c | 2 +- src/platforms/hydrabus/platform.c | 3 +-- src/platforms/native/platform.c | 4 ++-- src/platforms/native/platform.h | 2 +- src/platforms/native/usbdfu.c | 2 +- src/platforms/stlink/dfu_upgrade.c | 2 +- src/platforms/stlink/platform.h | 2 +- src/platforms/stlink/stlink_common.c | 2 +- src/platforms/stlink/usbdfu.c | 2 +- src/platforms/stm32/traceswo.c | 2 +- src/platforms/stm32/usbuart.c | 2 +- src/platforms/swlink/platform.h | 2 +- src/platforms/swlink/usbdfu.c | 2 +- 13 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/platforms/f4discovery/platform.c b/src/platforms/f4discovery/platform.c index bc781e2..8e3b9d3 100644 --- a/src/platforms/f4discovery/platform.c +++ b/src/platforms/f4discovery/platform.c @@ -62,7 +62,7 @@ void platform_init(void) scb_reset_core(); } - rcc_clock_setup_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_48MHZ]); + rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_48MHZ]); /* Enable peripherals */ rcc_periph_clock_enable(RCC_OTGFS); diff --git a/src/platforms/hydrabus/platform.c b/src/platforms/hydrabus/platform.c index 3993a10..c6a60c2 100644 --- a/src/platforms/hydrabus/platform.c +++ b/src/platforms/hydrabus/platform.c @@ -46,7 +46,7 @@ void platform_init(void) scb_reset_core(); } - rcc_clock_setup_hse_3v3(&hse_8mhz_3v3[CLOCK_3V3_48MHZ]); + rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_48MHZ]); /* Enable peripherals */ rcc_peripheral_enable_clock(&RCC_AHB2ENR, RCC_AHB2ENR_OTGFSEN); @@ -103,4 +103,3 @@ void platform_request_boot(void) SYSCFG_MEMRM &= ~3; SYSCFG_MEMRM |= 1; } - diff --git a/src/platforms/native/platform.c b/src/platforms/native/platform.c index 1804e17..c69eea3 100644 --- a/src/platforms/native/platform.c +++ b/src/platforms/native/platform.c @@ -222,7 +222,7 @@ static void adc_init(void) gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, GPIO0); - adc_off(ADC1); + adc_power_off(ADC1); adc_disable_scan_mode(ADC1); adc_set_single_conversion_mode(ADC1); adc_disable_external_trigger_regular(ADC1); @@ -236,7 +236,7 @@ static void adc_init(void) __asm__("nop"); adc_reset_calibration(ADC1); - adc_calibration(ADC1); + adc_calibrate(ADC1); } const char *platform_target_voltage(void) diff --git a/src/platforms/native/platform.h b/src/platforms/native/platform.h index c18a8c8..a261cbc 100644 --- a/src/platforms/native/platform.h +++ b/src/platforms/native/platform.h @@ -128,7 +128,7 @@ GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN); \ } while(0) -#define USB_DRIVER stm32f103_usb_driver +#define USB_DRIVER st_usbfs_v1_usb_driver #define USB_IRQ NVIC_USB_LP_CAN_RX0_IRQ #define USB_ISR usb_lp_can_rx0_isr /* Interrupt priorities. Low numbers are high priority. diff --git a/src/platforms/native/usbdfu.c b/src/platforms/native/usbdfu.c index e370cf9..020a976 100644 --- a/src/platforms/native/usbdfu.c +++ b/src/platforms/native/usbdfu.c @@ -60,7 +60,7 @@ int main(void) gpio_set_mode(LED_PORT, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, LED_0 | LED_1 | LED_2); - dfu_init(&stm32f103_usb_driver, DFU_MODE); + dfu_init(&st_usbfs_v1_usb_driver, DFU_MODE); /* Configure the USB pull up pin. */ gpio_set(GPIOA, GPIO8); diff --git a/src/platforms/stlink/dfu_upgrade.c b/src/platforms/stlink/dfu_upgrade.c index 804144a..aeb559d 100644 --- a/src/platforms/stlink/dfu_upgrade.c +++ b/src/platforms/stlink/dfu_upgrade.c @@ -58,7 +58,7 @@ int main(void) if (rev > 1) /* Reconnect USB */ gpio_set(GPIOA, GPIO15); - dfu_init(&stm32f103_usb_driver, UPD_MODE); + dfu_init(&st_usbfs_v1_usb_driver, UPD_MODE); dfu_main(); } diff --git a/src/platforms/stlink/platform.h b/src/platforms/stlink/platform.h index f531444..5cb29cc 100644 --- a/src/platforms/stlink/platform.h +++ b/src/platforms/stlink/platform.h @@ -82,7 +82,7 @@ gpio_set_mode(USBUSART_PORT, GPIO_MODE_OUTPUT_2_MHZ, \ GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN); -#define USB_DRIVER stm32f103_usb_driver +#define USB_DRIVER st_usbfs_v1_usb_driver #define USB_IRQ NVIC_USB_LP_CAN_RX0_IRQ #define USB_ISR usb_lp_can_rx0_isr /* Interrupt priorities. Low numbers are high priority. diff --git a/src/platforms/stlink/stlink_common.c b/src/platforms/stlink/stlink_common.c index 487563d..b23a345 100644 --- a/src/platforms/stlink/stlink_common.c +++ b/src/platforms/stlink/stlink_common.c @@ -75,7 +75,7 @@ uint32_t detect_rev(void) rev = 1; /* On Rev > 0 unconditionally activate MCO on PORTA8 with HSE! */ RCC_CFGR &= ~(0xf << 24); - RCC_CFGR |= (RCC_CFGR_MCO_HSECLK << 24); + RCC_CFGR |= (RCC_CFGR_MCO_HSE << 24); gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO8); } diff --git a/src/platforms/stlink/usbdfu.c b/src/platforms/stlink/usbdfu.c index fca3bf6..d016075 100644 --- a/src/platforms/stlink/usbdfu.c +++ b/src/platforms/stlink/usbdfu.c @@ -75,7 +75,7 @@ int main(void) if (rev > 1) gpio_set(GPIOA, GPIO15); - dfu_init(&stm32f103_usb_driver, DFU_MODE); + dfu_init(&st_usbfs_v1_usb_driver, DFU_MODE); dfu_main(); } diff --git a/src/platforms/stm32/traceswo.c b/src/platforms/stm32/traceswo.c index a2e704d..5007378 100644 --- a/src/platforms/stm32/traceswo.c +++ b/src/platforms/stm32/traceswo.c @@ -59,7 +59,7 @@ void traceswo_init(void) timer_ic_set_polarity(TRACE_TIM, TIM_IC2, TIM_IC_FALLING); /* Trigger on Filtered Timer Input 1 (TI1FP1) */ - timer_slave_set_trigger(TRACE_TIM, TIM_SMCR_TS_IT1FP1); + timer_slave_set_trigger(TRACE_TIM, TIM_SMCR_TS_TI1FP1); /* Slave reset mode: reset counter on trigger */ timer_slave_set_mode(TRACE_TIM, TIM_SMCR_SMS_RM); diff --git a/src/platforms/stm32/usbuart.c b/src/platforms/stm32/usbuart.c index a4a772e..0d1772a 100644 --- a/src/platforms/stm32/usbuart.c +++ b/src/platforms/stm32/usbuart.c @@ -72,7 +72,7 @@ void usbuart_init(void) timer_set_mode(USBUSART_TIM, TIM_CR1_CKD_CK_INT, TIM_CR1_CMS_EDGE, TIM_CR1_DIR_UP); timer_set_prescaler(USBUSART_TIM, - rcc_ppre2_frequency / USBUART_TIMER_FREQ_HZ * 2 - 1); + rcc_apb2_frequency / USBUART_TIMER_FREQ_HZ * 2 - 1); timer_set_period(USBUSART_TIM, USBUART_TIMER_FREQ_HZ / USBUART_RUN_FREQ_HZ - 1); diff --git a/src/platforms/swlink/platform.h b/src/platforms/swlink/platform.h index 8c2be74..748c31f 100644 --- a/src/platforms/swlink/platform.h +++ b/src/platforms/swlink/platform.h @@ -74,7 +74,7 @@ GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN); \ } while (0) -#define USB_DRIVER stm32f103_usb_driver +#define USB_DRIVER st_usbfs_v1_usb_driver #define USB_IRQ NVIC_USB_LP_CAN_RX0_IRQ #define USB_ISR usb_lp_can_rx0_isr /* Interrupt priorities. Low numbers are high priority. diff --git a/src/platforms/swlink/usbdfu.c b/src/platforms/swlink/usbdfu.c index f716653..daf73f3 100644 --- a/src/platforms/swlink/usbdfu.c +++ b/src/platforms/swlink/usbdfu.c @@ -83,7 +83,7 @@ int main(void) systick_interrupt_enable(); systick_counter_enable(); - dfu_init(&stm32f103_usb_driver, DFU_MODE); + dfu_init(&st_usbfs_v1_usb_driver, DFU_MODE); dfu_main(); }