-
Notifications
You must be signed in to change notification settings - Fork 12
/
install-all
executable file
·169 lines (154 loc) · 4.99 KB
/
install-all
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#/usr/bin/env bash
# Installs msp430-gcc and friends
# JLH 2013
# A simple (and sometimes buggy) error checking tool
check_for_errors(){
echo "$1" | tail
if [ -n "$1" ]
then
echo "There seems to be errors, exiting"
exit
else
echo "All OK"
fi
}
# Checks if a given file exists.
# if it does not, then it downloads it
# from the web. Must be given the filename
# as first argument and the url as the second
# argument.
check_or_download() {
if [ ! -f $1 ]
then
echo "$1 does not exist, downloading."
wget "$2" --no-check-certificate
else
echo -n "$1 exists, will not re-download. Consider "
echo "removing it if you want a clean install"
fi
}
# Installation path. This will overwrite your
# changes to the INSTALL_PATH folder
INSTALL_PATH=/usr/local/msp430
# get LTS mspgcc
check_or_download mspgcc-20120406.tar.bz2 \
http://sourceforge.net/projects/mspgcc/files/mspgcc/mspgcc-20120406.tar.bz2
tar xvf mspgcc-20120406.tar.bz2
cd mspgcc-20120406
#binutils
echo "binutils"
check_or_download binutils-2.21.1a.tar.bz2 \
ftp://ftp.gnu.org/pub/gnu/binutils/binutils-2.21.1a.tar.bz2
echo "Extracting binutils"
tar xjf binutils-2.21.1a.tar.bz2
echo "Installing binutils"
( cd binutils-2.21.1 ; patch -p1 < ../msp430-binutils-2.21.1a-20120406.patch )
( cd binutils-2.21.1 ; patch -p1 < ../../texinfo-5-fixes.patch )
mkdir -p BUILD/binutils
cd BUILD/binutils
../../binutils-2.21.1/configure \
--target=msp430 \
--prefix=$INSTALL_PATH \
2>&1 | tee co
make 2>&1 | tee mo
sudo make install 2>&1 | tee moi
echo "Done with binutils"
errors=`cat co mo moi | grep "Error [0-9]"`
check_for_errors "$errors"
cd ../../
#gcc
echo "gcc"
check_or_download gcc-4.6.3.tar.bz2 \
ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.6.3/gcc-4.6.3.tar.bz2
check_or_download msp430-gcc-4.6.3-20120406-sf3540953.patch \
http://sourceforge.net/projects/mspgcc/files/Patches/LTS/20120406/msp430-gcc-4.6.3-20120406-sf3540953.patch
check_or_download msp430-gcc-4.6.3-20120406-sf3559978.patch \
http://sourceforge.net/projects/mspgcc/files/Patches/LTS/20120406/msp430-gcc-4.6.3-20120406-sf3559978.patch
echo "Extracting gcc"
tar xjf gcc-4.6.3.tar.bz2
echo "Installing gcc"
cd gcc-4.6.3
cd contrib
echo "Downloading prerequisites"
./download_prerequisites
cd ..
patch -p1 < ../msp430-gcc-4.6.3-20120406.patch
patch -p1 < ../msp430-gcc-4.6.3-20120406-sf3540953.patch
patch -p1 < ../msp430-gcc-4.6.3-20120406-sf3559978.patch
patch -p1 < ../../texinfo-5-fixes-gcc.patch
patch -p1 < ../../ira-int-fix.patch
sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure
cd ..
mkdir -p BUILD/gcc
cd BUILD/gcc
../../gcc-4.6.3/configure \
--target=msp430 \
--enable-languages=c,c++ \
--prefix=$INSTALL_PATH \
2>&1 | tee co
make 2>&1 | tee mo
sudo make install 2>&1 | tee moi
echo "Done with gcc"
errors=`cat co mo moi | grep "Error [0-9]"`
check_for_errors "$errors"
cd ../../
#gdb
echo "gdb"
check_or_download gdb-7.2a.tar.bz2 \
ftp://ftp.gnu.org/pub/gnu/gdb/gdb-7.2a.tar.bz2
echo "Extracting gdb"
tar xjf gdb-7.2a.tar.bz2
echo "Installing gdb"
( cd gdb-7.2 ; patch -p1 < ../msp430-gdb-7.2a-20111205.patch )
( cd gdb-7.2 ; patch -p1 < ../../bfdio-fixes.patch )
( cd gdb-7.2 ; patch -p1 < ../../texinfo-5-fixes-gdb.patch )
mkdir -p BUILD/gdb
cd BUILD/gdb
../../gdb-7.2/configure \
--target=msp430 \
--prefix=$INSTALL_PATH \
2>&1 | tee co
make 2>&1 | tee mo
sudo make install 2>&1 | tee moi
echo "Done with gdb"
errors=`cat co mo moi | grep "Error [0-9]"`
check_for_errors "$errors"
cd ../../
#msp430-mcu
echo "Downloading msp430mcu"
check_or_download msp430mcu-20130321.tar.bz2 \
http://sourceforge.net/projects/mspgcc/files/msp430mcu/msp430mcu-20130321.tar.bz2
echo "Extracting msp430mcu"
tar xvf msp430mcu-20130321.tar.bz2
cd msp430mcu-20130321
echo "Installing msp430mcu"
sudo MSP430MCU_ROOT=`pwd` ./scripts/install.sh $INSTALL_PATH | tee so
cd ..
OLDPATH=$PATH
export PATH=$INSTALL_PATH/bin:$PATH
#libc
echo "Downloading libc"
check_or_download msp430-libc-20120224.tar.bz2 \
https://sourceforge.net/projects/mspgcc/files/msp430-libc/msp430-libc-20120224.tar.bz2
check_or_download msp430-libc-20120224-sf3522752.patch \
http://sourceforge.net/projects/mspgcc/files/Patches/LTS/20120406/msp430-libc-20120224-sf3522752.patch
echo "Extracting libc"
tar xvf msp430-libc-20120224.tar.bz2
echo "Installing libc"
cd msp430-libc-20120224
patch -p1 < ../msp430-libc-20120224-sf3522752.patch
./configure --prefix=$INSTALL_PATH
cd src/
make | tee mo
# Fix route to msp430-gcc so that sudo recognizes it
sed -i 's/\(msp430-gcc\)/$(bindir)\/\1/' Makefile
sed -i 's/\(msp430-ar\)/$(bindir)\/\1/' Makefile
sudo make PREFIX=$INSTALL_PATH install | tee mio
echo "Done with libc"
errors=`cat mo mio | grep "Error [0-9]"`
check_for_errors "$errors"
cd ..
# The crt0.S file seems to be missing when running gdb
# ./gdb_crt0_fix
PATH=$OLDPATH
echo "Done installing, installed at $INSTALL_PATH"