Merged in thread/LP-69_SRXL_CC_Support (pull request #13)
[librepilot.git] / make / boot-defs.mk
blobebebc08029311c71d8846e0e6c1498561c7051d1
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 TOP_LEVEL_MAKEFILE
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 # ARM DSP library
33 override USE_DSP_LIB := NO
35 ## PIOS Hardware
36 ifeq ($(MCU),cortex-m3)
37 include $(PIOS)/stm32f10x/library.mk
38 else ifeq ($(MCU),cortex-m4)
39 include $(PIOS)/stm32f4xx/library.mk
40 else ifeq ($(MCU),cortex-m0)
41 include $(PIOS)/stm32f0x/library.mk
42 else
43 $(error Unsupported MCU: $(MCU))
44 endif
46 # List C source files here (C dependencies are automatically generated).
47 # Use file-extension c for "c-only"-files
49 ## Bootloader Core
51 SRC += $(OPSYSTEM)/main.c
52 SRC += $(OPSYSTEM)/pios_board.c
54 ## PIOS Hardware (Common)
55 SRC += $(PIOSCOMMON)/pios_board_info.c
56 SRC += $(PIOSCOMMON)/pios_com_msg.c
57 SRC += $(PIOSCOMMON)/pios_iap.c
58 ifneq ($(PIOS_OMITS_USB),YES)
59 SRC += ../pios_usb_board_data.c
60 SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
61 SRC += $(PIOSCOMMON)/pios_usb_util.c
62 endif
63 SRC += $(PIOSCOMMON)/pios_led.c
65 ## Misc library functions
66 SRC += $(FLIGHTLIB)/op_dfu.c
67 SRC += $(FLIGHTLIB)/printf-stdarg.c
69 # List C source files here which must be compiled in ARM-Mode (no -mthumb).
70 # Use file-extension c for "c-only"-files
71 SRCARM +=
73 # List C++ source files here.
74 # Use file-extension .cpp for C++-files (not .C)
75 CPPSRC +=
77 # List C++ source files here which must be compiled in ARM-Mode.
78 # Use file-extension .cpp for C++-files (not .C)
79 CPPSRCARM +=
81 # List Assembler source files here.
82 # Make them always end in a capital .S. Files ending in a lowercase .s
83 # will not be considered source files but generated files (assembler
84 # output from the compiler), and will be deleted upon "make clean"!
85 # Even though the DOS/Win* filesystem matches both .s and .S the same,
86 # it will preserve the spelling of the filenames, and gcc itself does
87 # care about how the name is spelled on its command-line.
88 ASRC +=
90 # List Assembler source files here which must be assembled in ARM-Mode.
91 ASRCARM +=
93 # List any extra directories to look for include files here.
94 # Each directory must be seperated by a space.
95 EXTRAINCDIRS += $(PIOS)
96 EXTRAINCDIRS += $(PIOSINC)
97 EXTRAINCDIRS += $(BOARDINC)
98 EXTRAINCDIRS += $(FLIGHTLIBINC)
99 EXTRAINCDIRS += $(PIOSCOMMON)
100 EXTRAINCDIRS += $(OPSYSTEMINC)
102 # List any extra directories to look for library files here.
103 # Also add directories where the linker should search for
104 # includes from linker-script to the list
105 # Each directory must be seperated by a space.
106 EXTRA_LIBDIRS +=
108 # Extra Libraries
109 # Each library-name must be seperated by a space.
110 # i.e. to link with libxyz.a, libabc.a and libefsl.a:
111 # EXTRA_LIBS = xyz abc efsl
112 # for newlib-lpc (file: libnewlibc-lpc.a):
113 # EXTRA_LIBS = newlib-lpc
114 EXTRA_LIBS +=
116 # Compiler flags
117 CDEFS +=
118 # enable bootloader specific stuffs
119 CDEFS += -DBOOTLOADER
121 # Set linker-script name depending on selected submodel name
122 ifeq ($(MCU),cortex-m3)
123 LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld
124 LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_BL_sections.ld
125 else ifeq ($(MCU),cortex-m4)
126 LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_BL))
127 else ifeq ($(MCU),cortex-m0)
128 LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld
129 LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_BL_sections.ld
130 endif
132 # Add jtag targets (program and wipe)
133 $(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG)))