forked from jlhonora/mspgcc-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-all
executable file
·122 lines (111 loc) · 3.13 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
#/usr/bin/env bash
# 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
}
# Installation path. This will overwrite your
# changes to the INSTALL_PATH folder
INSTALL_PATH=/usr/local/msp430
# get LTS mspgcc
wget http://sourceforge.net/projects/mspgcc/files/mspgcc/DEVEL-4.7.x/mspgcc-20120911.tar.bz2
tar xvf mspgcc-20120911.tar.bz2
cd mspgcc-20120911
#binutils
echo "Downloading binutils"
wget ftp://ftp.gnu.org/pub/gnu/binutils/binutils-2.22.tar.bz2
echo "Extracting binutils"
tar xjf binutils-2.22.tar.bz2
echo "Installing binutils"
( cd binutils-2.22 ; patch -p1 < ../msp430-binutils-2.22-20120911.patch )
mkdir -p BUILD/binutils
cd BUILD/binutils
../../binutils-2.22/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 "Downloading gcc"
wget ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.7.0/gcc-4.7.0.tar.bz2
echo "Extracting gcc"
tar xjf gcc-4.7.0.tar.bz2
echo "Installing gcc"
cd gcc-4.7.0
patch -p1 < ../msp430-gcc-4.7.0-20120716.patch
patch -p1 < ../msp430-gcc-4.7.0-20120911.patch
cd ..
mkdir -p BUILD/gcc
cd BUILD/gcc
../../gcc-4.7.0/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 "Downloading gdb"
wget 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 )
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"
wget 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"
wget https://sourceforge.net/projects/mspgcc/files/msp430-libc/msp430-libc-20120716.tar.bz2
echo "Extracting libc"
tar xvf msp430-libc-20120716.tar.bz2
echo "Installing libc"
cd msp430-libc-20120716
./configure --prefix=$INSTALL_PATH
cd src/
make | tee mo
# Fix route to msp430-gcc so that sudo recognizes it
#sed -i 's/override.*= \(msp430-gcc\)/$(bindir)\/\1/' Makefile
#sed -i 's/override.*= \(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 ..
PATH=$OLDPATH
echo "Done installing, installed at $INSTALL_PATH"