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
-DSTM32F4
19 ifeq ($(CHIPFAMILY
),STM32F427_437xx
)
20 CDEFS
+= -DPIOS_TARGET_PROVIDES_FAST_HEAP
21 #large heap support must be enabled if SRAM > 128K
22 CDEFS
+= -DHEAP_SUPPORT_LARGE
23 CDEFS
+= -DSTM32F427_437xx
25 ifeq ($(CHIPFAMILY
),STM32F429_439xx
)
26 CDEFS
+= -DPIOS_TARGET_PROVIDES_FAST_HEAP
27 #large heap support must be enabled if SRAM > 128K
28 CDEFS
+= -DHEAP_SUPPORT_LARGE
29 CDEFS
+= -DSTM32F429_439xx
31 ifneq ($(CHIPFAMILY
),STM32F411xx
)
32 CDEFS
+= -DPIOS_TARGET_PROVIDES_FAST_HEAP
33 CDEFS
+= -DSTM32F40_41xxx
35 CDEFS
+= -DSTM32F411xE
37 endif #STM32F429_439xx
38 endif #STM32F427_437xx
39 CDEFS
+= -DSYSCLK_FREQ
=$(SYSCLK_FREQ
)
40 CDEFS
+= -DHSE_VALUE
=$(OSCILLATOR_FREQ
)
41 CDEFS
+= -DUSE_STDPERIPH_DRIVER
42 CDEFS
+= -DARM_MATH_CM4
-D__FPU_PRESENT
=1
44 ARCHFLAGS
+= -mcpu
=cortex-m4
-march
=armv7e-m
-mfpu
=fpv4-sp-d16
-mfloat-abi
=hard
46 # PIOS device library source and includes
47 SRC
+= $(sort $(wildcard $(PIOS_DEVLIB
)*.c
))
48 EXTRAINCDIRS
+= $(PIOS_DEVLIB
)inc
51 include $(PIOSCOMMON
)/libraries
/CMSIS
/library.mk
52 CMSIS_DEVICEDIR
:= $(PIOS_DEVLIB
)libraries
/CMSIS
/Device
/ST
/STM32F4xx
53 SRC
+= $(sort $(wildcard $(CMSIS_DEVICEDIR
)/Source
/$(BOARD_NAME
)/*.c
))
54 EXTRAINCDIRS
+= $(CMSIS_DEVICEDIR
)/Include
56 # ST Peripheral library
57 PERIPHLIB
= $(PIOS_DEVLIB
)libraries
/STM32F4xx_StdPeriph_Driver
59 ALL_SPL_SOURCES
= $(sort $(wildcard $(PERIPHLIB
)/src
/*.c
))
60 SPL_SOURCES
= $(filter-out %stm32f4xx_fmc.c
%stm32f4xx_sai.c
%stm32f4xx_fsmc.c
, $(ALL_SPL_SOURCES
))
63 EXTRAINCDIRS
+= $(PERIPHLIB
)/inc
66 USBOTGLIB
= $(PIOS_DEVLIB
)/libraries
/STM32_USB_OTG_Driver
67 USBOTGLIB_SRC
= usb_core.c usb_dcd.c usb_dcd_int.c
68 SRC
+= $(addprefix $(USBOTGLIB
)/src
/,$(USBOTGLIB_SRC
))
69 EXTRAINCDIRS
+= $(USBOTGLIB
)/inc
71 # ST USB Device library
72 USBDEVLIB
= $(PIOS_DEVLIB
)/libraries
/STM32_USB_Device_Library
73 SRC
+= $(sort $(wildcard $(USBDEVLIB
)/Core
/src
/*.c
))
74 EXTRAINCDIRS
+= $(USBDEVLIB
)/Core
/inc
79 # If the application has included the generic FreeRTOS support, then add in
80 # the device-specific pieces of the code.
82 ifneq ($(FREERTOS_DIR
),)
83 FREERTOS_PORTDIR
:= $(FREERTOS_DIR
)
84 SRC
+= $(sort $(wildcard $(FREERTOS_PORTDIR
)/portable
/GCC
/ARM_CM4F
/*.c
))
85 EXTRAINCDIRS
+= $(FREERTOS_PORTDIR
)/portable
/GCC
/ARM_CM4F
86 include $(PIOSCOMMON
)/libraries
/msheap
/library.mk