From 87dad080e1f21710fb842ddadf15049c0cad5e11 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sun, 17 Mar 2013 10:17:05 +1300 Subject: [PATCH] Fix build for f4discovery host. --- src/platforms/f4discovery/Makefile.inc | 6 ++++-- src/platforms/f4discovery/platform.h | 2 +- src/platforms/stm32/dfu_f4.c | 1 + src/platforms/stm32/dfucore.c | 4 ---- src/platforms/stm32/usbdfu.h | 4 ++++ 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/platforms/f4discovery/Makefile.inc b/src/platforms/f4discovery/Makefile.inc index c7bfccb..5470d65 100644 --- a/src/platforms/f4discovery/Makefile.inc +++ b/src/platforms/f4discovery/Makefile.inc @@ -2,13 +2,15 @@ CROSS_COMPILE ?= arm-none-eabi- CC = $(CROSS_COMPILE)gcc OBJCOPY = $(CROSS_COMPILE)objcopy -CFLAGS += -Istm32/include -mcpu=cortex-m3 -mthumb \ +CFLAGS += -Istm32/include -mcpu=cortex-m4 -mthumb \ + -mfloat-abi=hard -mfpu=fpv4-sp-d16 \ -DSTM32F4 -DF4DISCOVERY -I../libopencm3/include \ -Iplatforms/stm32 LDFLAGS_BOOT = -lopencm3_stm32f4 -Wl,--defsym,_stack=0x20020000 \ -Wl,-T,platforms/stm32/f4discovery.ld -nostartfiles -lc -lnosys \ - -Wl,-Map=mapfile -mthumb -mcpu=cortex-m3 -Wl,-gc-sections \ + -Wl,-Map=mapfile -mthumb -mcpu=cortex-m4 -Wl,-gc-sections \ + -mfloat-abi=hard -mfpu=fpv4-sp-d16 \ -L../libopencm3/lib LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8010000 diff --git a/src/platforms/f4discovery/platform.h b/src/platforms/f4discovery/platform.h index 12ce8bf..a1deb48 100644 --- a/src/platforms/f4discovery/platform.h +++ b/src/platforms/f4discovery/platform.h @@ -38,7 +38,7 @@ #define BOARD_IDENT "Black Magic Probe (F4Discovery), (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")" #define BOARD_IDENT_DFU "Black Magic (Upgrade) for F4Discovery, (Firmware 1.5" VERSION_SUFFIX ", build " BUILDDATE ")" #define DFU_IDENT "Black Magic Firmware Upgrade (F4Discovery" -#define IFACE_STRING "@Internal Flash /0x08000000/1*016Ka,3*016Kg,1*064Kg,7*128Kg" +#define DFU_IFACE_STRING "@Internal Flash /0x08000000/1*016Ka,3*016Kg,1*064Kg,7*128Kg" extern usbd_device *usbdev; #define CDCACM_GDB_ENDPOINT 1 diff --git a/src/platforms/stm32/dfu_f4.c b/src/platforms/stm32/dfu_f4.c index 25c4a0f..4f47c99 100644 --- a/src/platforms/stm32/dfu_f4.c +++ b/src/platforms/stm32/dfu_f4.c @@ -22,6 +22,7 @@ #elif defined(STM32F4) # include #endif +#include #include "usbdfu.h" diff --git a/src/platforms/stm32/dfucore.c b/src/platforms/stm32/dfucore.c index 491a6f2..c1d5cfd 100644 --- a/src/platforms/stm32/dfucore.c +++ b/src/platforms/stm32/dfucore.c @@ -32,10 +32,6 @@ #include "usbdfu.h" -/* Commands sent with wBlockNum == 0 as per ST implementation. */ -#define CMD_SETADDR 0x21 -#define CMD_ERASE 0x41 - usbd_device *usbdev; /* We need a special large control buffer for this device: */ u8 usbd_control_buffer[1024]; diff --git a/src/platforms/stm32/usbdfu.h b/src/platforms/stm32/usbdfu.h index 7472d7c..d331ca4 100644 --- a/src/platforms/stm32/usbdfu.h +++ b/src/platforms/stm32/usbdfu.h @@ -25,6 +25,10 @@ # define APP_ADDRESS 0x08002000 #endif +/* Commands sent with wBlockNum == 0 as per ST implementation. */ +#define CMD_SETADDR 0x21 +#define CMD_ERASE 0x41 + /* dfucore.c - DFU core, common to libopencm3 platforms. */ void dfu_init(const usbd_driver *driver); void dfu_main(void);