-
Notifications
You must be signed in to change notification settings - Fork 11
/
build-avr-toolchain.sh
executable file
·97 lines (76 loc) · 2.79 KB
/
build-avr-toolchain.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
#/usr/bin/sh
###############################################################################
## ##
## Script to build GCC toolchain for Atmel AVR Microcontroller ##
## ##
##---------------------------------------------------------------------------##
## File: build-avr-toolchain.sh ##
## Author: Ulrich Becker <u.becker@gsi.de> ##
## Company: GSI Helmholtz Centre for Heavy Ion Research GmbH ##
## Date: 23.10.2018 ##
## Revision: ##
###############################################################################
TARGET="avr"
ENABLE_CPP=true
if [ ! -n "$VERSION_CONFIG_FILE" ]
then
VERSION_CONFIG_FILE="./gcc_versions.conf"
fi
if [ ! -n "$GCC_VERSION" ]
then
source $VERSION_CONFIG_FILE
fi
AVR_LIBC_URL="http://download.savannah.gnu.org/releases/avr-libc/avr-libc-${AVR_LIBC_VERSION}.tar.bz2"
AVR_DUDE_URL="http://download.savannah.gnu.org/releases/avrdude/avrdude-${AVR_DUDE_VERSION}.tar.gz"
AVR_SIMULAVR_URL="http://download.savannah.nongnu.org/releases/simulavr/simulavr-${AVR_SIMULAVR_VERSION}.tar.gz"
make_avr_libc()
{
local oldDir=$(pwd)
local avrLibCdir=${SOURCE_DIR}/avr-libc-${AVR_LIBC_VERSION}
cd ${avrLibCdir}
./configure --prefix=$PREFIX --build=$(./config.guess) --host=$TARGET 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
make 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
make install 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
cd $oldDir
}
make_simul_avr()
{
#TODO configure: error:
# Could not locate libbfd.so/libbfd.a and/or bfd.h.
# Please use the --with-bfd=<path to your libbfd library>
local oldDir=$(pwd)
local simulAvrDir=${SOURCE_DIR}/simulavr-${AVR_SIMULAVR_VERSION}
cd ${simulAvrDir}
./configure --prefix=$PREFIX 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
make 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
make install 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
cd $oldDir
}
make_avr_dude()
{
local oldDir=$(pwd)
local avrDudeDir=${SOURCE_DIR}/avrdude-${AVR_DUDE_VERSION}
cd ${avrDudeDir}
./configure --prefix=$PREFIX 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
make 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
make install 2>${ERROR_LOG_FILE}
[ "$?" != "0" ] && end 1
cd $oldDir
}
make_third_stage()
{
[ $VERBOSE ] && echo "INFO: Entering third stage."
make_avr_libc
# make_simul_avr
make_avr_dude
}
source build-toolchain.sh
#=================================== EOF ======================================