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