CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/scripts/esp32_get_idf.sh
Views: 1798
1
#!/usr/bin/env bash
2
# if you have modules/esp_idf setup as a submodule, then leave it as a submodule and switch branches
3
4
COMMIT="cc3203dc4f087ab41b434afff1ed7520c6d90993"
5
6
if [ ! -d modules ]; then
7
echo "this script needs to be run from the root of your repo, sorry, giving up."
8
exit 1
9
fi
10
echo `ls modules`
11
cd modules
12
13
if [ ! -d esp_idf ]; then
14
echo 'did not find modules/esp_idf folder, making it.' ;
15
mkdir -p -v esp_idf
16
else
17
echo 'found modules/esp_idf folder' ;
18
fi
19
20
echo "looking for submodule or repo..."
21
if [ `git submodule | grep esp_idf | wc | cut -c1-7` == '1' ]; then
22
echo "found real submodule, syncing"
23
../Tools/gittools/submodule-sync.sh >/dev/null
24
else
25
echo "esp_idf is NOT a submodule"
26
27
if [ ! `ls esp_idf/install.sh 2>/dev/null` ]; then
28
echo "found empty IDF, cloning"
29
# add esp_idf as almost submodule, depths uses less space
30
git clone -b 'release/v5.3' https://github.com/espressif/esp-idf.git esp_idf
31
git checkout $COMMIT
32
fi
33
fi
34
35
echo "inspecting possible IDF... "
36
cd esp_idf
37
echo `git rev-parse HEAD`
38
# these are a selection of possible specific commit/s that represent v5.3 branch of the esp_idf
39
if [ `git rev-parse HEAD` == '$COMMIT' ]; then
40
echo "IDF version 'release/5.3' found OK, great.";
41
else
42
echo "looks like an idf, but not v5.3 branch, or wrong commit , trying to switch branch and reflect upstream";
43
../../Tools/gittools/submodule-sync.sh >/dev/null
44
git fetch ; git checkout -f release/v5.3
45
git checkout $COMMIT
46
47
# retry same as above
48
echo `git rev-parse HEAD`
49
if [ `git rev-parse HEAD` == '$COMMIT' ]; then
50
echo "IDF version 'release/5.3' found OK, great.";
51
git checkout $COMMIT
52
fi
53
fi
54
cd ../..
55
56
cd modules/esp_idf
57
git submodule update --init --recursive
58
59
echo
60
echo "installing missing python modules"
61
python -m pip install empy==3.3.4
62
python -m pip install pexpect
63
python -m pip install future
64
65
cd ../..
66
67
echo
68
echo "after changing IDF versions [ such as between 4.4 and 5.3 ] you should re-run these in your console:"
69
echo "./modules/esp_idf/install.sh"
70
echo "source ./modules/esp_idf/export.sh"
71
72