2 # Copyright (C) 2015, The LibrePilot Project, http://www.librepilot.org
3 # Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 ifndef FLIGHT_MAKEFILE
21 $(error Top level Makefile must be used to build this target
)
27 BOARDINC
= $(TOPDIR
)/..
28 OPSYSTEMINC
= $(OPSYSTEM
)/inc
30 PIOSCOMMON
= $(PIOS
)/common
31 FLIGHTLIBINC
= $(FLIGHTLIB
)/inc
34 override USE_DSP_LIB
:= NO
37 ifeq ($(MCU
),cortex-m3
)
38 include $(PIOS
)/stm32f10x
/library.mk
39 else ifeq ($(MCU
),cortex-m4
)
40 include $(PIOS
)/stm32f4xx
/library.mk
41 else ifeq ($(MCU
),cortex-m0
)
42 include $(PIOS
)/stm32f0x
/library.mk
44 $(error Unsupported MCU
: $(MCU
))
47 # List C source files here (C dependencies are automatically generated).
48 # Use file-extension c for "c-only"-files
52 SRC
+= $(OPSYSTEM
)/main.c
53 SRC
+= $(OPSYSTEM
)/pios_board.c
55 ## PIOS Hardware (Common)
56 SRC
+= $(PIOSCOMMON
)/pios_board_info.c
57 SRC
+= $(PIOSCOMMON
)/pios_com_msg.c
58 SRC
+= $(PIOSCOMMON
)/pios_iap.c
59 ifneq ($(PIOS_OMITS_USB
),YES
)
60 SRC
+= ..
/pios_usb_board_data.c
61 SRC
+= $(PIOSCOMMON
)/pios_usb_desc_hid_only.c
62 SRC
+= $(PIOSCOMMON
)/pios_usb_util.c
64 SRC
+= $(PIOSCOMMON
)/pios_led.c
66 ## Misc library functions
67 SRC
+= $(FLIGHTLIB
)/op_dfu.c
68 SRC
+= $(FLIGHTLIB
)/printf-stdarg.c
72 CPPSRC
+= $(FLIGHTLIB
)/mini_cpp.
cpp
75 # List C source files here which must be compiled in ARM-Mode (no -mthumb).
76 # Use file-extension c for "c-only"-files
79 # List C++ source files here.
80 # Use file-extension .cpp for C++-files (not .C)
83 # List C++ source files here which must be compiled in ARM-Mode.
84 # Use file-extension .cpp for C++-files (not .C)
87 # List Assembler source files here.
88 # Make them always end in a capital .S. Files ending in a lowercase .s
89 # will not be considered source files but generated files (assembler
90 # output from the compiler), and will be deleted upon "make clean"!
91 # Even though the DOS/Win* filesystem matches both .s and .S the same,
92 # it will preserve the spelling of the filenames, and gcc itself does
93 # care about how the name is spelled on its command-line.
96 # List Assembler source files here which must be assembled in ARM-Mode.
99 # List any extra directories to look for include files here.
100 # Each directory must be seperated by a space.
101 EXTRAINCDIRS
+= $(PIOS
)
102 EXTRAINCDIRS
+= $(PIOSINC
)
103 EXTRAINCDIRS
+= $(BOARDINC
)
104 EXTRAINCDIRS
+= $(FLIGHTLIBINC
)
105 EXTRAINCDIRS
+= $(PIOSCOMMON
)
106 EXTRAINCDIRS
+= $(OPSYSTEMINC
)
108 # List any extra directories to look for library files here.
109 # Also add directories where the linker should search for
110 # includes from linker-script to the list
111 # Each directory must be seperated by a space.
115 # Each library-name must be seperated by a space.
116 # i.e. to link with libxyz.a, libabc.a and libefsl.a:
117 # EXTRA_LIBS = xyz abc efsl
118 # for newlib-lpc (file: libnewlibc-lpc.a):
119 # EXTRA_LIBS = newlib-lpc
124 # enable bootloader specific stuffs
125 CDEFS
+= -DBOOTLOADER
127 # Set linker-script name depending on selected submodel name
128 ifeq ($(MCU
),cortex-m3
)
129 LDFLAGS
+= -T
$(LINKER_SCRIPTS_PATH
)/link_
$(BOARD
)_memory.
ld
130 LDFLAGS
+= -T
$(LINKER_SCRIPTS_PATH
)/link_
$(BOARD
)_BL_sections.
ld
131 else ifeq ($(MCU
),cortex-m4
)
132 LDFLAGS
+= $(addprefix -T
,$(LINKER_SCRIPTS_BL
))
133 else ifeq ($(MCU
),cortex-m0
)
134 LDFLAGS
+= -T
$(LINKER_SCRIPTS_PATH
)/link_
$(BOARD
)_memory.
ld
135 LDFLAGS
+= -T
$(LINKER_SCRIPTS_PATH
)/link_
$(BOARD
)_BL_sections.
ld
138 # Add jtag targets (program and wipe)
139 $(eval
$(call JTAG_TEMPLATE
,$(OUTDIR
)/$(TARGET
).bin
,$(BL_BANK_BASE
),$(BL_BANK_SIZE
),$(OPENOCD_JTAG_CONFIG
),$(OPENOCD_CONFIG
)))