forked from WPIRoboticsEngineering/RBE3001_nucleo_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilddeploy
36 lines (27 loc) · 936 Bytes
/
builddeploy
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
#!/bin/bash
compileCommand="mbed-cli compile -j0 -t GCC_ARM -m nucleo_f746zg --source . --source ./mbed-os/features/unsupported/USBDevice/USBDevice/ --source ./mbed-os/features/unsupported/USBDevice/USBHID"
outputFolder=""
if [ -z "$1" ]; then
if pip freeze | grep mbed-greentea ; then
# If no specific directory is defined and greentea is here, do the thing
$compileCommand -f
exit
else
# greentea is not here, so go to default directory
outputFolder="/media/$USER/NUCLEO_*/"
fi
else
# Directory is specified, bypass greentea
outputFolder="$1"
fi
tempFile='builddeploy.tmp'
# Compile the code
$compileCommand | tee "$tempFile"
# Get the binary name from the build output
binary="$(tail -n5 builddeploy.tmp | grep 'Image:' | cut -d " " -f 2)"
echo "Deploying $binary to $outputFolder"
# Clean up
rm -f "$tempFile"
# Deploys the binary to the output folder
cp "$binary" $outputFolder
echo 'Done'