-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·67 lines (55 loc) · 1.23 KB
/
entrypoint.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
#!/bin/bash
# inputs
in_files=$1;
in_outdir=$2;
in_format=$3;
if [ -z $PIOASM ]; then
echo "pioasm binary is missing";
exit 1;
fi
if [ -z $in_files ]; then
echo "no input files specified";
exit 1;
fi
# if $outdir is empty, set outpath to current dir of piofile
if [ -z $in_outdir ]; then
outdir=".";
echo "output directory not given; defaulting to current directory";
else
outdir=$in_outdir;
fi
# set proper extension
case $in_format in
c-sdk)
ext="h";
;;
python)
ext="py";
;;
hex)
ext="hex";
;;
ada)
ext="ada";
;;
*)
echo "pioasm output format unknown or invalid";
exit 1;
;;
esac
echo "pioasm located at $PIOASM";
echo "Looking for files in $in_files";
echo "Using format $in_format with extension $ext";
echo "Writing to $outdir";
# make sure destination exists
mkdir -p "$outdir";
for piofile in $in_files; do
if [ ! -f "$piofile" ]; then
echo "$piofile not found; skipping";
continue;
fi
dest="$outdir/$(basename $piofile).$ext";
"$PIOASM" -o "$in_format" "$piofile" "$dest";
echo "pioasm assembled file written to $dest";
done
echo "finished assembling pio files";