forked from canmv-k230/rtsmart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmart-env.sh
executable file
·66 lines (59 loc) · 1.86 KB
/
smart-env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# usage:
# source smart-env.sh [arch]
# example: source smart-env.sh # arm
# example: source smart-env.sh aarch64 # aarch64
# supported arch list
supported_arch="arm aarch64 riscv64 i386"
def_arch="unknown"
# find arch in arch list
if [ -z $1 ]
then
def_arch="arm" # default arch is arm
else
for arch in $supported_arch
do
if [ $arch = $1 ]
then
def_arch=$arch
break
fi
done
fi
# set env
case $def_arch in
"arm")
export RTT_CC=gcc
export RTT_EXEC_PATH=~/.tools/gnu_gcc/arm-linux-musleabi_for_x86_64-pc-linux-gnu/bin
export RTT_CC_PREFIX=arm-linux-musleabi-
cp userapps/configs/def_config_arm userapps/.config
;;
"aarch64")
export RTT_CC=gcc
export RTT_EXEC_PATH=~/.tools/gnu_gcc/aarch64-linux-musleabi_for_x86_64-pc-linux-gnu/bin
export RTT_CC_PREFIX=aarch64-linux-musleabi-
cp userapps/configs/def_config_aarch64 userapps/.config
;;
"riscv64")
export RTT_CC=gcc
export RTT_EXEC_PATH=$(pwd)/../../../toolchain/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin
export RTT_CC_PREFIX=riscv64-unknown-linux-musl-
export RTT_SDK_BUILD_DIR=build
export MPP_SRC_DIR=$(pwd)/../mpp
export CDK_SRC_DIR=$(pwd)/../../common/cdk
cp userapps/configs/def_config_riscv64 userapps/.config
;;
"i386")
export RTT_CC=gcc
export RTT_EXEC_PATH=~/.tools/gnu_gcc/i386-linux-musleabi_for_x86_64-pc-linux-gnu/bin
export RTT_CC_PREFIX=i386-unknown-linux-musl-
;;
*) echo "unknown arch!"
return 1
esac
# export RTT_EXEC_PATH
export PATH=~/.env/tools/scripts:$PATH:$RTT_EXEC_PATH
echo "Arch => ${def_arch}"
echo "CC => ${RTT_CC}"
echo "PREFIX => ${RTT_CC_PREFIX}"
echo "EXEC_PATH => ${RTT_EXEC_PATH}"