Skip to content

Instantly share code, notes, and snippets.

@matthewfl
Created September 27, 2009 07:38
Show Gist options
  • Save matthewfl/194655 to your computer and use it in GitHub Desktop.
Save matthewfl/194655 to your computer and use it in GitHub Desktop.
vex linux build file
#!/bin/bash
files=( main ) # should be file name without suffix, suffix should be .c
target="program"
setting="-D_VEX_BOARD"
if [ -z $1 ]
then
echo "$0 [build | download | clean]"
exit
fi
function clean {
echo ">clean"
for file in ${files[@]}
do
rm -f $file.o $file.err $file.i
done
rm -f $target*
}
if [ $1 == "build" ]
then
clean
echo ">build"
link=""
for file in ${files[@]}
do
echo ">Compiling file $file"
#"-I=C:\\Program Files\\Intelitek\\easyC Pro\\#Tools\\Vex\\API\\"
wine C:\\Mcc18\\bin\\mcc18.exe -p=18F8520 $file.c -fo=$file.o -I=. -I=C:\\Mcc18\\h\\ -I=C:\\WPILib\\Vex\\ -Oi+ $setting
if [ $? -ne 0 ]
then
echo "failed on file $file"
exit
fi
link+="$file.o "
done
echo ">link"
wine C:\\Mcc18\\bin\\mplink.exe /lC:\\Mcc18\\lib "C:\\Program Files\\Intelitek\\easyC Pro\\#Tools\\Vex\\18F8520\\18f8520.lkr" $link \
C:\\WPILib\\Vex\\Vex_library.lib C:\\WPILib\\Vex\\WPILibVex.lib /o$target.out
fi
if [ $1 == "download" ]
then
echo ">download"
wine "C:\\Program Files\\Intelitek\\easyC Pro\\#Tools\\Loader\\iLoader.exe" $target.hex
fi
if [ $1 == "clean" ]
then
clean
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment