Typo s/us/µs/
[librepilot.git] / make / apps-defs.mk
blobdf0bf2acd64e794162393e350a313a09226a1f7d
2 # Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ifndef OPENPILOT_IS_COOL
20 $(error Top level Makefile must be used to build this target)
21 endif
23 # Paths
24 TOPDIR = .
25 OPSYSTEM = $(TOPDIR)
26 BOARDINC = $(TOPDIR)/..
27 OPSYSTEMINC = $(OPSYSTEM)/inc
28 PIOSINC = $(PIOS)/inc
29 PIOSCOMMON = $(PIOS)/common
30 FLIGHTLIBINC = $(FLIGHTLIB)/inc
32 ## UAVTalk and UAVObject manager
33 OPUAVOBJINC = $(OPUAVOBJ)/inc
34 OPUAVTALKINC = $(OPUAVTALK)/inc
36 ## Math
37 MATHLIB = $(FLIGHTLIB)/math
38 MATHLIBINC = $(FLIGHTLIB)/math
40 ## FreeRTOS support
41 FREERTOS_DIR = $(PIOSCOMMON)/libraries/FreeRTOS
42 include $(FREERTOS_DIR)/library.mk
44 ## Misc
45 OPTESTS = $(TOPDIR)/Tests
47 ## PIOS Hardware
48 ifeq ($(MCU),cortex-m3)
49 include $(PIOS)/stm32f10x/library.mk
50 else ifeq ($(MCU),cortex-m4)
51 include $(PIOS)/stm32f4xx/library.mk
52 else ifeq ($(MCU),cortex-m0)
53 include $(PIOS)/stm32f0x/library.mk
54 else
55 $(error Unsupported MCU: $(MCU))
56 endif
58 # List C source files here (C dependencies are automatically generated).
59 # Use file-extension c for "c-only"-files
60 ifneq ($(PIOS_APPS_MINIMAL),YES)
61 ## PIOS Hardware (Common Peripherals)
62 SRC += $(PIOSCOMMON)/pios_adxl345.c
63 SRC += $(PIOSCOMMON)/pios_bma180.c
64 SRC += $(PIOSCOMMON)/pios_bmp085.c
65 SRC += $(PIOSCOMMON)/pios_etasv3.c
66 SRC += $(PIOSCOMMON)/pios_gcsrcvr.c
67 SRC += $(PIOSCOMMON)/pios_hcsr04.c
68 SRC += $(PIOSCOMMON)/pios_hmc5843.c
69 SRC += $(PIOSCOMMON)/pios_hmc5x83.c
70 SRC += $(PIOSCOMMON)/pios_i2c_esc.c
71 SRC += $(PIOSCOMMON)/pios_l3gd20.c
72 SRC += $(PIOSCOMMON)/pios_mpu6000.c
73 SRC += $(PIOSCOMMON)/pios_mpxv.c
74 SRC += $(PIOSCOMMON)/pios_ms4525do.c
75 SRC += $(PIOSCOMMON)/pios_ms5611.c
76 SRC += $(PIOSCOMMON)/pios_oplinkrcvr.c
77 SRC += $(PIOSCOMMON)/pios_video.c
78 SRC += $(PIOSCOMMON)/pios_wavplay.c
79 SRC += $(PIOSCOMMON)/pios_rfm22b.c
80 SRC += $(PIOSCOMMON)/pios_rfm22b_com.c
81 SRC += $(PIOSCOMMON)/pios_rcvr.c
82 SRC += $(PIOSCOMMON)/pios_sbus.c
83 SRC += $(PIOSCOMMON)/pios_sdcard.c
84 SRC += $(PIOSCOMMON)/pios_sensors.c
86 ## Misc library functions
87 SRC += $(FLIGHTLIB)/sanitycheck.c
88 SRC += $(FLIGHTLIB)/CoordinateConversions.c
89 SRC += $(MATHLIB)/sin_lookup.c
90 SRC += $(MATHLIB)/pid.c
92 ## PIOS Hardware (Common)
93 SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c
94 SRC += $(PIOSCOMMON)/pios_flash_jedec.c
95 SRC += $(PIOSCOMMON)/pios_debuglog.c
96 endif
98 SRC += $(PIOSCOMMON)/pios_iap.c
99 SRC += $(PIOSCOMMON)/pios_com.c
100 SRC += $(PIOSCOMMON)/pios_com_msg.c
101 SRC += $(PIOSCOMMON)/pios_crc.c
102 SRC += $(PIOSCOMMON)/pios_deltatime.c
103 SRC += $(PIOSCOMMON)/pios_led.c
105 ifneq ($(PIOS_OMITS_USB),YES)
106 ## PIOS USB related files
107 SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c
108 SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
109 SRC += $(PIOSCOMMON)/pios_usb_util.c
110 endif
111 ## PIOS system code
112 SRC += $(PIOSCOMMON)/pios_task_monitor.c
113 SRC += $(PIOSCOMMON)/pios_callbackscheduler.c
114 SRC += $(PIOSCOMMON)/pios_notify.c
115 SRC += $(PIOSCOMMON)/pios_instrumentation.c
116 SRC += $(PIOSCOMMON)/pios_mem.c
117 ## Misc library functions
118 SRC += $(FLIGHTLIB)/fifo_buffer.c
120 SRC += $(MATHLIB)/mathmisc.c
121 SRC += $(MATHLIB)/butterworth.c
122 SRC += $(FLIGHTLIB)/printf-stdarg.c
123 SRC += $(FLIGHTLIB)/optypes.c
125 ## Modules
126 SRC += $(foreach mod, $(MODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c)))
127 CPPSRC += $(foreach mod, $(MODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.cpp)))
128 SRC += $(foreach mod, $(OPTMODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c)))
130 # Declare all non-optional modules as built-in to force inclusion.
131 # Built-in modules are always enabled and cannot be disabled.
132 MODNAMES := $(notdir $(subst /revolution,,$(MODULES)))
133 MODULES_BUILTIN := $(foreach mod, $(MODNAMES), -DMODULE_$(shell $(ECHO) $(mod) | tr '[:lower:]' '[:upper:]')_BUILTIN)
134 CDEFS += $(MODULES_BUILTIN)
136 # List C source files here which must be compiled in ARM-Mode (no -mthumb).
137 # Use file-extension c for "c-only"-files
138 SRCARM +=
140 # List C++ source files here.
141 # Use file-extension .cpp for C++-files (not .C)
142 CPPSRC +=
144 # List C++ source files here which must be compiled in ARM-Mode.
145 # Use file-extension .cpp for C++-files (not .C)
146 CPPSRCARM +=
148 # List Assembler source files here.
149 # Make them always end in a capital .S. Files ending in a lowercase .s
150 # will not be considered source files but generated files (assembler
151 # output from the compiler), and will be deleted upon "make clean"!
152 # Even though the DOS/Win* filesystem matches both .s and .S the same,
153 # it will preserve the spelling of the filenames, and gcc itself does
154 # care about how the name is spelled on its command-line.
155 ASRC +=
157 # List Assembler source files here which must be assembled in ARM-Mode.
158 ASRCARM +=
160 # List any extra directories to look for include files here.
161 # Each directory must be seperated by a space.
162 EXTRAINCDIRS += $(PIOS)
163 EXTRAINCDIRS += $(PIOSINC)
164 EXTRAINCDIRS += $(BOARDINC)
165 EXTRAINCDIRS += $(FLIGHTLIBINC)
166 EXTRAINCDIRS += $(PIOSCOMMON)
167 EXTRAINCDIRS += $(OPSYSTEMINC)
168 EXTRAINCDIRS += $(MATHLIBINC)
169 EXTRAINCDIRS += $(OPUAVOBJINC)
170 EXTRAINCDIRS += $(OPUAVTALKINC)
171 EXTRAINCDIRS += $(OPUAVSYNTHDIR)
173 # Modules
174 EXTRAINCDIRS += $(foreach mod, $(OPTMODULES) $(MODULES), $(OPMODULEDIR)/$(mod)/inc) $(OPMODULEDIR)/System/inc
176 # List any extra directories to look for library files here.
177 # Also add directories where the linker should search for
178 # includes from linker-script to the list
179 # Each directory must be seperated by a space.
180 EXTRA_LIBDIRS +=
182 # Extra Libraries
183 # Each library-name must be seperated by a space.
184 # i.e. to link with libxyz.a, libabc.a and libefsl.a:
185 # EXTRA_LIBS = xyz abc efsl
186 # for newlib-lpc (file: libnewlibc-lpc.a):
187 # EXTRA_LIBS = newlib-lpc
188 EXTRA_LIBS += m
190 # Compiler flags
191 CFLAGS +=
193 # Set linker-script name depending on selected submodel name
194 ifeq ($(MCU),cortex-m3)
195 LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld
196 LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_sections.ld
197 else ifeq ($(MCU),cortex-m4)
198 LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP))
199 else ifeq ($(MCU),cortex-m0)
200 LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld
201 LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_sections.ld
202 endif
204 # Add jtag targets (program and wipe)
205 $(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG)))