REVONANO Milestones update
[librepilot.git] / flight / pios / stm32f4xx / library.mk
blob7094a2b3f4b6ce2272688e908dcd450b193a1997
2 # Rules to (help) build the F4xx device support.
5 # Directory containing this makefile
6 PIOS_DEVLIB := $(dir $(lastword $(MAKEFILE_LIST)))
8 # Hardcoded linker script names for now
9 LINKER_SCRIPTS_APP = $(PIOS_DEVLIB)link_$(BOARD)_fw_memory.ld \
10 $(PIOS_DEVLIB)link_$(BOARD)_sections.ld
11 LINKER_SCRIPTS_BL = $(PIOS_DEVLIB)link_$(BOARD)_bl_memory.ld \
12 $(PIOS_DEVLIB)link_$(BOARD)_sections.ld
13 # _compat linker script are aimed at bootloader updater to guarantee to be compatible with earlier bootloaders.
14 LINKER_SCRIPTS_COMPAT = $(PIOS_DEVLIB)link_$(BOARD)_fw_memory.ld \
15 $(PIOS_DEVLIB)link_$(BOARD)_sections_compat.ld
17 # Compiler options implied by the F4xx
18 CDEFS += -DSTM32F4XX
19 ifneq ($(CHIPFAMILY),STM32F411xx)
20 CDEFS += -DPIOS_TARGET_PROVIDES_FAST_HEAP
21 CDEFS += -DSTM32F40_41xxx
22 else
23 CDEFS += -DSTM32F411xE
24 endif
25 CDEFS += -DSYSCLK_FREQ=$(SYSCLK_FREQ)
26 CDEFS += -DHSE_VALUE=$(OSCILLATOR_FREQ)
27 CDEFS += -DUSE_STDPERIPH_DRIVER
28 CDEFS += -DARM_MATH_CM4 -D__FPU_PRESENT=1
30 ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
32 # PIOS device library source and includes
33 SRC += $(sort $(wildcard $(PIOS_DEVLIB)*.c))
34 EXTRAINCDIRS += $(PIOS_DEVLIB)inc
36 # CMSIS for the F4
37 include $(PIOSCOMMON)/libraries/CMSIS/library.mk
38 CMSIS_DEVICEDIR := $(PIOS_DEVLIB)libraries/CMSIS/Device/ST/STM32F4xx
39 SRC += $(sort $(wildcard $(CMSIS_DEVICEDIR)/Source/$(BOARD_NAME)/*.c))
40 EXTRAINCDIRS += $(CMSIS_DEVICEDIR)/Include
42 # ST Peripheral library
43 PERIPHLIB = $(PIOS_DEVLIB)libraries/STM32F4xx_StdPeriph_Driver
45 ALL_SPL_SOURCES = $(sort $(wildcard $(PERIPHLIB)/src/*.c))
46 SPL_SOURCES = $(filter-out %stm32f4xx_fmc.c %stm32f4xx_sai.c %stm32f4xx_fsmc.c, $(ALL_SPL_SOURCES))
47 SRC += $(SPL_SOURCES)
49 EXTRAINCDIRS += $(PERIPHLIB)/inc
51 # ST USB OTG library
52 USBOTGLIB = $(PIOS_DEVLIB)/libraries/STM32_USB_OTG_Driver
53 USBOTGLIB_SRC = usb_core.c usb_dcd.c usb_dcd_int.c
54 SRC += $(addprefix $(USBOTGLIB)/src/,$(USBOTGLIB_SRC))
55 EXTRAINCDIRS += $(USBOTGLIB)/inc
57 # ST USB Device library
58 USBDEVLIB = $(PIOS_DEVLIB)/libraries/STM32_USB_Device_Library
59 SRC += $(sort $(wildcard $(USBDEVLIB)/Core/src/*.c))
60 EXTRAINCDIRS += $(USBDEVLIB)/Core/inc
63 # FreeRTOS
65 # If the application has included the generic FreeRTOS support, then add in
66 # the device-specific pieces of the code.
68 ifneq ($(FREERTOS_DIR),)
69 FREERTOS_PORTDIR := $(FREERTOS_DIR)
70 SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c))
71 EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F
72 include $(PIOSCOMMON)/libraries/msheap/library.mk
73 endif