common.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. function build_sketches()
  3. {
  4. local arduino=$1
  5. local srcpath=$2
  6. local platform=$3
  7. local sketches=$(find $srcpath -name *.ino)
  8. for sketch in $sketches; do
  9. local sketchdir=$(dirname $sketch)
  10. if [[ -f "$sketchdir/.$platform.skip" ]]; then
  11. echo -e "\n\n ------------ Skipping $sketch ------------ \n\n";
  12. continue
  13. fi
  14. echo -e "\n\n ------------ Building $sketch ------------ \n\n";
  15. $arduino --verify $sketch;
  16. local result=$?
  17. if [ $result -ne 0 ]; then
  18. echo "Build failed ($sketch) build verbose..."
  19. $arduino --verify --verbose --preserve-temp-files $sketch
  20. result=$?
  21. fi
  22. if [ $result -ne 0 ]; then
  23. echo "Build failed ($1) $sketch"
  24. return $result
  25. fi
  26. done
  27. }
  28. function get_core()
  29. {
  30. echo Setup core for $1
  31. cd $HOME/arduino_ide/hardware
  32. if [ "$1" = "esp8266" ] ; then
  33. mkdir esp8266com
  34. cd esp8266com
  35. git clone https://github.com/esp8266/Arduino.git esp8266
  36. cd esp8266/tools
  37. python get.py
  38. fi
  39. if [ "$1" = "esp32" ] ; then
  40. mkdir espressif
  41. cd espressif
  42. git clone https://github.com/espressif/arduino-esp32.git esp32
  43. cd esp32/tools
  44. python get.py
  45. fi
  46. }