-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathbuild_app.sh
54 lines (49 loc) · 1.27 KB
/
build_app.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
#!/bin/sh
DL_PORT=COM1
DL_BAUD=2000000
COMPILE=gcc
FLASH_SIZE=1M
#./build_app_new.sh test_prj debug
if [ -z "$1" ];then
echo "please input the project folder name !!!"
exit 1
else
if [ ${1: -1} == "/" ]; then
echo "you are so lazy!!!!"
APP_BIN_NAME=${1%/}
else
APP_BIN_NAME=$1
fi
fi
echo ""
echo "start..."
echo ""
if [ -z "$2" ];then
set -e
make -f Makefile.mk clean APP_BIN_NAME=$APP_BIN_NAME;
make -f Makefile.mk COMPILE=$COMPILE APP_BIN_NAME=$APP_BIN_NAME TARGET=$APP_BIN_NAME FLASH_SIZE=$FLASH_SIZE
exit 1
else
if [ $2 == "clean" ]; then
set -e
make -f Makefile.mk clean APP_BIN_NAME=$APP_BIN_NAME;
elif [ $2 == "flash" ]; then
if [ -z "$3" ];then
set -e
make -f Makefile.mk clean APP_BIN_NAME=$APP_BIN_NAME;
make -f Makefile.mk flash COMPILE=$COMPILE \
APP_BIN_NAME=$APP_BIN_NAME TARGET=$APP_BIN_NAME\
DL_PORT=$DL_PORT DL_BAUD=$DL_BAUD FLASH_SIZE=$FLASH_SIZE
else
echo "download..."
set -e
make -f Makefile.mk clean APP_BIN_NAME=$APP_BIN_NAME;
make -f Makefile.mk flash COMPILE=$COMPILE \
APP_BIN_NAME=$APP_BIN_NAME TARGET=$APP_BIN_NAME\
DL_PORT=$3 DL_BAUD=$DL_BAUD FLASH_SIZE=$FLASH_SIZE
fi
else
echo "error app param, you can input clean or flash !!!"
exit 1
fi
fi