prepare_and_copy_to_master.sh 916 Bytes
Newer Older
1 2 3
#!/bin/bash

#HOWTO:
4
#  Args: BUILD_DIR OUTPUT PROJECT_NAME NANOTEC_BASE_PATH NANOTEC_TOOLS_DIR PATH_EM5 GCC_PATH
5 6 7 8 9 10 11

BUILD_DIR=$1
OUTPUT=$2
PROJECT_NAME=$3
NANOTEC_BASE_PATH=$4
NANOTEC_TOOLS_DIR=$5
PATH_EM5=$6
12
OUTPUT_NAME=$7
13 14

echo -e "[\033[94mobjcopy\033[0m]"
15
$GCC_PATH/bin/arm-none-eabi-objcopy -O binary $BUILD_DIR/bin/$OUTPUT $BUILD_DIR/bin/$PROJECT_NAME.emp
16 17 18
echo -e "[\033[94mstm32crc\033[0m]"
./$NANOTEC_BASE_PATH/$NANOTEC_TOOLS_DIR/stmcrc32.x $BUILD_DIR/bin/$PROJECT_NAME.emp a
echo -e "[\033[94mrenaming\033[0m]"
19
mv -v $BUILD_DIR/bin/$PROJECT_NAME.emp $BUILD_DIR/bin/$OUTPUT_NAME
20 21 22
echo -e "[\033[94mcopying to master\033[0m]"
#mount -v $PATH_EM5
if (mount -v $PATH_EM5) then
23
		cp -v $BUILD_DIR/bin/$OUTPUT_NAME $PATH_EM5/progs/$OUTPUT_NAME
24 25 26 27 28 29 30 31
		echo -e "[\033[94msyncing\033[0m]"
		sync 
		umount -v $PATH_EM5
		echo -e "[\033[94mdone\033[0m]"
	else 
		(>&2 echo -e "[\033[31mnot able to mount EM5\033[0m]")
		
fi