1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-719: upgrade ARM SDK to 4.7-2012q4, use 'make arm_sdk_install' to install

+review OPReview
This commit is contained in:
Oleg Semyonov 2013-03-31 16:57:25 +02:00
parent 4be3cd4978
commit b67ce783f5
3 changed files with 181 additions and 65 deletions

View File

@ -48,7 +48,7 @@ toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
# to remove the chance that they will cause problems with our build
define SANITIZE_VAR
$(if $(filter-out undefined,$(origin $(1))),
$(info *NOTE* Sanitized $(2) variable '$(1)' from $(origin $(1)))
$(info $(EMPTY) NOTE Sanitized $(2) variable '$(1)' from $(origin $(1)))
MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES))
override $(1) :=
unexport $(1)
@ -102,6 +102,7 @@ export ANT := ant
export JAVAC := javac
export JAR := jar
export GIT := git
export CURL := curl
export PYTHON := python
export INSTALL := install
@ -116,48 +117,9 @@ else
export QUOTE :=
endif
# The tools.mk uses wget to fetch tarballs or packages
ifeq ($(shell [ -x "$(TOOLS_DIR)/bin/wget" ] && $(ECHO) "exists"), exists)
WGET := $(TOOLS_DIR)/bin/wget
else
# not installed, hope it's in the path...
WGET ?= wget
endif
# Include tools installers
include $(ROOT_DIR)/make/tools.mk
# Set up paths to tools
ifeq ($(shell [ -d "$(QT_SDK_DIR)" ] && $(ECHO) "exists"), exists)
QMAKE := $(QT_SDK_QMAKE_PATH)
else
# not installed, hope it's in the path...
QMAKE ?= qmake
endif
ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && $(ECHO) "exists"), exists)
export ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi-
else
# not installed, hope it's in the path...
export ARM_SDK_PREFIX ?= arm-none-eabi-
endif
ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && $(ECHO) "exists"), exists)
export OPENOCD := $(OPENOCD_DIR)/bin/openocd
else
# not installed, hope it's in the path...
export OPENOCD ?= openocd
endif
ifeq ($(shell [ -d "$(ANDROID_SDK_DIR)" ] && $(ECHO) "exists"), exists)
ANDROID := $(ANDROID_SDK_DIR)/tools/android
ANDROID_DX := $(ANDROID_SDK_DIR)/platform-tools/dx
else
# not installed, hope it's in the path...
ANDROID ?= android
ANDROID_DX ?= dx
endif
# We almost need to consider autoconf/automake instead of this
ifeq ($(UNAME), Linux)
QT_SPEC = linux-g++
@ -755,7 +717,7 @@ $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
# output is interleaved with the rest of the make output.
ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
.NOTPARALLEL:
$(info *NOTE* Parallel make disabled by all_ut_run target so we have sane console output)
$(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
endif
##############################

View File

@ -12,7 +12,7 @@ LINKER_SCRIPTS_PATH = $(PIOS_DEVLIB)
CDEFS += -DSTM32F10X -DSTM32F10X_$(MODEL)
CDEFS += -DUSE_STDPERIPH_DRIVER
CDEFS += -DARM_MATH_CM3
ARCHFLAGS += -mcpu=cortex-m3
ARCHFLAGS += -mcpu=cortex-m3 --specs=nano.specs
# Board-specific startup files
ASRC += $(PIOS_DEVLIB)startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S

View File

@ -1,11 +1,183 @@
###############################################################
#
# Installers for tools required by the ground and flight builds
# Installers for tools required by the OpenPilot build system.
# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
#
# NOTE: These are not tied to the default goals
# and must be invoked manually
# NOTE: install targets are not tied to the default goals and must
# be invoked manually. But tool paths set by this file are used
# across the build system.
#
###############################################################
# Ready to use:
# arm_sdk_install
#
# TODO:
# wget_win_install
# make_win_install
# qt_sdk_install
# openocd_install
# ftd2xx_install
# libusb_win_install
# openocd_git_win_install
# openocd_git_install
# stm32flash_install
# dfuutil_install
# android_sdk_install
# gtest_install
#
# TODO:
# help in the top Makefile
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
ifndef OPENPILOT_IS_COOL
$(error $(notdir $(lastword $(MAKEFILE_LIST))) should be included by the top level Makefile)
endif
##############################
#
# Toolchain URLs and directories
#
##############################
ifeq ($(UNAME), Linux)
ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2012q4-20121208-linux.tar.bz2
else ifeq ($(UNAME), Darwin)
ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2012q4-20121208-mac.tar.bz2
else ifeq ($(UNAME), Windows)
ARM_SDK_URL := http://wiki.openpilot.org/download/attachments/18612236/gcc-arm-none-eabi-4_7-2012q4-20121208-windows.tar.bz2
endif
ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_7-2012q4
##############################
#
# All toolchains available for the platform
#
##############################
ALL_SDK_TARGETS := arm_sdk
.PHONY: all_sdk_install all_sdk_clean all_sdk_distclean all_sdk_version
all_sdk_install: $(addsuffix _install,$(ALL_SDK_TARGETS))
all_sdk_clean: $(addsuffix _clean,$(ALL_SDK_TARGETS))
all_sdk_distclean: $(addsuffix _distclean,$(ALL_SDK_TARGETS))
all_sdk_version: $(addsuffix _version,$(ALL_SDK_TARGETS))
##############################
#
# Misc settings
#
##############################
# Define messages
MSG_DOWNLOADING = $(QUOTE) DOWNLOAD $(QUOTE)
MSG_EXTRACTING = $(QUOTE) EXTRACT $(QUOTE)
MSG_INSTALLING = $(QUOTE) INSTALL $(QUOTE)
MSG_CLEANING = $(QUOTE) CLEAN $(QUOTE)
MSG_DISTCLEANING = $(QUOTE) DISTCLEAN $(QUOTE)
# Verbosity level
ifeq ($(V), 1)
CURL_OPTIONS :=
else
# CURL_OPTIONS := --silent
endif
# Disable parallel make for sdk install targets to ensure ordered dependences
# like 'arm_sdk_clean | $(DL_DIR) $(TOOLS_DIR)'. They may fail otherwise being
# run in parallel
ifneq ($(strip $(filter $(addsuffix _install,all_sdk $(ALL_SDK_TARGETS)),$(MAKECMDGOALS))),)
.NOTPARALLEL:
$(info $(EMPTY) NOTE Parallel make disabled by some of sdk install targets)
$(info $(EMPTY) NOTE If some of install/extract targets failed, try 'make *_distclean' first)
$(info $(EMPTY) NOTE Use all_sdk_version to check toolchain versions)
endif
##############################
#
# ARM SDK
#
##############################
ARM_SDK_FILE := $(notdir $(ARM_SDK_URL))
.PHONY: arm_sdk_install
arm_sdk_install: arm_sdk_clean | $(DL_DIR) $(TOOLS_DIR)
@$(ECHO) $(MSG_DOWNLOADING) $(call toprel, $(DL_DIR)/$(ARM_SDK_FILE))
$(V1) $(CURL) $(CURL_OPTIONS) -z "$(DL_DIR)/$(ARM_SDK_FILE)" -o "$(DL_DIR)/$(ARM_SDK_FILE)" "$(ARM_SDK_URL)"
# binary only release so just extract it
@$(ECHO) $(MSG_EXTRACTING) $(call toprel, $(ARM_SDK_DIR))
$(V1) tar -C $(call toprel, $(TOOLS_DIR)) -xjf $(call toprel, $(DL_DIR)/$(ARM_SDK_FILE))
.PHONY: arm_sdk_clean
arm_sdk_clean:
@$(ECHO) $(MSG_CLEANING) $(call toprel, $(ARM_SDK_DIR))
$(V1) [ ! -d "$(ARM_SDK_DIR)" ] || $(RM) -r "$(ARM_SDK_DIR)"
.PHONY: arm_sdk_distclean
arm_sdk_distclean:
@$(ECHO) $(MSG_DISTCLEANING) $(call toprel, $@)
$(V1) [ ! -f "$(DL_DIR)/$(ARM_SDK_FILE)" ] || $(RM) "$(DL_DIR)/$(ARM_SDK_FILE)"
.PHONY: arm_sdk_version
arm_sdk_version:
$(V1) $(ARM_SDK_PREFIX)gcc --version | head -n1
ifeq ($(shell [ -d "$(ARM_SDK_DIR)" ] && $(ECHO) "exists"), exists)
export ARM_SDK_PREFIX := $(ARM_SDK_DIR)/bin/arm-none-eabi-
else
# not installed, hope it's in the path...
export ARM_SDK_PREFIX ?= arm-none-eabi-
endif
##############################
#
# TODO: these defines will go to tool install sections
#
##############################
# Set up paths to tools
ifeq ($(shell [ -d "$(QT_SDK_DIR)" ] && $(ECHO) "exists"), exists)
QMAKE := $(QT_SDK_QMAKE_PATH)
else
# not installed, hope it's in the path...
QMAKE ?= qmake
endif
ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && $(ECHO) "exists"), exists)
export OPENOCD := $(OPENOCD_DIR)/bin/openocd
else
# not installed, hope it's in the path...
export OPENOCD ?= openocd
endif
ifeq ($(shell [ -d "$(ANDROID_SDK_DIR)" ] && $(ECHO) "exists"), exists)
ANDROID := $(ANDROID_SDK_DIR)/tools/android
ANDROID_DX := $(ANDROID_SDK_DIR)/platform-tools/dx
else
# not installed, hope it's in the path...
ANDROID ?= android
ANDROID_DX ?= dx
endif
##############################
#
# TODO: code below is not revised yet
#
##############################
# Set up QT toolchain
QT_SDK_DIR := $(TOOLS_DIR)/qtsdk-v1.2.1
@ -44,24 +216,6 @@ qt_sdk_install: qt_sdk_clean
qt_sdk_clean:
$(V1) [ ! -d "$(QT_SDK_DIR)" ] || $(RM) -rf $(QT_SDK_DIR)
# Set up ARM (STM32) SDK
ARM_SDK_DIR := $(TOOLS_DIR)/gcc-arm-none-eabi-4_6-2012q4
.PHONY: arm_sdk_install
arm_sdk_install: ARM_SDK_URL := https://launchpad.net/gcc-arm-embedded/4.6/4.6-2012-q4-update/+download/gcc-arm-none-eabi-4_6-2012q4-20121016.tar.bz2
arm_sdk_install: ARM_SDK_FILE := $(notdir $(ARM_SDK_URL))
# order-only prereq on directory existance:
arm_sdk_install: | $(DL_DIR) $(TOOLS_DIR)
arm_sdk_install: arm_sdk_clean
# download the source only if it's newer than what we already have
$(V1) $(WGET) --no-check-certificate -N -P "$(DL_DIR)" "$(ARM_SDK_URL)"
# binary only release so just extract it
$(V1) tar -C $(TOOLS_DIR) -xjf "$(DL_DIR)/$(ARM_SDK_FILE)"
.PHONY: arm_sdk_clean
arm_sdk_clean:
$(V1) [ ! -d "$(ARM_SDK_DIR)" ] || $(RM) -r $(ARM_SDK_DIR)
# Set up openocd tools
OPENOCD_DIR := $(TOOLS_DIR)/openocd