forked from HearthHouse/watergate
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmake.sh
executable file
·37 lines (31 loc) · 1.17 KB
/
make.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
#!/bin/bash
# stats for the uno from http://arduino.cc/en/uploads/Main/boards.txt
MCU=atmega328p
F_CPU=16000000
if test -n "$1"; then
PORT=$1
elif test -c /dev/ttyACM0; then
PORT=/dev/ttyACM0
fi
ROOT=$(cd `dirname $0`; pwd)
mkdir -p $ROOT/build
rm -f $ROOT/build/*
ARDUINO_ROOT=/usr/share/arduino
ARDUINO_PATH=$ARDUINO_ROOT/hardware/arduino/cores/arduino
VARIANTS_PATH=$ARDUINO_ROOT/hardware/arduino/variants/standard
CORE_SOURCES=`echo $ARDUINO_PATH/{main.cpp,wiring*.c,WInterrupts.c,\
{WMath,WString,Print,HardwareSerial,IPAddress}.cpp}`
avr-c++ -o $ROOT/build/main.elf -x c++ \
$ROOT/hottube.ino \
<(echo 'extern "C" void __cxa_pure_virtual() { while(1); }') \
$CORE_SOURCES \
$PWD/vendor/OneWire/OneWire.cpp \
$ARDUINO_ROOT/libraries/Ethernet/{*,utility/*}.cpp \
$ARDUINO_ROOT/libraries/SPI/SPI.cpp \
-D F_CPU=$F_CPU -D ARDUINO=110 -mmcu=$MCU \
-I $PWD/vendor/OneWire \
-I $ARDUINO_PATH -I $VARIANTS_PATH \
`find $ARDUINO_ROOT/libraries -type d | sed 's/^/-I /'` \
-ffunction-sections -fdata-sections -w \
&& avr-objcopy -O ihex -R .eeprom $ROOT/build/main.elf $ROOT/build/main.hex \
&& avrdude -p$MCU -P$PORT -carduino -b115200 -U flash:w:$ROOT/build/main.hex:i