Skip to content

Commit 7dd2ca3

Browse files
authored
scripts for comparing core closed libs against esp-nonos-sdk ones (#4855)
1 parent b126a9c commit 7dd2ca3

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# released to public domain
6+
7+
help()
8+
{
9+
cat << eof
10+
11+
usage: $1 <esp-open-sdk path>
12+
13+
Compare include files against sdk's
14+
15+
eof
16+
exit 1
17+
}
18+
19+
20+
sdk="$1"
21+
me="$0"
22+
core=${me%/*}/../../../..
23+
24+
[ -r "$sdk/lib/libnet80211.a" ] || help "$0"
25+
26+
for f in $(cd "$sdk"; find include -type f); do
27+
diff -bu "$sdk/$f" "$core/tools/sdk/$f" || true
28+
done | sed \
29+
-e 's/^+#ifdef.*cplusplus//g' \
30+
-e 's/^+extern "C"//g' \
31+
-e 's/^+}$//g' \
32+
-e 's/^+#endif//g' \
33+
-e 's/^+[ \t]*$//g' \
+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# released to public domain
6+
7+
help()
8+
{
9+
cat << eof
10+
11+
usage: $1 [-v] <esp-open-sdk path>
12+
13+
For each binary-only library file from ESP-NONOS-SDK, this script searches for
14+
the exact commits and reports matching versions and commit urls.
15+
16+
The argument must be the ESP-NONOS-SDK git-cloned directory. It is left
17+
unmodified, and is locally cloned to work with. The local copy is then
18+
removed.
19+
20+
Because of libmain.a local tweaks, comparison is done for each .a file by
21+
extracting object files, removing the potentially modified ones
22+
(mem_manager.o time.o user_interface.o eagle_lwip_if.o) and doing a md5
23+
check against the core files.
24+
25+
eof
26+
exit 1
27+
}
28+
29+
30+
verbose=false
31+
[ "$1" = "-v" ] && { shift; verbose=true; }
32+
sdk="$1"
33+
me="$0"
34+
core=$(cd ${me%/*}/../../../..; pwd)
35+
36+
37+
[ -r "$sdk/lib/libnet80211.a" ] || help "$0"
38+
[ -r "$core/tools/xtensa-lx106-elf/bin" ] || help "$0"
39+
40+
tmp=$(pwd)/NONOSDK.deleteme
41+
42+
cat << eof
43+
44+
nonos-sdk = '$sdk'
45+
core root directory = '$core'
46+
temporary nonos-sdk clone = '$tmp'
47+
48+
If libmain.a is not found, it should be the one around the same libpp.a's commit
49+
50+
eof
51+
52+
md5()
53+
{
54+
mkdir temp
55+
cd temp
56+
PATH="$core/tools/xtensa-lx106-elf/bin:$PATH" xtensa-lx106-elf-ar x "$1"
57+
rm -f mem_manager.o time.o user_interface.o eagle_lwip_if.o
58+
cat *.o | md5sum
59+
cd ..
60+
rm -rf temp
61+
}
62+
63+
search()
64+
{
65+
rm -rf "$tmp"
66+
git clone $sdk "$tmp" 1>&2
67+
cd "$tmp"
68+
git reset --hard 1>&2
69+
70+
corelibs=$(cd "$core/tools/sdk/lib"; ls *.a)
71+
commits=$(git log|grep ^commit\ | tac | sed 's,commit ,,')
72+
73+
for f in $corelibs; do
74+
75+
git checkout master 1>&2 # needed
76+
77+
if [ -r "$tmp/lib/$f" ]; then
78+
79+
coremd5=$(md5 "$core/tools/sdk/lib/$f")
80+
found=false
81+
82+
for i in $commits; do
83+
git reset --hard 1>&2
84+
git checkout $i 1>&2
85+
86+
[ -d "$tmp/lib" ] || continue
87+
88+
espmd5=$(md5 "$tmp/lib/$f")
89+
if [ "$espmd5" = "$coremd5" ]; then
90+
tag=$(git describe --tag)
91+
echo "$tag - https://github.com/espressif/ESP8266_NONOS_SDK/commit/$i - $f"
92+
found=true
93+
break
94+
fi
95+
done
96+
97+
$found || echo "NOTFOUND - $f"
98+
fi
99+
100+
done
101+
102+
cd ..
103+
rm -rf "$tmp"
104+
}
105+
106+
$verbose && search
107+
$verbose || search 2>/dev/null
108+
109+
echo "all done"

0 commit comments

Comments
 (0)