-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake.sh
executable file
·52 lines (48 loc) · 1.36 KB
/
make.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
#!/bin/sh
cmd="$1"
git_hash_tag() {
cd apps/
APPS_GIT_HASH=$(git describe --no-match --always --dirty --abbrev=40)
cd ../nuttx
NUTTX_GIT_HASH=$(git describe --no-match --always --dirty --abbrev=40)
cd ..
RFFE_GIT_HASH=$(git describe --no-match --always --dirty --abbrev=40)
RFFE_GIT_TAG=$(git describe --exact-match --tags 2>/dev/null)
if [ -z "$RFFE_GIT_TAG" ]; then
RFFE_GIT_TAG="devel"
echo "Development build"
fi
printf "/* Auto-generated file */\n\n#define APPS_GIT_HASH \"${APPS_GIT_HASH}\"\n#define NUTTX_GIT_HASH \"${NUTTX_GIT_HASH}\"\n#define RFFE_GIT_HASH \"${RFFE_GIT_HASH}\"\n#define RFFE_GIT_TAG \"${RFFE_GIT_TAG}\"\n" > rffe-app/git_version.h
}
if [ -z "$JOBS" ]; then
JOBS=1
fi
if test "$cmd" = "configure"; then
git_hash_tag
cd apps/
rm -f external
ln -s ../rffe-app external
cd ..
cd nuttx/
./tools/configure.sh ../rffe-board/rffe
cd ..
elif test "$cmd" = "build"; then
git_hash_tag
cd nuttx/
if [ ! -e .config ]; then
echo "Error: Build not configured yet."
echo "Please run '$0 configure' before building."
exit 1
fi
make -j ${JOBS}
cd ..
elif test "$cmd" = "clean"; then
cd nuttx/
make distclean
cd ..
rm -f apps/external rffe-app/git_version.h
elif test "$cmd" = "flash"; then
openocd -f scripts/openocd/lpc17-cmsis.cfg -c "program nuttx/nuttx.bin 0x10000; reset; shutdown"
else
echo "Error: unknown command ${cmd}"
fi