mbed-os

Fork of mbed-os by erkin yucel

Committer:
xuaner
Date:
Thu Jul 20 14:26:57 2017 +0000
Revision:
1:3deb71413561
Parent:
0:f269e3021894
mbed_os

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elessair 0:f269e3021894 1 ###########################################################################
elessair 0:f269e3021894 2 #
elessair 0:f269e3021894 3 # Copyright (c) 2013-2016, ARM Limited, All Rights Reserved
elessair 0:f269e3021894 4 # SPDX-License-Identifier: Apache-2.0
elessair 0:f269e3021894 5 #
elessair 0:f269e3021894 6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
elessair 0:f269e3021894 7 # not use this file except in compliance with the License.
elessair 0:f269e3021894 8 # You may obtain a copy of the License at
elessair 0:f269e3021894 9 #
elessair 0:f269e3021894 10 # http://www.apache.org/licenses/LICENSE-2.0
elessair 0:f269e3021894 11 #
elessair 0:f269e3021894 12 # Unless required by applicable law or agreed to in writing, software
elessair 0:f269e3021894 13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
elessair 0:f269e3021894 14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
elessair 0:f269e3021894 15 # See the License for the specific language governing permissions and
elessair 0:f269e3021894 16 # limitations under the License.
elessair 0:f269e3021894 17 #
elessair 0:f269e3021894 18 ###########################################################################
elessair 0:f269e3021894 19
elessair 0:f269e3021894 20 # Toolchain
elessair 0:f269e3021894 21 PREFIX:=arm-none-eabi-
elessair 0:f269e3021894 22 GDB:=$(PREFIX)gdb
elessair 0:f269e3021894 23 OBJDUMP:=$(PREFIX)objdump
elessair 0:f269e3021894 24
elessair 0:f269e3021894 25 # Translate between uVisor namespace and mbed namespace
elessair 0:f269e3021894 26 TARGET_TRANSLATION:=MCU_K64F.kinetis EFM32.efm32 STM32F4.stm32 ARM_BEETLE_SOC.beetle
elessair 0:f269e3021894 27 TARGET_PREFIX:=../
elessair 0:f269e3021894 28 TARGET_SUPPORTED:=$(TARGET_PREFIX)targets/TARGET_UVISOR_SUPPORTED
elessair 0:f269e3021894 29 TARGET_UNSUPPORTED:=$(TARGET_PREFIX)targets/TARGET_UVISOR_UNSUPPORTED
elessair 0:f269e3021894 30 TARGET_INC:=$(TARGET_PREFIX)includes/uvisor/api
elessair 0:f269e3021894 31 TARGET_LIB_SRC:=$(TARGET_PREFIX)source
elessair 0:f269e3021894 32 TARGET_LIB_INC:=$(TARGET_PREFIX)includes/uvisor-lib
elessair 0:f269e3021894 33
elessair 0:f269e3021894 34 # uVisor source directory - hidden from mbed via TARGET_IGNORE
elessair 0:f269e3021894 35 UVISOR_GIT_URL:=https://github.com/ARMmbed/uvisor
elessair 0:f269e3021894 36 UVISOR_GIT_BRANCH:=master
elessair 0:f269e3021894 37 UVISOR_DIR:=TARGET_IGNORE/uvisor
elessair 0:f269e3021894 38 UVISOR_API:=$(UVISOR_DIR)/api
elessair 0:f269e3021894 39 UVISOR_GIT_CFG=$(UVISOR_DIR)/.git/config
elessair 0:f269e3021894 40
elessair 0:f269e3021894 41 # Derive variables from user configuration
elessair 0:f269e3021894 42 TARGET_LIST:=$(subst .,,$(suffix $(TARGET_TRANSLATION)))
elessair 0:f269e3021894 43 TARGET_LIST_DIR_SRC:=$(addprefix $(UVISOR_API)/lib/,$(TARGET_LIST))
elessair 0:f269e3021894 44 TARGET_LIST_DIR_DST:=$(addprefix $(TARGET_SUPPORTED)/,$(TARGET_LIST))
elessair 0:f269e3021894 45 TARGET_LIST_RELEASE:=$(addsuffix /release,$(TARGET_LIST_DIR_DST))
elessair 0:f269e3021894 46 TARGET_LIST_DEBUG:=$(addsuffix /debug,$(TARGET_LIST_DIR_DST))
elessair 0:f269e3021894 47
elessair 0:f269e3021894 48 .PHONY: all deploy rsync publish uvisor uvisor-compile clean cache update
elessair 0:f269e3021894 49
elessair 0:f269e3021894 50 all: uvisor
elessair 0:f269e3021894 51
elessair 0:f269e3021894 52 uvisor: uvisor-compile publish
elessair 0:f269e3021894 53
elessair 0:f269e3021894 54 rsync:
elessair 0:f269e3021894 55 #
elessair 0:f269e3021894 56 # Copying uVisor into mbed library...
elessair 0:f269e3021894 57 rm -rf $(TARGET_SUPPORTED)
elessair 0:f269e3021894 58 mkdir -p $(TARGET_SUPPORTED)
elessair 0:f269e3021894 59 rsync -a --exclude='*.txt' $(TARGET_LIST_DIR_SRC) $(TARGET_SUPPORTED)
elessair 0:f269e3021894 60 #
elessair 0:f269e3021894 61 # Copying uVisor headers to mbed includes...
elessair 0:f269e3021894 62 rm -rf $(TARGET_INC)
elessair 0:f269e3021894 63 mkdir -p $(TARGET_INC)
elessair 0:f269e3021894 64 rsync -a --delete $(UVISOR_API)/inc $(TARGET_INC)
elessair 0:f269e3021894 65 rsync -a --delete $(UVISOR_API)/rtx/inc/ $(TARGET_LIB_INC)/rtx
elessair 0:f269e3021894 66 #
elessair 0:f269e3021894 67 # Copying uVisor unsupported sources to unsupported target source...
elessair 0:f269e3021894 68 mkdir -p $(TARGET_UNSUPPORTED)
elessair 0:f269e3021894 69 cp $(UVISOR_API)/src/unsupported.c $(TARGET_UNSUPPORTED)/
elessair 0:f269e3021894 70 #
elessair 0:f269e3021894 71 # Copying uVisor shared sources to mbed source...
elessair 0:f269e3021894 72 rm -rf $(TARGET_LIB_SRC)
elessair 0:f269e3021894 73 mkdir -p $(TARGET_LIB_SRC)
elessair 0:f269e3021894 74 cp $(UVISOR_DIR)/core/system/src/page_allocator.c $(TARGET_LIB_SRC)/page_allocator.c_inc
elessair 0:f269e3021894 75 cp $(UVISOR_DIR)/core/system/inc/page_allocator_config.h $(TARGET_LIB_SRC)/page_allocator_config.h
elessair 0:f269e3021894 76 rsync -a --delete $(UVISOR_API)/rtx/src/ $(TARGET_LIB_SRC)/rtx
elessair 0:f269e3021894 77 #
elessair 0:f269e3021894 78 # Copying the documentation...
elessair 0:f269e3021894 79 cp $(UVISOR_DIR)/docs/api/QUICKSTART.md $(TARGET_PREFIX)/README.md
elessair 0:f269e3021894 80 #
elessair 0:f269e3021894 81 # Copying licenses
elessair 0:f269e3021894 82 cp $(UVISOR_DIR)/LICENSE* $(TARGET_SUPPORTED)
elessair 0:f269e3021894 83
elessair 0:f269e3021894 84 TARGET_M%: $(TARGET_SUPPORTED)/*/*/*_cortex_m%*.a
elessair 0:f269e3021894 85 @printf "#\n# Copying $@ files...\n"
elessair 0:f269e3021894 86 mkdir $(foreach file,$^,$(dir $(file))$@)
elessair 0:f269e3021894 87 $(foreach file,$^,mv $(file) $(dir $(file))$@/lib$(notdir $(file));)
elessair 0:f269e3021894 88
elessair 0:f269e3021894 89 publish: rsync TARGET_M3 TARGET_M4
elessair 0:f269e3021894 90 #
elessair 0:f269e3021894 91 # Rename release directorires to TARGET_RELEASE filters...
elessair 0:f269e3021894 92 $(foreach dir, $(TARGET_LIST_RELEASE),mv $(dir) $(dir $(dir))TARGET_RELEASE;)
elessair 0:f269e3021894 93 #
elessair 0:f269e3021894 94 # Rename debug directorires to TARGET_DEBUG filters...
elessair 0:f269e3021894 95 $(foreach dir, $(TARGET_LIST_DEBUG),mv $(dir) $(dir $(dir))TARGET_DEBUG;)
elessair 0:f269e3021894 96 #
elessair 0:f269e3021894 97 # Rename target directorires to TARGET_* filters...
elessair 0:f269e3021894 98 $(foreach target, $(TARGET_TRANSLATION),mv $(TARGET_SUPPORTED)/$(subst .,,$(suffix $(target))) $(TARGET_SUPPORTED)/TARGET_$(basename $(target));)
elessair 0:f269e3021894 99
elessair 0:f269e3021894 100 uvisor-compile: $(UVISOR_GIT_CFG)
elessair 0:f269e3021894 101 make -C $(UVISOR_DIR)
elessair 0:f269e3021894 102
elessair 0:f269e3021894 103 update: $(UVISOR_GIT_CFG)
elessair 0:f269e3021894 104 #
elessair 0:f269e3021894 105 # Updating to latest uVisor library version
elessair 0:f269e3021894 106 git -C $(UVISOR_DIR) pull --rebase
elessair 0:f269e3021894 107 #
elessair 0:f269e3021894 108 # Updating checked out version tag
elessair 0:f269e3021894 109 git -C $(UVISOR_DIR) describe --tags --abbrev=40 --dirty > $(TARGET_PREFIX)VERSION.txt
elessair 0:f269e3021894 110 #
elessair 0:f269e3021894 111 # Updated list of authors, sorted by contributions
elessair 0:f269e3021894 112 git -C $(UVISOR_DIR) shortlog -s -n > $(TARGET_PREFIX)AUTHORS.txt
elessair 0:f269e3021894 113
elessair 0:f269e3021894 114 $(UVISOR_GIT_CFG):
elessair 0:f269e3021894 115 rm -rf $(UVISOR_DIR)
elessair 0:f269e3021894 116 git clone -b $(UVISOR_GIT_BRANCH) $(UVISOR_GIT_URL) $(UVISOR_DIR)
elessair 0:f269e3021894 117
elessair 0:f269e3021894 118 clean: $(UVISOR_GIT_CFG)
elessair 0:f269e3021894 119 make -C $(UVISOR_DIR) clean