parent
6da5c4c144
commit
fb0ff98d6e
@ -1,61 +1,91 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
CSL_TO_USE=$1
|
CSL_TO_USE=$1
|
||||||
FILE=../build
|
|
||||||
|
|
||||||
cd env
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
if [ -z "$CSL_TO_USE" ];then
|
FILE=$SCRIPT_DIR/../ked_build
|
||||||
echo "Please enter a CSL"
|
cd $SCRIPT_DIR/env
|
||||||
cd csl
|
|
||||||
echo Curretnly awailable CSL are :
|
|
||||||
|
|
||||||
for d in */ ; do #Cheking the directory to print files
|
|
||||||
if [ "$d" != "csl/" ];then #Exept csl/
|
|
||||||
echo -e "\t|--> $d" | grep -oP '.*?(?=\/)' #And remove the finel "/"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
if [ -d "$FILE" ];then
|
|
||||||
rm -r $FILE
|
build()
|
||||||
cmake -S . -B $FILE -DCSL_USED=$CSL_TO_USE
|
{
|
||||||
|
if [ -z "$CSL_TO_USE" ];then
|
||||||
|
echo "Please enter a CSL"
|
||||||
|
cd csl
|
||||||
|
echo Curretnly awailable CSL are :
|
||||||
|
|
||||||
|
for d in */ ; do #Cheking the directory to print files
|
||||||
|
if [ "$d" != "csl/" ];then #Exept csl/
|
||||||
|
echo -e "\t|--> $d" | grep -oP '.*?(?=\/)' #And remove the finel "/"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
cmake -S . -B $FILE -DCSL_USED=$CSL_TO_USE
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $FILE
|
if [ -d "$FILE" ];then
|
||||||
make -j4
|
rm -r $FILE
|
||||||
|
cmake -S . -B $FILE -DCSL_USED=$CSL_TO_USE
|
||||||
|
else
|
||||||
|
cmake -S . -B $FILE -DCSL_USED=$CSL_TO_USE
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $FILE
|
||||||
|
make -j4
|
||||||
|
|
||||||
if [ "$CSL_TO_USE" == "raspberry" ];then
|
if [ "$CSL_TO_USE" == "raspberry" ];then
|
||||||
echo -e "\e[36m"
|
echo -e "\e[36m"
|
||||||
echo "+--------------------------------------+"
|
echo "+--------------------------------------+"
|
||||||
echo -e "\tExecuting $CSL_TO_USE"
|
echo -e "\tExecuting $CSL_TO_USE"
|
||||||
echo "+--------------------------------------+"
|
echo "+--------------------------------------+"
|
||||||
echo -e "\e[32m"
|
echo -e "\e[32m"
|
||||||
|
|
||||||
./$CSL_TO_USE
|
./$CSL_TO_USE
|
||||||
|
|
||||||
echo -e "\e[36m"
|
echo -e "\e[36m"
|
||||||
echo "+--------------------------------------+"
|
echo "+--------------------------------------+"
|
||||||
echo -e "\tExecution Terminated"
|
echo -e "\tExecution Terminated"
|
||||||
echo "+--------------------------------------+"
|
echo "+--------------------------------------+"
|
||||||
echo -e "\e[32m"
|
echo -e "\e[32m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$CSL_TO_USE" == "stm32f042" ];then
|
||||||
|
echo -e "\e[36m"
|
||||||
|
echo "+--------------------------------------+"
|
||||||
|
echo -e "\tFlashing $CSL_TO_USE"
|
||||||
|
echo "+--------------------------------------+"
|
||||||
|
echo -e "\e[32m"
|
||||||
|
|
||||||
if [ "$CSL_TO_USE" == "stm32f042" ];then
|
st-flash write $CSL_TO_USE.bin 0x08000000
|
||||||
echo -e "\e[36m"
|
|
||||||
echo "+--------------------------------------+"
|
|
||||||
echo -e "\tFlashing $CSL_TO_USE"
|
|
||||||
echo "+--------------------------------------+"
|
|
||||||
echo -e "\e[32m"
|
|
||||||
|
|
||||||
st-flash write $CSL_TO_USE.bin 0x08000000
|
echo -e "\e[36m"
|
||||||
|
echo "+--------------------------------------+"
|
||||||
|
echo -e "\tFlashing has Finished"
|
||||||
|
echo "+--------------------------------------+"
|
||||||
|
echo -e "\e[32m"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
echo -e "\e[36m"
|
autoInit()
|
||||||
echo "+--------------------------------------+"
|
{
|
||||||
echo -e "\tFlashing has Finished"
|
if [[ -f "../main.c" ]];then
|
||||||
echo "+--------------------------------------+"
|
if [[ -f "../main.h" ]];then
|
||||||
echo -e "\e[32m"
|
build
|
||||||
|
else
|
||||||
|
echo "Main.h is not found"
|
||||||
|
echo "Creating sample project"
|
||||||
|
cp $SCRIPT_DIR/examples/autoInit/main.* $SCRIPT_DIR/../
|
||||||
|
build
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Main.c is not fount"
|
||||||
|
echo "Creating sample project"
|
||||||
|
cp $SCRIPT_DIR/examples/autoInit/main.* $SCRIPT_DIR/../
|
||||||
|
build
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
autoInit
|
||||||
|
|
||||||
|
Loading…
Reference in new issue