mirror of https://github.com/ARMmbed/mbed-os.git
Add updated uVisor importer script
parent
9714a0edf6
commit
10d9c2fa97
|
@ -0,0 +1,106 @@
|
||||||
|
###########################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2013-2016, ARM Limited, All Rights Reserved
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
# Toolchain
|
||||||
|
PREFIX:=arm-none-eabi-
|
||||||
|
GDB:=$(PREFIX)gdb
|
||||||
|
OBJDUMP:=$(PREFIX)objdump
|
||||||
|
|
||||||
|
# Translate between uVisor namespace and mbed namespace
|
||||||
|
TARGET_TRANSLATION:=MCU_K64F.kinetis EFM32.efm32 STM32F4.stm32
|
||||||
|
TARGET_PREFIX:=../
|
||||||
|
TARGET_SUPPORTED:=$(TARGET_PREFIX)targets/TARGET_UVISOR_SUPPORTED
|
||||||
|
TARGET_UNSUPPORTED:=$(TARGET_PREFIX)targets/TARGET_UVISOR_UNSUPPORTED
|
||||||
|
TARGET_INC:=$(TARGET_PREFIX)includes/uvisor/api
|
||||||
|
|
||||||
|
# uVisor source directory - hidden from mbed via TARGET_IGNORE
|
||||||
|
UVISOR_GIT_URL:=https://github.com/ARMmbed/uvisor
|
||||||
|
UVISOR_GIT_BRANCH:=dev
|
||||||
|
UVISOR_DIR:=TARGET_IGNORE/uvisor
|
||||||
|
UVISOR_API:=$(UVISOR_DIR)/api
|
||||||
|
UVISOR_GIT_CFG=$(UVISOR_DIR)/.git/config
|
||||||
|
|
||||||
|
# Derive variables from user configuration
|
||||||
|
TARGET_LIST:=$(subst .,,$(suffix $(TARGET_TRANSLATION)))
|
||||||
|
TARGET_LIST_DIR_SRC:=$(addprefix $(UVISOR_API)/lib/,$(TARGET_LIST))
|
||||||
|
TARGET_LIST_DIR_DST:=$(addprefix $(TARGET_SUPPORTED)/,$(TARGET_LIST))
|
||||||
|
TARGET_LIST_RELEASE:=$(addsuffix /release,$(TARGET_LIST_DIR_DST))
|
||||||
|
TARGET_LIST_DEBUG:=$(addsuffix /debug,$(TARGET_LIST_DIR_DST))
|
||||||
|
|
||||||
|
.PHONY: all deploy rsync publish uvisor uvisor-compile clean cache update
|
||||||
|
|
||||||
|
all: uvisor
|
||||||
|
|
||||||
|
uvisor: uvisor-compile publish
|
||||||
|
|
||||||
|
rsync:
|
||||||
|
#
|
||||||
|
# Copying uVisor into mbed library...
|
||||||
|
rm -rf $(TARGET_SUPPORTED)
|
||||||
|
mkdir -p $(TARGET_SUPPORTED)
|
||||||
|
rsync -a --exclude='*.txt' $(TARGET_LIST_DIR_SRC) $(TARGET_SUPPORTED)
|
||||||
|
#
|
||||||
|
# Copying uVisor headers to mbed includes...
|
||||||
|
rm -rf $(TARGET_INC)
|
||||||
|
mkdir -p $(TARGET_INC)
|
||||||
|
rsync -a --delete $(UVISOR_API)/inc $(TARGET_INC)
|
||||||
|
#
|
||||||
|
# Copying uVisor unsupported sources to unsupported target source...
|
||||||
|
mkdir -p $(TARGET_UNSUPPORTED)
|
||||||
|
cp $(UVISOR_API)/src/unsupported.c $(TARGET_UNSUPPORTED)/
|
||||||
|
#
|
||||||
|
# Copying licenses
|
||||||
|
cp $(UVISOR_DIR)/LICENSE* $(TARGET_SUPPORTED)
|
||||||
|
|
||||||
|
TARGET_M%: $(TARGET_SUPPORTED)/*/*/*_m%_*.a
|
||||||
|
@printf "#\n# Copying $@ files...\n"
|
||||||
|
mkdir $(foreach file,$^,$(dir $(file))$@)
|
||||||
|
$(foreach file,$^,mv $(file) $(dir $(file))$@/lib$(notdir $(file));)
|
||||||
|
|
||||||
|
publish: rsync TARGET_M3 TARGET_M4
|
||||||
|
#
|
||||||
|
# Rename release directorires to TARGET_RELEASE filters...
|
||||||
|
$(foreach dir, $(TARGET_LIST_RELEASE),mv $(dir) $(dir $(dir))TARGET_RELEASE;)
|
||||||
|
#
|
||||||
|
# Rename debug directorires to TARGET_DEBUG filters...
|
||||||
|
$(foreach dir, $(TARGET_LIST_DEBUG),mv $(dir) $(dir $(dir))TARGET_DEBUG;)
|
||||||
|
#
|
||||||
|
# Rename target directorires to TARGET_* filters...
|
||||||
|
$(foreach target, $(TARGET_TRANSLATION),mv $(TARGET_SUPPORTED)/$(subst .,,$(suffix $(target))) $(TARGET_SUPPORTED)/TARGET_$(basename $(target));)
|
||||||
|
|
||||||
|
uvisor-compile: $(UVISOR_GIT_CFG)
|
||||||
|
make -C $(UVISOR_DIR)
|
||||||
|
|
||||||
|
update: $(UVISOR_GIT_CFG)
|
||||||
|
#
|
||||||
|
# Updating to latest uVisor library version
|
||||||
|
git -C $(UVISOR_DIR) pull --rebase
|
||||||
|
#
|
||||||
|
# Updating checked out version tag
|
||||||
|
git -C $(UVISOR_DIR) describe --tags --abbrev=40 --dirty > $(TARGET_PREFIX)VERSION.txt
|
||||||
|
#
|
||||||
|
# Updated list of authors, sorted by contributions
|
||||||
|
git -C $(UVISOR_DIR) shortlog -s -n > $(TARGET_PREFIX)AUTHORS.txt
|
||||||
|
|
||||||
|
$(UVISOR_GIT_CFG):
|
||||||
|
rm -rf $(UVISOR_DIR)
|
||||||
|
git clone -b $(UVISOR_GIT_BRANCH) $(UVISOR_GIT_URL) $(UVISOR_DIR)
|
||||||
|
|
||||||
|
clean: $(UVISOR_GIT_CFG)
|
||||||
|
make -C $(UVISOR_DIR) clean
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Rebuilding the uVisor mbed Library
|
||||||
|
|
||||||
|
This directory contains scripts to import and rebuild the latest uVisor library to mbed Classic.
|
||||||
|
uVisor does not need to be re-deployed for normal application development.
|
||||||
|
|
||||||
|
For uVisor development and code contributions please visit the [uVisor repository](https://github.com/ARMmbed/uvisor).
|
|
@ -0,0 +1 @@
|
||||||
|
/uvisor
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2016, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#ifndef __UVISOR_LIB_UVISOR_LIB_H__
|
||||||
|
#define __UVISOR_LIB_UVISOR_LIB_H__
|
||||||
|
|
||||||
|
/* This file translates mbed-specific pre-processor symbols into
|
||||||
|
* uVisor-specific ones. Then the main uvisor-lib.h file is included. */
|
||||||
|
|
||||||
|
/* By default uVisor is not there. */
|
||||||
|
#if !defined(UVISOR_PRESENT)
|
||||||
|
#define UVISOR_PRESENT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Detect the target using the mbed-specific symbols and determine the MPU
|
||||||
|
* architecture accordingly. */
|
||||||
|
#if defined(TARGET_KINETIS)
|
||||||
|
#define ARCH_MPU_KINETIS
|
||||||
|
#else
|
||||||
|
#define ARCH_MPU_ARMv7M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The uVisor API main header file will use the above definitions. */
|
||||||
|
#include "uvisor/api/inc/uvisor-lib.h"
|
||||||
|
|
||||||
|
#endif /* __UVISOR_LIB_UVISOR_LIB_H__ */
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
EXTERN void uvisor_disabled_set_vector(uint32_t irqn, uint32_t vector)
|
||||||
|
{
|
||||||
|
NVIC_SetVector((IRQn_Type) irqn, vector);
|
||||||
|
}
|
||||||
|
|
||||||
|
EXTERN uint32_t uvisor_disabled_get_vector(uint32_t irqn)
|
||||||
|
{
|
||||||
|
return NVIC_GetVector((IRQn_Type) irqn);
|
||||||
|
}
|
Loading…
Reference in New Issue