Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.2 KiB

  1. #!/bin/bash
  2. # ------------------------------------------------------------------------------
  3. # CONFIGURATION
  4. # ------------------------------------------------------------------------------
  5. ENVIRONMENT="wemos-d1mini-relayshield"
  6. READELF="xtensa-lx106-elf-readelf"
  7. NUMBER=20
  8. # ------------------------------------------------------------------------------
  9. # END CONFIGURATION - DO NOT EDIT FURTHER
  10. # ------------------------------------------------------------------------------
  11. # remove default trace file
  12. rm -rf $FILE
  13. function help {
  14. echo
  15. echo "Syntax: $0 [-e <environment>] [-n <number>]"
  16. echo
  17. }
  18. # get environment from command line
  19. while [[ $# -gt 1 ]]; do
  20. key="$1"
  21. case $key in
  22. -e)
  23. ENVIRONMENT="$2"
  24. shift
  25. ;;
  26. -n)
  27. NUMBER="$2"
  28. shift
  29. ;;
  30. esac
  31. shift # past argument or value
  32. done
  33. # check environment folder
  34. if [ $ENVIRONMENT == "" ]; then
  35. echo "No environment defined"
  36. help
  37. exit 1
  38. fi
  39. ELF=.pio/build/$ENVIRONMENT/firmware.elf
  40. if [ ! -f $ELF ]; then
  41. echo "Could not find ELF file for the selected environment: $ELF"
  42. exit 2
  43. fi
  44. $READELF -s $ELF | head -3 | tail -1
  45. $READELF -s $ELF | sort -r -k3 -n | head -$NUMBER