S&B Volcano vaporizer remote control with Pi Pico W
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # ----------------------------------------------------------------------------
  3. # Copyright (c) 2023 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. # TODO take from config.h
  19. DISK_BLOCK_SIZE=512
  20. DISK_BLOCK_COUNT=384
  21. cd "$(dirname "$0")"
  22. echo "Packing data"
  23. rm -rf $1/src
  24. mkdir -p $1/src
  25. cp COPYING $1/src
  26. cp README.md $1/src
  27. cp CMakeLists.txt $1/src
  28. cp .gitmodules $1/src/gitmodules
  29. cp -r include $1/src
  30. cp -r conf $1/src
  31. cp -r src $1/src
  32. echo "Compressing data"
  33. cd $1
  34. rm -rf data.tar data.tar.xz
  35. tar -f data.tar -c src
  36. xz -z -9 data.tar
  37. echo "Creating empty bin"
  38. dd if=/dev/zero of=fat_fs.bin bs=$DISK_BLOCK_SIZE count=$DISK_BLOCK_COUNT
  39. echo "Writing FAT file system"
  40. mkfs.vfat fat_fs.bin
  41. echo "Copying source code archive"
  42. mcopy -i fat_fs.bin ../data/README.md ::README.md
  43. mcopy -i fat_fs.bin data.tar.xz ::src.tar.xz
  44. echo "Converting to object file"
  45. arm-none-eabi-objcopy -I binary -O elf32-littlearm \
  46. --rename-section .data=.fat_fs_bin,CONTENTS,ALLOC,LOAD,READONLY,DATA \
  47. fat_fs.bin fat_fs.o