-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.bash
84 lines (70 loc) · 1.33 KB
/
build.bash
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
if [ $# -ne 0 -a $# -ne 1 -a $# -ne 2 ]
then
echo "Usage: $0 {all|test|clean} [test_config]"
echo "test_config:fifo or rr or default"
exit 1
fi
OPT=${1}
if [ $# -eq 0 ]
then
OPT="all"
fi
if [ ${OPT} = "clean" ]
then
rm -rf ./Third_Party/FreeRTOS
else
bash Third_Party/download.bash
fi
cd cmake-build
if [ ${OPT} = "clean" ]
then
rm -rf ./*
exit 0
fi
if [ ${OPT} = "test" ]
then
cmake -D test=true -D debug=true -D gcov=true ..
else
cmake -D debug=true -D gcov=true ..
fi
function do_test()
{
cd ..
test_config=${1}
echo "test_config=${test_config}"
cp src/config/cmsis_config.h test/config/cmsis_config_org.h
if [ "${test_config}" = "fifo" ]
then
cp test/config/cmsis_config_sched_fifo.h src/config/cmsis_config.h
elif [ "${test_config}" = "rr" ]
then
cp test/config/cmsis_config_sched_rr.h src/config/cmsis_config.h
else
cp test/config/cmsis_config_sched_default.h src/config/cmsis_config.h
fi
cd cmake-build
make
make test
cd ..
mv test/config/cmsis_config_org.h src/config/cmsis_config.h
cd cmake-build
}
if [ ${OPT} = "test" ]
then
if [ $# -eq 2 ]
then
TEST_CONFIG=${2}
do_test ${TEST_CONFIG}
else
do_test "default"
fi
cd src/CMakeFiles/cmsis.dir/api
lcov -c -d . -o lcov.info
genhtml lcov.info -o ./info
cd ../core
lcov -c -d . -o lcov.info
genhtml lcov.info -o ./info
else
make
fi