update_mcuconf_stm32f72xxx.sh 991 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. if [ $# -eq 2 ]
  3. then
  4. if [ $1 = "rootpath" ]
  5. then
  6. find $2 -name "mcuconf.h" -exec bash update_mcuconf_stm32f72xxx.sh "{}" \;
  7. else
  8. echo "Usage: update_mcuconf_stm32f72xxx.sh [rootpath <root path>]"
  9. fi
  10. elif [ $# -eq 1 ]
  11. then
  12. declare conffile=$(<$1)
  13. if egrep -q "STM32F722_MCUCONF" <<< "$conffile" || egrep -q "STM32F723_MCUCONF" <<< "$conffile" || egrep -q "STM32F732_MCUCONF" <<< "$conffile" || egrep -q "STM32F733_MCUCONF" <<< "$conffile"
  14. then
  15. echo Processing: $1
  16. egrep -e "\#define\s+[a-zA-Z0-9_()]*\s+[a-zA-Z0-9_]" <<< "$conffile" | sed -r 's/\#define\s+([a-zA-Z0-9_]*)(\([^)]*\))?\s+/\1=/g' > ./values.txt
  17. if ! fmpp -q -C conf.fmpp -S ../ftl/processors/conf/mcuconf_stm32f72xxx
  18. then
  19. echo
  20. echo "aborted"
  21. exit 1
  22. fi
  23. cp ./mcuconf.h $1
  24. rm ./mcuconf.h ./values.txt
  25. fi
  26. else
  27. echo "Usage: update_mcuconf_stm32f72xxx.sh [rootpath <root path>]"
  28. echo " update_mcuconf_stm32f72xxx.sh <configuration file>]"
  29. fi