Skip to content

Commit 10d9c2f

Browse files
committed
Add updated uVisor importer script
1 parent 9714a0e commit 10d9c2f

File tree

5 files changed

+179
-0
lines changed

5 files changed

+179
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
###########################################################################
2+
#
3+
# Copyright (c) 2013-2016, ARM Limited, All Rights Reserved
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7+
# not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
###########################################################################
19+
20+
# Toolchain
21+
PREFIX:=arm-none-eabi-
22+
GDB:=$(PREFIX)gdb
23+
OBJDUMP:=$(PREFIX)objdump
24+
25+
# Translate between uVisor namespace and mbed namespace
26+
TARGET_TRANSLATION:=MCU_K64F.kinetis EFM32.efm32 STM32F4.stm32
27+
TARGET_PREFIX:=../
28+
TARGET_SUPPORTED:=$(TARGET_PREFIX)targets/TARGET_UVISOR_SUPPORTED
29+
TARGET_UNSUPPORTED:=$(TARGET_PREFIX)targets/TARGET_UVISOR_UNSUPPORTED
30+
TARGET_INC:=$(TARGET_PREFIX)includes/uvisor/api
31+
32+
# uVisor source directory - hidden from mbed via TARGET_IGNORE
33+
UVISOR_GIT_URL:=https://github.com/ARMmbed/uvisor
34+
UVISOR_GIT_BRANCH:=dev
35+
UVISOR_DIR:=TARGET_IGNORE/uvisor
36+
UVISOR_API:=$(UVISOR_DIR)/api
37+
UVISOR_GIT_CFG=$(UVISOR_DIR)/.git/config
38+
39+
# Derive variables from user configuration
40+
TARGET_LIST:=$(subst .,,$(suffix $(TARGET_TRANSLATION)))
41+
TARGET_LIST_DIR_SRC:=$(addprefix $(UVISOR_API)/lib/,$(TARGET_LIST))
42+
TARGET_LIST_DIR_DST:=$(addprefix $(TARGET_SUPPORTED)/,$(TARGET_LIST))
43+
TARGET_LIST_RELEASE:=$(addsuffix /release,$(TARGET_LIST_DIR_DST))
44+
TARGET_LIST_DEBUG:=$(addsuffix /debug,$(TARGET_LIST_DIR_DST))
45+
46+
.PHONY: all deploy rsync publish uvisor uvisor-compile clean cache update
47+
48+
all: uvisor
49+
50+
uvisor: uvisor-compile publish
51+
52+
rsync:
53+
#
54+
# Copying uVisor into mbed library...
55+
rm -rf $(TARGET_SUPPORTED)
56+
mkdir -p $(TARGET_SUPPORTED)
57+
rsync -a --exclude='*.txt' $(TARGET_LIST_DIR_SRC) $(TARGET_SUPPORTED)
58+
#
59+
# Copying uVisor headers to mbed includes...
60+
rm -rf $(TARGET_INC)
61+
mkdir -p $(TARGET_INC)
62+
rsync -a --delete $(UVISOR_API)/inc $(TARGET_INC)
63+
#
64+
# Copying uVisor unsupported sources to unsupported target source...
65+
mkdir -p $(TARGET_UNSUPPORTED)
66+
cp $(UVISOR_API)/src/unsupported.c $(TARGET_UNSUPPORTED)/
67+
#
68+
# Copying licenses
69+
cp $(UVISOR_DIR)/LICENSE* $(TARGET_SUPPORTED)
70+
71+
TARGET_M%: $(TARGET_SUPPORTED)/*/*/*_m%_*.a
72+
@printf "#\n# Copying $@ files...\n"
73+
mkdir $(foreach file,$^,$(dir $(file))$@)
74+
$(foreach file,$^,mv $(file) $(dir $(file))$@/lib$(notdir $(file));)
75+
76+
publish: rsync TARGET_M3 TARGET_M4
77+
#
78+
# Rename release directorires to TARGET_RELEASE filters...
79+
$(foreach dir, $(TARGET_LIST_RELEASE),mv $(dir) $(dir $(dir))TARGET_RELEASE;)
80+
#
81+
# Rename debug directorires to TARGET_DEBUG filters...
82+
$(foreach dir, $(TARGET_LIST_DEBUG),mv $(dir) $(dir $(dir))TARGET_DEBUG;)
83+
#
84+
# Rename target directorires to TARGET_* filters...
85+
$(foreach target, $(TARGET_TRANSLATION),mv $(TARGET_SUPPORTED)/$(subst .,,$(suffix $(target))) $(TARGET_SUPPORTED)/TARGET_$(basename $(target));)
86+
87+
uvisor-compile: $(UVISOR_GIT_CFG)
88+
make -C $(UVISOR_DIR)
89+
90+
update: $(UVISOR_GIT_CFG)
91+
#
92+
# Updating to latest uVisor library version
93+
git -C $(UVISOR_DIR) pull --rebase
94+
#
95+
# Updating checked out version tag
96+
git -C $(UVISOR_DIR) describe --tags --abbrev=40 --dirty > $(TARGET_PREFIX)VERSION.txt
97+
#
98+
# Updated list of authors, sorted by contributions
99+
git -C $(UVISOR_DIR) shortlog -s -n > $(TARGET_PREFIX)AUTHORS.txt
100+
101+
$(UVISOR_GIT_CFG):
102+
rm -rf $(UVISOR_DIR)
103+
git clone -b $(UVISOR_GIT_BRANCH) $(UVISOR_GIT_URL) $(UVISOR_DIR)
104+
105+
clean: $(UVISOR_GIT_CFG)
106+
make -C $(UVISOR_DIR) clean
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Rebuilding the uVisor mbed Library
2+
3+
This directory contains scripts to import and rebuild the latest uVisor library to mbed Classic.
4+
uVisor does not need to be re-deployed for normal application development.
5+
6+
For uVisor development and code contributions please visit the [uVisor repository](https://github.com/ARMmbed/uvisor).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/uvisor
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2013-2016, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef __UVISOR_LIB_UVISOR_LIB_H__
18+
#define __UVISOR_LIB_UVISOR_LIB_H__
19+
20+
/* This file translates mbed-specific pre-processor symbols into
21+
* uVisor-specific ones. Then the main uvisor-lib.h file is included. */
22+
23+
/* By default uVisor is not there. */
24+
#if !defined(UVISOR_PRESENT)
25+
#define UVISOR_PRESENT 0
26+
#endif
27+
28+
/* Detect the target using the mbed-specific symbols and determine the MPU
29+
* architecture accordingly. */
30+
#if defined(TARGET_KINETIS)
31+
#define ARCH_MPU_KINETIS
32+
#else
33+
#define ARCH_MPU_ARMv7M
34+
#endif
35+
36+
/* The uVisor API main header file will use the above definitions. */
37+
#include "uvisor/api/inc/uvisor-lib.h"
38+
39+
#endif /* __UVISOR_LIB_UVISOR_LIB_H__ */
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2016, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#include "mbed.h"
18+
19+
EXTERN void uvisor_disabled_set_vector(uint32_t irqn, uint32_t vector)
20+
{
21+
NVIC_SetVector((IRQn_Type) irqn, vector);
22+
}
23+
24+
EXTERN uint32_t uvisor_disabled_get_vector(uint32_t irqn)
25+
{
26+
return NVIC_GetVector((IRQn_Type) irqn);
27+
}

0 commit comments

Comments
 (0)