forked from noccy80/mspdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·133 lines (124 loc) · 3.74 KB
/
start.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
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
#!/bin/bash
function get_distro() {
echo -n "Determining distribution ... "
DISTRO="linux/unknown"
uname -v | grep -i ubuntu &>/dev/null && DISTRO="linux/debian"
uname -v | grep -i debian &>/dev/null && DISTRO="linux/debian"
}
get_distro
echo "`basename $0` ($DISTRO)"
echo
echo "Hello, and welcome to the mspdev quickstarter!"
echo
echo "This script will get everything going for you in just a few short steps."
echo
echo "You will be prompted for each step. Answer the question with a lowercase 'y' to"
echo "complete the specified step. Any other key will skip it."
echo
echo
echo "== CLEAN EVERYTHING =========================================================="
echo
echo " This will clear all temporary build files."
echo
echo -n " Clean everything [y/n]? "
read ans
if [ "$ans" == "y" ]; then
echo " Building..."
pushd lib430; ./clean.sh; popd
pushd examples/blink; make clean; popd
pushd examples/libarduino; make clean; popd
pushd examples/blink; make clean; popd
echo 'All done!'
fi
echo
if [ "`which msp430-gcc`" == "" ]; then
echo
echo "== INSTALL MSP430-GCC AND MSPDEBUG ==========================================="
echo
echo " This is the environmen, msp430-gcc. This needs for you to have downthemall"
echo " for php installed, which in turn depends on lepton. Saying y here is likely"
echo " to fail."
echo
echo -n " Install helpers [y/n]? "
read ans
if [ "$ans" == "y" ]; then
case "$DISTRO" in
"linux/debian")
echo " Downloading msp430-gcc into tools/.cache ..."
pushd tools
ARCH="`uname -i`"
test -d .cache || mkdir .cache
cd .cache
curl -o mspdev-$ARCH.tgz "http://files.noccylabs.info/mspdev-$ARCH.tgz"
cd ..
sudo apt-get -y install mspdebug
sudo dpkg -i .cache/$ARCH/binutils-msp430_*.deb .cache/$ARCH/gcc-msp430_*-1_*.deb .cache/$ARCH/gdb-msp430_*.deb .cache/$ARCH/msp430-libc_*.deb
sudo apt-get -f install
popd
;;
"unknown")
echo "Sorry, unknown platform"
;;
esac
fi
fi
echo
echo "== INSTALL HELPERS ==========================================================="
echo
echo " The helpers consist of:"
echo " - msp430-comm - quick serial comm setup thingie"
echo " - msp430-findfeat - find devices with specific features"
echo " - msp430-identify - outputs the mcu type of the attached device"
echo
echo -n " Install helpers [y/n]? "
read ans
if [ "$ans" == "y" ]; then
echo " Installing..."
if [ ! -d "~/bin" ]; then
mkdir -p ~/bin
export PATH="~/bin:$PATH"
fi
for bin in msp430-comm msp430-findfeat msp430-identify; do
rm -rf ~/bin/$bin
cp ./tools/$bin ~/bin/$bin
done
fi
echo
echo "== BUILD LIB430 =============================================================="
echo
echo " This will build lib430 for the devices listed in the MCUS file. if this file"
echo " does not exist, it will be created from the MCUS.example file. This is a good"
echo " thing to do. Just remember to rebuild it with the buildall.sh script when the"
echo " source has been updated."
echo
echo -n " Build lib430 [y/n]? "
read ans
if [ "$ans" == "y" ]; then
if [ ! -e "lib430/MCUS" ]; then
echo " Installing MCUS.example as MCUS..."
cp lib430/MCUS.example lib430/MCUS
fi
echo " Building..."
pushd lib430
./buildall.sh
popd
fi
echo
echo
echo "== BUILD EXAMPLES ============================================================"
echo
echo " This will build the examples for the microcontroller that is attached on the"
echo " launchpad via usb. It will then program the blink example onto the device."
echo
echo ' MAKE SURE THAT YOUR LAUNCHPAD IS ATTACHED BEFORE CONTINUING!'
echo
echo -n " Build examples [y/n]? "
read ans
if [ "$ans" == "y" ]; then
echo " Building..."
pushd examples/blink; make bin; popd
pushd examples/libarduino; make bin; popd
pushd examples/blink; make prog; popd
echo 'All done!'
fi
echo