update_chconf_rt.sh 765 B

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