forked from RFD-FHEM/SIGNALDuino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·44 lines (37 loc) · 1.61 KB
/
build.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
#!/bin/bash
#set -e
while test $# -gt 0
do
case "$1" in
BOARD*)
export BOARD=`echo $1 | cut -d= -f2`
;;
RECEIVER*)
export RECEIVER=`echo $1 | cut -d= -f2`
;;
*) echo "got argument $1"
;;
esac
shift
done
if [ "${RECEIVER}" = "cc1101" ]; then
echo "compiler.cpp.extra_flags=-DOTHER_BOARD_WITH_CC1101=1" > /usr/local/share/arduino/hardware/arduino/avr/platform.local.txt
find ~/.arduino15/packages/ -type f -name platform.txt | xargs dirname | xargs -I{} bash -c 'echo "compiler.cpp.extra_flags=-DOTHER_BOARD_WITH_CC1101=1" > $1/platform.local.txt' -- {}
fi
if [ "${BOARD}" = "nano328" ]; then
arduino --board arduino:avr:nano:cpu=atmega328 --save-prefs 2>&1
elif [ "${BOARD}" = "minicul" ]; then
echo "compiler.cpp.extra_flags=-DARDUINO_ATMEGA328P_MINICUL=1" > /usr/local/share/arduino/hardware/arduino/avr/platform.local.txt
arduino --board arduino:avr:pro:cpu=8MHzatmega328 --save-prefs 2>&1
elif [ "${BOARD}" = "promini" ]; then
arduino --board arduino:avr:pro:cpu=8MHzatmega328 --save-prefs 2>&1
elif [ "${BOARD}" = "radino" ]; then
echo "compiler.cpp.extra_flags=-DARDUINO_AVR_ICT_BOARDS_ICT_BOARDS_AVR_RADINOCC1101=1" > /usr/local/share/arduino/hardware/arduino/avr/platform.local.txt
arduino --install-boards "In-Circuit:avr" 2>&1
arduino --board In-Circuit:avr:radinoCC1101 --save-prefs 2>&1
fi
echo "Compile now for ${BOARD} with ${RECEIVER}"
arduino -v --verbose-build --verify $PWD/src/arduino-ide/SIGNALDuino/SIGNALDuino.ino 2>&1
ARDUINO_RETURN_CODE=$?
echo "Compile ${BOARD} ${RECEIVER} finshed"
exit $ARDUINO_RETURN_CODE