buildFirmware.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. echo "Build process started"
  3. echo "Setting up build name and build number"
  4. if [ -z "${TARGET_BUILD_NAME}" ]
  5. then
  6. export TARGET_BUILD_NAME="I2S-4MFlash"
  7. echo "TARGET_BUILD_NAME is not set. Defaulting to ${TARGET_BUILD_NAME}"
  8. fi
  9. if [ -z "${BUILD_NUMBER}" ]
  10. then
  11. export BUILD_NUMBER="500"
  12. echo "BUILD_NUMBER is not set. Defaulting to ${BUILD_NUMBER}"
  13. fi
  14. if [ -z "$DEPTH" ]
  15. then
  16. export DEPTH="16"
  17. echo "DEPTH is not set. Defaulting to ${DEPTH}"
  18. fi
  19. if [ -z "$tag" ]
  20. then
  21. branch_name="$(git rev-parse --abbrev-ref HEAD)"
  22. branch_name="${branch_name//[^a-zA-Z0-9\-~!@_\.]/}"
  23. app_name="${TARGET_BUILD_NAME}.${DEPTH}.dev-$(git log --pretty=format:'%h' --max-count=1).${branch_name}"
  24. echo "${app_name}">version.txt
  25. echo "app_name is not set. Defaulting to ${app_name}"
  26. else
  27. echo "${tag}" >version.txt
  28. fi
  29. echo "Copying target sdkconfig"
  30. cp build-scripts/${TARGET_BUILD_NAME}-sdkconfig.defaults sdkconfig
  31. echo "Building project"
  32. idf.py build -DDEPTH=${DEPTH} -DBUILD_NUMBER=${BUILD_NUMBER}-${DEPTH}
  33. echo "Generating size report"
  34. idf.py size-components >build/size_components.txt
  35. idf.py size-components-squeezelite build/size_components_squeezelite.txt
  36. if [ -z "${artifact_file_name}" ]
  37. then
  38. echo "No artifact file name set. Will not generate zip file."
  39. else
  40. echo "Generating build artifact zip file"
  41. zip -r build_output.zip build
  42. zip build/${artifact_file_name} partitions*.csv components/ build/*.bin build/bootloader/bootloader.bin build/partition_table/partition-table.bin build/flash_project_args build/size_*.txt
  43. fi