Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tools/sdk/lib/compare/sdk-compare-includes
Original file line number Diff line number Diff line change
@@ -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' \
109 changes: 109 additions & 0 deletions tools/sdk/lib/compare/sdk-compare-libs
Original file line number Diff line number Diff line change
@@ -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"