Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

flash.sh 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. # ----------------------------------------------------------------------------
  3. # Copyright (c) 2024 Thomas Buck (thomas@xythobuz.de)
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # See <http://www.gnu.org/licenses/>.
  16. # ----------------------------------------------------------------------------
  17. set -euo pipefail
  18. SERIAL=/dev/serial/by-id/usb-xythobuz_LARS_*
  19. DISK=/dev/disk/by-label/RPI-RP2
  20. MOUNT=/mnt/tmp
  21. if [ ! -e $DISK ]
  22. then
  23. echo Resetting Raspberry Pi Pico
  24. echo -n -e "\\x18" > $SERIAL
  25. echo -n -e "\\x18" > $SERIAL
  26. fi
  27. echo -n Waiting for disk to appear
  28. until [ -e $DISK ]
  29. do
  30. echo -n .
  31. sleep 1
  32. done
  33. echo
  34. echo Mounting bootloader disk
  35. sudo mount $DISK $MOUNT
  36. echo Copying binary
  37. sudo cp $1 $MOUNT
  38. echo Done