check_xlcz.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/env bash
  2. APPDIR=${1:-application}
  3. SCRIPTDIR=$(dirname $(readlink -f $BASH_SOURCE))
  4. SCRIPTDIR=$(readlink -f $SCRIPTDIR)
  5. if [ "x$NSDK_ROOT" == "x" ] ; then
  6. NSDK_ROOT=$(readlink -f $SCRIPTDIR/../../..)
  7. fi
  8. pushd $NSDK_ROOT/$APPDIR > /dev/null
  9. totaladdibnecnt=0
  10. echo "app,corecfg,xlczcnt,addibnecnt"
  11. for ext in _xxlcz _zca_zcb_zcf_zcmp_zcmt_xxlcz ; do
  12. for appdir in `find . -name Makefile | xargs dirname`; do
  13. skipcases=("demo_dsp" "demo_vnice")
  14. for case in "${skipcases[@]}"; do
  15. if [[ "$appdir" == *"$case"* ]] ; then
  16. # see https://blog.csdn.net/focus_lyh/article/details/112319193
  17. continue 2
  18. fi
  19. done
  20. for core in n300 n300f nx900 nx900f ; do
  21. archext=$ext
  22. if [[ "$core" == *"x"* ]] || [[ ! "$core" == *"f"* ]] ; then
  23. archext=${archext/_zcf/}
  24. fi
  25. pushd $appdir > /dev/null
  26. make SILENT=1 clean > /dev/null
  27. dasmfile=$(make SILENT=1 CORE=$core ARCH_EXT=$archext -j dasm 2>&1 | grep dasm | cut -d ">" -f2)
  28. if [ "x$dasmfile" == "x" ] || [ ! -f $dasmfile ] ; then
  29. errmsg=$(make SILENT=1 CORE=$core ARCH_EXT=$archext -j dasm 2>&1 | grep 'ld: cannot find -lnmsis')
  30. if [ "x$errmsg" == "x" ] ; then
  31. echo "ERROR: Unable to build $appdir for CORE=$core ARCH_EXT=$archext"
  32. make SILENT=1 CORE=$core ARCH_EXT=$archext | grep "Error:"
  33. exit 1
  34. else
  35. continue
  36. fi
  37. else
  38. xlczinscnt=$(cat $dasmfile | grep -e "xl\." | wc -l)
  39. addibnecnt=$(cat $dasmfile | grep -e "xl\.addibne" | wc -l)
  40. fi
  41. totaladdibnecnt=$(($addibnecnt+$totaladdibnecnt))
  42. echo "$appdir,$core$archext,$xlczinscnt,$addibnecnt"
  43. popd > /dev/null
  44. done
  45. done
  46. done
  47. popd > /dev/null
  48. if [[ $totaladdibnecnt > 0 ]] ; then
  49. echo "Generate totally $totaladdibnecnt xl.addibne instructions"
  50. exit 0
  51. fi
  52. echo "ERORR: No xl.addibne generated!"
  53. exit 1