1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

scripts for comparing core closed libs against esp-nonos-sdk ones (#4855)

This commit is contained in:
david gauchard 2018-07-03 11:45:22 +02:00 committed by GitHub
parent b126a9c526
commit 7dd2ca355c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 142 additions and 0 deletions

View File

@ -0,0 +1,33 @@
#!/bin/sh
set -e
# released to public domain
help()
{
cat << eof
usage: $1 <esp-open-sdk path>
Compare include files against sdk's
eof
exit 1
}
sdk="$1"
me="$0"
core=${me%/*}/../../../..
[ -r "$sdk/lib/libnet80211.a" ] || help "$0"
for f in $(cd "$sdk"; find include -type f); do
diff -bu "$sdk/$f" "$core/tools/sdk/$f" || true
done | sed \
-e 's/^+#ifdef.*cplusplus//g' \
-e 's/^+extern "C"//g' \
-e 's/^+}$//g' \
-e 's/^+#endif//g' \
-e 's/^+[ \t]*$//g' \

View File

@ -0,0 +1,109 @@
#!/bin/bash
set -e
# released to public domain
help()
{
cat << eof
usage: $1 [-v] <esp-open-sdk path>
For each binary-only library file from ESP-NONOS-SDK, this script searches for
the exact commits and reports matching versions and commit urls.
The argument must be the ESP-NONOS-SDK git-cloned directory. It is left
unmodified, and is locally cloned to work with. The local copy is then
removed.
Because of libmain.a local tweaks, comparison is done for each .a file by
extracting object files, removing the potentially modified ones
(mem_manager.o time.o user_interface.o eagle_lwip_if.o) and doing a md5
check against the core files.
eof
exit 1
}
verbose=false
[ "$1" = "-v" ] && { shift; verbose=true; }
sdk="$1"
me="$0"
core=$(cd ${me%/*}/../../../..; pwd)
[ -r "$sdk/lib/libnet80211.a" ] || help "$0"
[ -r "$core/tools/xtensa-lx106-elf/bin" ] || help "$0"
tmp=$(pwd)/NONOSDK.deleteme
cat << eof
nonos-sdk = '$sdk'
core root directory = '$core'
temporary nonos-sdk clone = '$tmp'
If libmain.a is not found, it should be the one around the same libpp.a's commit
eof
md5()
{
mkdir temp
cd temp
PATH="$core/tools/xtensa-lx106-elf/bin:$PATH" xtensa-lx106-elf-ar x "$1"
rm -f mem_manager.o time.o user_interface.o eagle_lwip_if.o
cat *.o | md5sum
cd ..
rm -rf temp
}
search()
{
rm -rf "$tmp"
git clone $sdk "$tmp" 1>&2
cd "$tmp"
git reset --hard 1>&2
corelibs=$(cd "$core/tools/sdk/lib"; ls *.a)
commits=$(git log|grep ^commit\ | tac | sed 's,commit ,,')
for f in $corelibs; do
git checkout master 1>&2 # needed
if [ -r "$tmp/lib/$f" ]; then
coremd5=$(md5 "$core/tools/sdk/lib/$f")
found=false
for i in $commits; do
git reset --hard 1>&2
git checkout $i 1>&2
[ -d "$tmp/lib" ] || continue
espmd5=$(md5 "$tmp/lib/$f")
if [ "$espmd5" = "$coremd5" ]; then
tag=$(git describe --tag)
echo "$tag - https://github.com/espressif/ESP8266_NONOS_SDK/commit/$i - $f"
found=true
break
fi
done
$found || echo "NOTFOUND - $f"
fi
done
cd ..
rm -rf "$tmp"
}
$verbose && search
$verbose || search 2>/dev/null
echo "all done"