-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·69 lines (60 loc) · 1.84 KB
/
init.sh
File metadata and controls
executable file
·69 lines (60 loc) · 1.84 KB
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
67
68
69
############################################################################
# The MIT License (MIT)
#
# Copyright (c) 2016 Bertrand Martel
#
############################################################################
#!/bin/bash
#title : init.sh
#author : Bertrand Martel
#date : 31/01/2015
#description : extract toolchain / check build cmds
############################################################################
function check_exists {
if [ ! -f "$1" ]; then
echo -ne "\x1B[31m"
echo "[ ERROR ] $1 is missing"
echo -ne "\x1B[0m"
exit 1
fi
}
echo -ne "\x1B[0m"
echo "checking toolchain"
RFDUINO_DIR=./RFduino
TOOLCHAIN_DIR=./toolchain/gcc-arm-none-eabi-4.8.3-2014q1
TOOLCHAIN_BIN_DIR=${TOOLCHAIN_DIR}/bin
TOOLCHAIN_AR=./toolchain/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz
if [ ! -d ${RFDUINO_DIR} ]; then
echo -ne "\x1B[31m"
echo "[ ERROR ] RFduino directory is missing"
echo -ne "\x1B[0m"
exit 1
fi
if [ ! -d ${TOOLCHAIN_DIR} ]; then
if [ ! -f ${TOOLCHAIN_AR} ]; then
echo -ne "\x1B[31m"
echo "[ ERROR ] toolchain archive is missing"
echo "[ ERROR ] execute > wget -P ./toolchain http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz"
echo -ne "\x1B[0m"
exit 1
else
echo "extracting toolchain"
tar -xvzf ${TOOLCHAIN_AR} -C ./toolchain/
fi
fi
GCC=${TOOLCHAIN_BIN_DIR}/arm-none-eabi-gcc
ELF2HEX=${TOOLCHAIN_BIN_DIR}/arm-none-eabi-g++
GXX=${TOOLCHAIN_BIN_DIR}/arm-none-eabi-g++
AR=${TOOLCHAIN_BIN_DIR}/arm-none-eabi-ar
OBJCOPY=${TOOLCHAIN_BIN_DIR}/arm-none-eabi-objcopy
ELF2HEX_COPY=${TOOLCHAIN_BIN_DIR}/arm-none-eabi-objcopy
SIZE=${TOOLCHAIN_BIN_DIR}/arm-none-eabi-size
LOADER=${RFDUINO_DIR}/RFDLoader_linux
check_exists ${GCC}
check_exists ${ELF2HEX}
check_exists ${GXX}
check_exists ${AR}
check_exists ${OBJCOPY}
check_exists ${ELF2HEX_COPY}
check_exists ${SIZE}
check_exists ${LOADER}