forked from progmem/Switch-Fightstick
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate_builds.sh
executable file
·42 lines (35 loc) · 1.21 KB
/
generate_builds.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
#!/usr/bin/env bash
# This is my script to generate builds for common avr boards used in the community.
# Yes, most of the builds are identical. It is to avoid confusion/complaints.
DIR=builds # directory to save this all in
ADDR=0x51 # i2c address
PREFIX=Switch-I2C
FLAGS=-j4 # make flags
PULLUPS=1 # 1 for enabled
clean() {
rm -f -r $DIR # delete directory and all contents
mkdir -p $DIR # generate it back
}
final_clean() {
rm -f -r obj/
}
generate() {
# $1 = TARGET
# $2 = MCU
# $3 = F_CPU
# $4 = I2C_ADDRESS
# $5 = I2C_PULLUPS (1 for enabled, 0 for not)
make $FLAGS TARGET=$1 MCU=$2 F_CPU=$3 I2C_ADDRESS=$4 I2C_PULLUPS=$5 # generate file
mv $1.hex $DIR # move completed hex file to build directory
make clean $FLAGS TARGET=$1 MCU=$2 F_CPU=$3 I2C_ADDRESS=$4 I2C_PULLUPS=$5 # clean up the build
}
main() {
clean
generate ${PREFIX}_Teensy++2.0_$ADDR at90usb1286 16000000 $ADDR $PULLUPS
generate ${PREFIX}_Teensy2.0_$ADDR atmega32u4 16000000 $ADDR $PULLUPS
generate ${PREFIX}_ProMicro5_$ADDR atmega32u4 16000000 $ADDR $PULLUPS
generate ${PREFIX}_ProMicro3.3_$ADDR atmega32u4 8000000 $ADDR $PULLUPS
generate ${PREFIX}_Leonardo_$ADDR atmega32u4 16000000 $ADDR $PULLUPS
final_clean
}
main