update_mcuconf_stm32l432xx.sh 847 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_stm32l432xx.sh "{}" \;
  7. else
  8. echo "Usage: update_mcuconf_stm32l432xx.sh [rootpath <root path>]"
  9. fi
  10. elif [ $# -eq 1 ]
  11. then
  12. declare conffile=$(<$1)
  13. if egrep -q "STM32L432_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_stm32l432xx
  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_stm32l432xx.sh [rootpath <root path>]"
  28. echo " update_mcuconf_stm32l432xx.sh <configuration file>]"
  29. fi