Repository navigation
Expand file tree
/
Copy pathBuildOneUnix.sh
More file actions
executable file
·58 lines (48 loc) · 1.55 KB
/
Copy pathBuildOneUnix.sh
File metadata and controls
executable file
·58 lines (48 loc) · 1.55 KB
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
#!/usr/bin/env bash
# NOTE: this script is a helper script that *should not be called directly*
# please use the scripts provided in the root of this directory
# get the MCU from the first argument
# define the MCU
board=$1
if [ -z "$board" ]; then
read -p 'No MCU Type given, please enter: ' board
fi
# get the program from the second argument
program=$2
if [ -z "$program" ]; then
read -p 'No program given, please enter: ' program
fi
# delete the existing hex program if it exists
if [ -f "$program.hex" ]; then
rm $program.hex
fi
# Allows running a cleanup. Adding for the MacOS port of the GUI
# while maintaining compatibility with the CLI scripts
gui=$3
if [[ $gui == "gui" ]]; then
obj_files=obj/*.o
if [[ ! -z $obj_files ]]; then
echo "Existing build found. Checking MCU compatibility."
if [[ ! -f "obj/build-$MCU" ]]; then
echo "Incompatible MCU, cleaning..."
bash 00-CleanupUnix.sh
else
echo "Existing build is compatible."
fi
else
echo "No build found, continuing..."
fi
fi
# then call make
make BOARD_TYPE="$board" TARGET="$program"
# then we can clean up the map, eep, bin, lss, sym, tmp
rm $program.map > /dev/null 2>&1
rm $program.eep > /dev/null 2>&1
rm $program.bin > /dev/null 2>&1
rm $program.lss > /dev/null 2>&1
rm $program.sym > /dev/null 2>&1
rm $program.elf > /dev/null 2>&1
# Also putting this behind the gui-wall
if [[ $gui == "gui" ]]; then
mv "$program.hex" "../$program-$board.hex"
fi