-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.sh
executable file
·64 lines (48 loc) · 996 Bytes
/
configure.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
54
55
56
57
58
59
60
61
62
63
64
stm32_spi_check_env()
{
if [ -z "${ZEPHYR_BASE+x}" ]; then
echo -e \
"ZEPHYR_BASE is not set.\n"\
"Please source zephyr-env.sh from your <Zephyr project dir>/zephyr directory"
return 1
fi
if [ ! -d src ]; then
echo -e \
"Please source this file from your Zephyr app base dir"
return 1
fi
if [ -d build ]; then
echo -e \
"The build directory already exist, remove it first if you want reconfigure it"
return 1
fi
if [ -e build ]; then
echo -e \
"You use 'build' as something else than your build dir"
return 1
fi
return 0
}
stm32_spi_do_setup()
{
local err
export CROSS_COMPILE=/usr/bin/arm-none-eabi-
export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile
mkdir build
cd build
cmake -GNinja -DBOARD=nucleo_f411re ..
err=$?
cd ..
if [ $err -ne 0 ]; then
echo Removing build
rm -r build
fi
return $err
}
if stm32_spi_check_env && stm32_spi_do_setup; then
echo -e \
"Setup complete, you can now do:\n"\
"\tcd build\n"\
"\tninja\n"\
"\tninja flash"
fi