mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-26 08:22:43 +08:00
[build system] prefer compiler/toolchain found in path
fixes #231 also use a common makefile for finding the toolchain see #244
This commit is contained in:
@@ -66,21 +66,6 @@ OCAML=$(shell which ocaml)
|
||||
OCAMLRUN=$(shell which ocamlrun)
|
||||
BUILD_DATETIME:=$(shell date +%Y%m%d-%H%M%S)
|
||||
|
||||
# try to find the paparazzi multilib toolchain
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib ~/sat -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
#found the compiler from the paparazzi multilib package
|
||||
ARMGCC=$(TOOLCHAIN_DIR)/bin/arm-none-eabi-gcc
|
||||
else
|
||||
#try picking up the arm-none-eabi compiler from the path, otherwise use arm-elf
|
||||
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||
ARMGCC=$(shell which arm-elf-gcc)
|
||||
else
|
||||
ARMGCC=$(HAVE_ARM_NONE_EABI_GCC)
|
||||
endif
|
||||
endif
|
||||
|
||||
all: conf commands static
|
||||
|
||||
@@ -127,7 +112,7 @@ multimon:
|
||||
static_h: $(MESSAGES_H) $(MESSAGES2_H) $(UBX_PROTOCOL_H) $(MTK_PROTOCOL_H) $(XSENS_PROTOCOL_H) $(DL_PROTOCOL_H) $(DL_PROTOCOL2_H)
|
||||
|
||||
usb_lib:
|
||||
@[ -d sw/airborne/arch/lpc21/lpcusb ] && ((test -x "$(ARMGCC)" && (cd sw/airborne/arch/lpc21/lpcusb; $(MAKE))) || echo "Not building usb_lib: ARMGCC=$(ARMGCC) not found") || echo "Not building usb_lib: sw/airborne/arch/lpc21/lpcusb directory missing"
|
||||
@[ -d sw/airborne/arch/lpc21/lpcusb ] && (cd sw/airborne/arch/lpc21/lpcusb; $(MAKE)) || echo "Not building usb_lib: sw/airborne/arch/lpc21/lpcusb directory missing"
|
||||
|
||||
ext:
|
||||
$(MAKE) -C$(EXT) all
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# Copyright (C) 2012 Felix Ruess <felix.ruess@gmail.com>
|
||||
#
|
||||
# This file is part of paparazzi.
|
||||
#
|
||||
# paparazzi is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# paparazzi is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with paparazzi; see the file COPYING. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
# This is the common Makefile for finding the arm compiler and OpenOcd
|
||||
#
|
||||
|
||||
#
|
||||
# try to pick up the compiler from the path
|
||||
#
|
||||
CC = $(shell which arm-none-eabi-gcc)
|
||||
LD = $(shell which arm-none-eabi-gcc)
|
||||
AR = $(shell which arm-none-eabi-ar)
|
||||
CP = $(shell which arm-none-eabi-objcopy)
|
||||
DMP = $(shell which arm-none-eabi-objdump)
|
||||
NM = $(shell which arm-none-eabi-nm)
|
||||
SIZE = $(shell which arm-none-eabi-size)
|
||||
GDB = $(shell which arm-none-eabi-gdb)
|
||||
TOOLCHAIN_DIR=$(shell dirname `which arm-none-eabi-gcc`)
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/../arm-none-eabi/lib
|
||||
|
||||
#
|
||||
# if not found in path, try the paparazzi toolchain in /opt
|
||||
#
|
||||
ifeq ($(CC),)
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
||||
|
||||
# Define programs and commands.
|
||||
GCC_BIN_PREFIX=$(GCC_BIN_DIR)/arm-none-eabi
|
||||
CC = $(GCC_BIN_PREFIX)-gcc
|
||||
LD = $(GCC_BIN_PREFIX)-gcc
|
||||
AR = $(GCC_BIN_PREFIX)-ar
|
||||
CP = $(GCC_BIN_PREFIX)-objcopy
|
||||
DMP = $(GCC_BIN_PREFIX)-objdump
|
||||
NM = $(GCC_BIN_PREFIX)-nm
|
||||
SIZE = $(GCC_BIN_PREFIX)-size
|
||||
GDB = $(GCC_BIN_PREFIX)-gdb
|
||||
else
|
||||
# toolchain not found...
|
||||
endif
|
||||
endif
|
||||
|
||||
MULTILIB = $(shell if $(CC) --print-multi-lib | grep thumb2 > /dev/null ; then echo "yes"; else echo "no"; fi)
|
||||
|
||||
# some general commands
|
||||
RM = rm
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Find OpenOCD
|
||||
#
|
||||
# first try in the path
|
||||
OOCD = $(shell which openocd)
|
||||
#if OpenOCD could not be found in the path, try the toolchain dir (for backwards compatibility)
|
||||
ifeq ($(OOCD),)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
OOCD = $(shell if test -e $(TOOLCHAIN_DIR)/bin/openocd ; then echo $(TOOLCHAIN_DIR)/bin/openocd ; else echo "Warning: OpenOCD not found"; fi)
|
||||
endif
|
||||
endif
|
||||
+43
-83
@@ -31,68 +31,28 @@
|
||||
# only define here or elsewhere?
|
||||
SRC_ARCH = arch/lpc21
|
||||
|
||||
|
||||
# Programs location
|
||||
# try to find the paparazzi multilib toolchain
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib ~/sat -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
|
||||
#
|
||||
# found the new paparazzi toolchain, use it
|
||||
#
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
||||
GCC_BIN_PREFIX=$(GCC_BIN_DIR)/arm-none-eabi
|
||||
CC = $(GCC_BIN_PREFIX)-gcc
|
||||
LD = $(GCC_BIN_PREFIX)-gcc
|
||||
OBJCOPY = $(GCC_BIN_PREFIX)-objcopy
|
||||
OBJDUMP = $(GCC_BIN_PREFIX)-objdump
|
||||
NM = $(GCC_BIN_PREFIX)-nm
|
||||
SIZE = $(GCC_BIN_PREFIX)-size
|
||||
|
||||
#
|
||||
# If we can't find the toolchain (in /opt/paparazzi/arm-multilib or ~/sat) then try picking up the compilers from the path
|
||||
#
|
||||
else
|
||||
|
||||
# see if we can find the new arm-none-eabi, otherwise use the older arm-elf
|
||||
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||
GCC_PREFIX = arm-elf
|
||||
else
|
||||
GCC_PREFIX = arm-none-eabi
|
||||
GCC_LIB_DIR=$(shell dirname `which arm-none-eabi-gcc`)/../arm-none-eabi/lib
|
||||
endif
|
||||
|
||||
CC = $(shell which $(GCC_PREFIX)-gcc)
|
||||
LD = $(shell which $(GCC_PREFIX)-gcc)
|
||||
OBJCOPY = $(shell which $(GCC_PREFIX)-objcopy)
|
||||
OBJDUMP = $(shell which $(GCC_PREFIX)-objdump)
|
||||
NM = $(shell which $(GCC_PREFIX)-nm)
|
||||
SIZE = $(shell which $(GCC_PREFIX)-size)
|
||||
endif
|
||||
|
||||
#first try to find OpenOCD in the path
|
||||
OOCD = $(shell which openocd)
|
||||
#if OpenOCD could not be found in the path, try the toolchain dir
|
||||
ifeq ($(OOCD),)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
OOCD = $(shell if test -e $(TOOLCHAIN_DIR)/bin/openocd ; then echo $(TOOLCHAIN_DIR)/bin/openocd ; else echo "Warning: OpenOCD not found"; fi)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Define some other programs and commands.
|
||||
SHELL = sh
|
||||
REMOVE = rm -f
|
||||
COPY = cp
|
||||
|
||||
MULTILIB = $(shell if $(CC) --print-multi-lib | grep thumb2 > /dev/null ; then echo "yes"; else echo "no"; fi)
|
||||
|
||||
|
||||
# Launch with "make Q=''" to get full command display
|
||||
Q=@
|
||||
|
||||
|
||||
#
|
||||
# find compiler toolchain
|
||||
#
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-common
|
||||
|
||||
#
|
||||
# if the new arm-none-eabi multilib compiler was not found try the old arm-elf one
|
||||
#
|
||||
ifeq ($(CC),)
|
||||
CC = $(shell which arm-elf-gcc)
|
||||
LD = $(shell which arm-elf-gcc)
|
||||
CP = $(shell which arm-elf-objcopy)
|
||||
DMP = $(shell which arm-elf-objdump)
|
||||
NM = $(shell which arm-elf-nm)
|
||||
SIZE = $(shell which arm-elf-size)
|
||||
endif
|
||||
|
||||
|
||||
# MCU name and submodel
|
||||
MCU = arm7tdmi
|
||||
THUMB = -mthumb
|
||||
@@ -214,8 +174,8 @@ all: printcommands printmultilib sizebefore build sizeafter
|
||||
printcommands:
|
||||
@echo "Using CC = $(CC)"
|
||||
@echo "Using LD = $(LD)"
|
||||
@echo "Using CP = $(OBJCOPY)"
|
||||
@echo "Using DMP = $(OBJDUMP)"
|
||||
@echo "Using CP = $(CP)"
|
||||
@echo "Using DMP = $(DMP)"
|
||||
@echo "Using NM = $(NM)"
|
||||
@echo "Using SIZE = $(SIZE)"
|
||||
@echo "GCC version:"
|
||||
@@ -272,14 +232,14 @@ endif
|
||||
# TODO: handling the .eeprom-section should be redundant
|
||||
%.hex: %.elf
|
||||
@echo OBJC $@
|
||||
$(Q)$(OBJCOPY) -O $(FORMAT) $< $@
|
||||
$(Q)$(CP) -O $(FORMAT) $< $@
|
||||
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
# testing: option -C
|
||||
%.lss: %.elf
|
||||
@echo OBJD $@
|
||||
$(Q)$(OBJDUMP) -h -S -C $< > $@
|
||||
$(Q)$(DMP) -h -S -C $< > $@
|
||||
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
@@ -330,26 +290,26 @@ clean: clean_list
|
||||
|
||||
clean_list :
|
||||
@echo
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).hex
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).obj
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).elf
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).map
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).obj
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).a90
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).sym
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).lnk
|
||||
$(REMOVE) $(OBJDIR)/$(TARGET).lss
|
||||
$(REMOVE) $(COBJ)
|
||||
$(REMOVE) $(AOBJ)
|
||||
$(REMOVE) $(COBJARM)
|
||||
$(REMOVE) $(AOBJARM)
|
||||
$(REMOVE) $(LST)
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
$(REMOVE) $(SRCARM:.c=.s)
|
||||
$(REMOVE) $(SRCARM:.c=.d)
|
||||
$(REMOVE) .dep/*
|
||||
$(REMOVE) *~
|
||||
$(RM) $(OBJDIR)/$(TARGET).hex
|
||||
$(RM) $(OBJDIR)/$(TARGET).obj
|
||||
$(RM) $(OBJDIR)/$(TARGET).elf
|
||||
$(RM) $(OBJDIR)/$(TARGET).map
|
||||
$(RM) $(OBJDIR)/$(TARGET).obj
|
||||
$(RM) $(OBJDIR)/$(TARGET).a90
|
||||
$(RM) $(OBJDIR)/$(TARGET).sym
|
||||
$(RM) $(OBJDIR)/$(TARGET).lnk
|
||||
$(RM) $(OBJDIR)/$(TARGET).lss
|
||||
$(RM) $(COBJ)
|
||||
$(RM) $(AOBJ)
|
||||
$(RM) $(COBJARM)
|
||||
$(RM) $(AOBJARM)
|
||||
$(RM) $(LST)
|
||||
$(RM) $(SRC:.c=.s)
|
||||
$(RM) $(SRC:.c=.d)
|
||||
$(RM) $(SRCARM:.c=.s)
|
||||
$(RM) $(SRCARM:.c=.d)
|
||||
$(RM) .dep/*
|
||||
$(RM) *~
|
||||
|
||||
|
||||
# Listing of phony targets.
|
||||
|
||||
+8
-45
@@ -31,57 +31,24 @@ SRC_ARCH = arch/stm32
|
||||
# Call with "make Q=''" to get full command display
|
||||
Q=@
|
||||
|
||||
|
||||
#
|
||||
# find compiler toolchain
|
||||
#
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-common
|
||||
|
||||
|
||||
MCU = cortex-m3
|
||||
#DEBUG = dwarf-2
|
||||
OPT = s
|
||||
#OPT = 2
|
||||
#OPT = 0
|
||||
|
||||
# Programs location
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib ~/sat /opt/paparazzi/stm32 -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
||||
|
||||
# Define programs and commands.
|
||||
GCC_BIN_PREFIX=$(GCC_BIN_DIR)/arm-none-eabi
|
||||
CC = $(GCC_BIN_PREFIX)-gcc
|
||||
LD = $(GCC_BIN_PREFIX)-gcc
|
||||
CP = $(GCC_BIN_PREFIX)-objcopy
|
||||
DMP = $(GCC_BIN_PREFIX)-objdump
|
||||
NM = $(GCC_BIN_PREFIX)-nm
|
||||
SIZE = $(GCC_BIN_PREFIX)-size
|
||||
GDB = $(GCC_BIN_PREFIX)-gdb
|
||||
RM = rm
|
||||
|
||||
# If we can't find the toolchain then try picking up the compilers from the path
|
||||
else
|
||||
CC = $(shell which arm-none-eabi-gcc)
|
||||
LD = $(shell which arm-none-eabi-gcc)
|
||||
CP = $(shell which arm-none-eabi-objcopy)
|
||||
DMP = $(shell which arm-none-eabi-objdump)
|
||||
NM = $(shell which arm-none-eabi-nm)
|
||||
SIZE = $(shell which arm-none-eabi-size)
|
||||
GDB = $(shell which arm-none-eabi-gdb)
|
||||
RM = rm
|
||||
TOOLCHAIN_DIR=$(shell dirname `which arm-none-eabi-gcc`)
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/../arm-none-eabi/lib
|
||||
endif
|
||||
|
||||
ifndef $(PYTHON)
|
||||
PYTHON = $(shell which python)
|
||||
endif
|
||||
|
||||
#first try to find OpenOCD in the path
|
||||
OOCD = $(shell which openocd)
|
||||
#if OpenOCD could not be found in the path, try the toolchain dir
|
||||
ifeq ($(OOCD),)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
OOCD = $(shell if test -e $(TOOLCHAIN_DIR)/bin/openocd ; then echo $(TOOLCHAIN_DIR)/bin/openocd ; else echo "Warning: OpenOCD not found"; fi)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(BOARD_SERIAL),)
|
||||
OOCD_OPTIONS = -c "ft2232_serial $(BOARD_SERIAL)"
|
||||
endif
|
||||
@@ -132,11 +99,6 @@ LDSCRIPT = $($(TARGET).LDSCRIPT)
|
||||
endif
|
||||
endif
|
||||
|
||||
#UNAME = $(shell uname -s)
|
||||
ifndef MULTILIB
|
||||
MULTILIB = $(shell if $(CC) --print-multi-lib | grep thumb2 > /dev/null ; then echo "yes"; else echo "no"; fi)
|
||||
endif
|
||||
|
||||
CFLAGS = -I. -I./$(ARCH) -I../ext/libopencm3/include $(INCLUDES) -D__thumb2__ -Wall -msoft-float -O$(OPT)
|
||||
CFLAGS += -Wl,--gc-sections
|
||||
CFLAGS += -mcpu=$(MCU) -mthumb -ansi
|
||||
@@ -277,6 +239,7 @@ upload: $(OBJDIR)/$(TARGET).bin
|
||||
else ifeq ($(FLASH_MODE),JTAG)
|
||||
ifeq ($(BMP_PORT),)
|
||||
upload: $(OBJDIR)/$(TARGET).hex
|
||||
@echo "Assuming luftboot bootloader: $(ASSUMING_LUFTBOOT)"
|
||||
@echo "Using OOCD = $(OOCD)"
|
||||
@echo " OOCD\t$<"
|
||||
$(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
|
||||
|
||||
@@ -4,49 +4,26 @@ LIBNAME = libusbstack
|
||||
PKG_NAME = target
|
||||
DATE = $$(date +%Y%m%d)
|
||||
|
||||
# Tool definitions
|
||||
# try to find the paparazzi multilib toolchain
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib ~/sat -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
#
|
||||
# find compiler toolchain
|
||||
#
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-common
|
||||
|
||||
#
|
||||
# found the new paparazzi toolchain, use it
|
||||
# if the new arm-none-eabi multilib compiler was not found try the old arm-elf one
|
||||
#
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
||||
GCC_BIN_PREFIX=$(GCC_BIN_DIR)/arm-none-eabi
|
||||
CC = $(GCC_BIN_PREFIX)-gcc
|
||||
LD = $(GCC_BIN_PREFIX)-ld -v
|
||||
AR = $(GCC_BIN_PREFIX)-ar
|
||||
AS = $(GCC_BIN_PREFIX)-as
|
||||
CP = $(GCC_BIN_PREFIX)-objcopy
|
||||
OD = $(GCC_BIN_PREFIX)-objdump
|
||||
|
||||
#
|
||||
# If we can't find the toolchain (in /opt/paparazzi/arm-multilib or ~/sat) then try picking up the compilers from the path
|
||||
#
|
||||
else
|
||||
|
||||
# see if we can find the new arm-none-eabi, otherwise use the older arm-elf
|
||||
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||
GCC_PREFIX = arm-elf
|
||||
else
|
||||
GCC_PREFIX = arm-none-eabi
|
||||
GCC_LIB_DIR=$(shell dirname `which arm-none-eabi-gcc`)/../arm-none-eabi/lib
|
||||
ifeq ($(CC),)
|
||||
CC = $(shell which arm-elf-gcc)
|
||||
LD = $(shell which arm-elf-gcc)
|
||||
AR = $(shell which arm-elf-ar)
|
||||
CP = $(shell which arm-elf-objcopy)
|
||||
DMP = $(shell which arm-elf-objdump)
|
||||
NM = $(shell which arm-elf-nm)
|
||||
SIZE = $(shell which arm-elf-size)
|
||||
endif
|
||||
|
||||
CC = $(shell which $(GCC_PREFIX)-gcc)
|
||||
LD = $(shell which $(GCC_PREFIX)-ld) -v
|
||||
AR = $(shell which $(GCC_PREFIX)-ar)
|
||||
AS = $(shell which $(GCC_PREFIX)-as)
|
||||
CP = $(shell which $(GCC_PREFIX)-objcopy)
|
||||
OD = $(shell which $(GCC_PREFIX)-objdump)
|
||||
endif
|
||||
|
||||
# Define some other programs and commands.
|
||||
RM = rm
|
||||
TAR = tar
|
||||
|
||||
CFLAGS = -I./ -I../ -c -W -Wall -Os -g -mcpu=arm7tdmi
|
||||
|
||||
@@ -18,53 +18,9 @@ LINKFILE_RAM = lpc2148-ram.ld
|
||||
#
|
||||
# try to find the paparazzi multilib toolchain
|
||||
#
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib ~/sat -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
include $(PAPARAZZI_SRC)/conf/Makefile.arm-common
|
||||
|
||||
#
|
||||
# found the new paparazzi toolchain, use it
|
||||
#
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
||||
GCC_BIN_PREFIX=$(GCC_BIN_DIR)/arm-none-eabi
|
||||
CC = $(GCC_BIN_PREFIX)-gcc
|
||||
LD = $(GCC_BIN_PREFIX)-ld -v
|
||||
AR = $(GCC_BIN_PREFIX)-ar
|
||||
AS = $(GCC_BIN_PREFIX)-as
|
||||
CP = $(GCC_BIN_PREFIX)-objcopy
|
||||
OD = $(GCC_BIN_PREFIX)-objdump
|
||||
NM = $(GCC_BIN_PREFIX)-nm
|
||||
SIZE = $(GCC_BIN_PREFIX)-size
|
||||
|
||||
#
|
||||
# If we can't find the toolchain (in /opt/paparazzi/arm-multilib or ~/sat) then try picking up the compilers from the path
|
||||
#
|
||||
else
|
||||
|
||||
# see if we can find the new arm-none-eabi, otherwise use the older arm-elf
|
||||
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||
GCC_PREFIX = arm-elf
|
||||
else
|
||||
GCC_PREFIX = arm-none-eabi
|
||||
GCC_LIB_DIR=$(shell dirname `which arm-none-eabi-gcc`)/../arm-none-eabi/lib
|
||||
endif
|
||||
|
||||
CC = $(shell which $(GCC_PREFIX)-gcc)
|
||||
LD = $(shell which $(GCC_PREFIX)-ld) -v
|
||||
AR = $(shell which $(GCC_PREFIX)-ar)
|
||||
AS = $(shell which $(GCC_PREFIX)-as)
|
||||
CP = $(shell which $(GCC_PREFIX)-objcopy)
|
||||
OD = $(shell which $(GCC_PREFIX)-objdump)
|
||||
NM = $(shell which $(GCC_PREFIX)-nm)
|
||||
SIZE = $(shell which $(GCC_PREFIX)-size)
|
||||
endif
|
||||
|
||||
RM = rm
|
||||
TAR = tar
|
||||
|
||||
MULTILIB = $(shell if $(CC) --print-multi-lib | grep thumb2 > /dev/null ; then echo "yes"; else echo "no"; fi)
|
||||
TAR = tar
|
||||
|
||||
CFLAGS = -I./ -c -W -Wall -Os -g -mcpu=arm7tdmi -mthumb-interwork $(ALLFLAGS)
|
||||
# -DDEBUG
|
||||
|
||||
+3
-3
@@ -30,14 +30,14 @@ EXT_DIR=$(PAPARAZZI_SRC)/sw/ext
|
||||
PREFIX = arm-none-eabi
|
||||
|
||||
#
|
||||
# if we can find arm-none-eabi-gcc in the path, overwrite PREFIX with explicit path
|
||||
# if we can't find arm-none-eabi-gcc in the path, overwrite PREFIX with explicit path
|
||||
#
|
||||
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||
|
||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||
# not found in PATH, check paparazzi toolchains
|
||||
# not found in PATH, check paparazzi toolchain
|
||||
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib /opt/paparazzi/stm32 -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
TOOLCHAIN=$(shell find -L /opt/paparazzi/arm-multilib -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1)
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
TOOLCHAIN_DIR=$(shell dirname $(TOOLCHAIN))
|
||||
PREFIX = $(TOOLCHAIN_DIR)/bin/arm-none-eabi
|
||||
|
||||
Reference in New Issue
Block a user