From d85a39955979e3c59c3cc45146f3fe77519045e9 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sun, 30 Oct 2011 13:39:19 +1300 Subject: [PATCH] Updated to build with new libopenstm32 with f1/f2 split. --- src/stm32/Makefile.inc | 6 +++--- src/stm32/blackmagic.ld | 2 +- src/stm32/cdcacm.c | 8 +++++--- src/stm32/jtagtap.c | 2 +- src/stm32/platform.c | 8 ++++---- src/stm32/platform.h | 2 +- src/stm32/swdptap.c | 2 +- src/stm32/usbdfu.c | 8 ++++---- 8 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/stm32/Makefile.inc b/src/stm32/Makefile.inc index 1c38847..f3994e4 100644 --- a/src/stm32/Makefile.inc +++ b/src/stm32/Makefile.inc @@ -1,9 +1,9 @@ -CROSS_COMPILE ?= arm-cortexm3-eabi- +CROSS_COMPILE ?= arm-none-eabi- CC = $(CROSS_COMPILE)gcc OBJCOPY = $(CROSS_COMPILE)objcopy -CFLAGS += -Istm32/include -mcpu=cortex-m3 -mthumb -msoft-float -LDFLAGS_BOOT = -lopencm3_stm32 -Wl,--defsym,_stack=0x20005000 \ +CFLAGS += -Istm32/include -mcpu=cortex-m3 -mthumb -msoft-float -DSTM32F1 +LDFLAGS_BOOT = -lopencm3_stm32f1 -Wl,--defsym,_stack=0x20005000 \ -Wl,-T,stm32/blackmagic.ld -nostartfiles -lc -lnosys -Wl,-Map=mapfile \ -mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000 diff --git a/src/stm32/blackmagic.ld b/src/stm32/blackmagic.ld index 52314c5..9755309 100644 --- a/src/stm32/blackmagic.ld +++ b/src/stm32/blackmagic.ld @@ -25,5 +25,5 @@ MEMORY } /* Include the common ld script from libopenstm32. */ -INCLUDE libopencm3_stm32.ld +INCLUDE libopencm3_stm32f1.ld diff --git a/src/stm32/cdcacm.c b/src/stm32/cdcacm.c index 9cbd44b..3c9cc56 100644 --- a/src/stm32/cdcacm.c +++ b/src/stm32/cdcacm.c @@ -26,11 +26,12 @@ * The device's unique id is used as the USB serial number string. */ +#include #include -#include +#include #include #include -#include +#include #include #include #include @@ -359,7 +360,8 @@ static int cdcacm_control_request(struct usb_setup_data *req, uint8_t **buf, return 0; struct usb_cdc_line_coding *coding = (void*)*buf; - usart_set_baudrate(USART1, coding->dwDTERate); + usart_set_baudrate(USART1, coding->dwDTERate, + rcc_ppre2_frequency); usart_set_databits(USART1, coding->bDataBits); switch(coding->bCharFormat) { case 0: diff --git a/src/stm32/jtagtap.c b/src/stm32/jtagtap.c index fa924d0..ee00eef 100644 --- a/src/stm32/jtagtap.c +++ b/src/stm32/jtagtap.c @@ -20,7 +20,7 @@ /* This file implements the low-level JTAG TAP interface. */ -#include +#include #include #include "general.h" diff --git a/src/stm32/platform.c b/src/stm32/platform.c index 71458b1..561498a 100644 --- a/src/stm32/platform.c +++ b/src/stm32/platform.c @@ -22,10 +22,10 @@ * implementation. */ -#include -#include +#include +#include #include -#include +#include #include #include @@ -201,7 +201,7 @@ void uart_init(void) GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO9); /* Setup UART parameters. */ - usart_set_baudrate(USART1, 38400); + usart_set_baudrate(USART1, 38400, rcc_ppre2_frequency); usart_set_databits(USART1, 8); usart_set_stopbits(USART1, USART_STOPBITS_1); usart_set_mode(USART1, USART_MODE_TX_RX); diff --git a/src/stm32/platform.h b/src/stm32/platform.h index 2925ae8..2b0f0ea 100644 --- a/src/stm32/platform.h +++ b/src/stm32/platform.h @@ -24,7 +24,7 @@ #ifndef __PLATFORM_H #define __PLATFORM_H -#include +#include #include #include diff --git a/src/stm32/swdptap.c b/src/stm32/swdptap.c index e6799eb..36f3448 100644 --- a/src/stm32/swdptap.c +++ b/src/stm32/swdptap.c @@ -20,7 +20,7 @@ /* This file implements the low-level SW-DP interface. */ -#include +#include #include #include "general.h" diff --git a/src/stm32/usbdfu.c b/src/stm32/usbdfu.c index a6194ee..535ce99 100644 --- a/src/stm32/usbdfu.c +++ b/src/stm32/usbdfu.c @@ -19,10 +19,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include