esp-idf/components/esp_coex/test_md5/test_md5.sh

72 lines
1.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
if [ -z "${IDF_PATH:-}" ]; then
echo "IDF_PATH must be set before running this script"
exit 1
fi
if [ -z "${IDF_TARGET:-}" ]; then
echo "IDF_TARGET must be set before running this script"
exit 1
fi
case $IDF_TARGET in
esp32)
PREFIX=xtensa-esp32-elf-
;;
esp32s2)
PREFIX=xtensa-esp32s2-elf-
;;
esp32s3)
PREFIX=xtensa-esp32s3-elf-
;;
2023-03-10 01:31:33 -05:00
esp32c2|esp32c3|esp32c6|esp32h2)
PREFIX=riscv32-esp-elf-
;;
*)
echo "Invalid IDF_TARGET value: \"${IDF_TARGET}\""
exit 1
;;
esac
LIB_DIR=${IDF_TARGET}
ELF_FILE=test.elf
FAILURES=0
function check_md5()
{
FILENAME=$1
SYMBOL=$2
2023-01-09 08:29:41 -05:00
${PREFIX}ld --unresolved-symbols=ignore-all --entry 0 -o ${ELF_FILE} \
-u ${SYMBOL} \
${IDF_PATH}/components/esp_coex/lib/${LIB_DIR}/*.a
GDB_COMMAND="printf \"%s\\n\", (const char*) ${SYMBOL}"
MD5_FROM_LIB=$(${PREFIX}gdb -n -batch ${ELF_FILE} -ex "${GDB_COMMAND}")
MD5_FROM_HEADER=$(md5sum ${FILENAME} | cut -c 1-7)
echo "Checking ${FILENAME}:"
echo " ${MD5_FROM_HEADER} - from header file"
echo " ${MD5_FROM_LIB} - from library"
if [ "${MD5_FROM_LIB}" != "${MD5_FROM_HEADER}" ]; then
echo " error: MD5 mismatch!"
FAILURES=$(($FAILURES+1))
fi
}
echo "Checking libraries for target ${IDF_TARGET}..."
check_md5 ${IDF_PATH}/components/esp_coex/include/esp_coexist_adapter.h g_coex_adapter_funcs_md5
2023-03-10 01:31:33 -05:00
case $IDF_TARGET in
esp32c6|esp32h2)
2023-02-14 08:20:55 -05:00
check_md5 ${IDF_PATH}/components/esp_coex/include/esp_coex_i154.h g_coex_i154_funcs_md5
2023-03-10 01:31:33 -05:00
;;
esac
2023-01-09 08:29:41 -05:00
if [ $FAILURES -gt 0 ]; then
exit 1
fi