diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 86fb4247..f78425b6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -158,7 +158,7 @@ jobs: device: EFR32ZG14P231F256GM32 components: brd4206a # patchpath: "RCPMultiPAN/SkyConnect" - uses: ./.github/workflows/silabs-firmware-build.yaml + uses: ./.github/workflows/silabs-firmware-build-zwave.yaml with: image_name: ${{ needs.build-container.outputs.image_name }} firmware_name: zwave_serial_api_controller_${{ needs.build-container.outputs.sdk_version }}_${{ matrix.target }} diff --git a/.github/workflows/silabs-firmware-build-zwave.yaml b/.github/workflows/silabs-firmware-build-zwave.yaml new file mode 100644 index 00000000..9f745874 --- /dev/null +++ b/.github/workflows/silabs-firmware-build-zwave.yaml @@ -0,0 +1,118 @@ +name: Single firmware build + +on: + workflow_call: + inputs: + image_name: + required: false + type: string + default: "ghcr.io/${{ github.repository_owner }}/silabs-firmware-builder:${{ inputs.sdk_version }}" + firmware_name: + required: true + type: string + project_file: + required: true + type: string + project_name: + required: true + type: string + device: + required: true + type: string + components: + required: false + type: string + configuration: + required: false + type: string + patchpath: + required: false + type: string + sdkpatchpath: + required: false + type: string + extra_c_defs: + required: false + type: string + sdk_version: + required: true + type: string + metadata_fw_type: + required: true + type: string + metadata_extra: + required: false + default: "null" + type: string + +jobs: + firmware-build: + name: Build firmware + runs-on: ubuntu-latest + container: + image: ${{ inputs.image_name }} + options: --user root + defaults: + run: + shell: su --shell=/bin/bash builder {0} + steps: + - uses: actions/checkout@v3.3.0 + - name: Adjust permission + shell: bash + run: chown builder . + - name: Generate Firmware Project + run: | + slc generate \ + --with="${{ inputs.device }},${{ inputs.components }}" \ + --project-file="${{ inputs.project_file }}" \ + --export-destination="$PWD/${{ inputs.firmware_name }}" \ + --copy-proj-sources --copy-sdk-sources --new-project --force \ + --configuration="${{ inputs.configuration }}" + + - name: Patch Firmware + if: "${{ inputs.patchpath != '' }}" + run: | + cd ${{ inputs.firmware_name }} + for patch in "../${{ inputs.patchpath }}"/*.patch + do + echo "Applying ${patch}" + patch -p1 < $patch + done + + - name: Patch SDK + if: "${{ inputs.sdkpatchpath != '' }}" + run: | + cd ${{ inputs.firmware_name }}/gecko_sdk_${{ inputs.sdk_version }} + for patch in "../../${{ inputs.sdkpatchpath }}"/*.patch + do + echo "Applying ${patch}" + patch -p1 < $patch + done + + - name: Build Firmware + run: | + cd ${{ inputs.firmware_name }} + make -f ${{ inputs.project_name }}.Makefile release + - name: Add Firmware Metadata + run: | + cd ${{ inputs.firmware_name }} + jq --null-input \ + '{ + "metadata_version": 1, + "sdk_version": "${{ inputs.sdk_version }}", + "fw_type": "${{ inputs.metadata_fw_type }}", + "baudrate": ${{ inputs.baudrate }} + } + ${{ inputs.metadata_extra }}' > version.json + + - name: Generate gbl Firmware + run: | + cd ${{ inputs.firmware_name }} + commander gbl create build/release/${{ inputs.project_name }}.gbl \ + --app build/release/${{ inputs.project_name }}.out \ + --device ${{ inputs.device }} --metadata version.json + + - uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: ${{ inputs.firmware_name }} + path: ${{ inputs.firmware_name }} diff --git a/.github/workflows/silabs-firmware-build.yaml b/.github/workflows/silabs-firmware-build.yaml index 70302638..15364ab6 100644 --- a/.github/workflows/silabs-firmware-build.yaml +++ b/.github/workflows/silabs-firmware-build.yaml @@ -17,9 +17,8 @@ on: required: true type: string baudrate: - required: false + required: true type: number - default: 0 # Unchanged device: required: true type: string @@ -74,7 +73,6 @@ jobs: --configuration="${{ inputs.configuration }}" - name: Set Baudrate - if: "${{ inputs.baudrate != 0 }}" run: | cd ${{ inputs.firmware_name }} sed -Ei "s/^(\s*#define SL_\S+_VCOM_BAUDRATE\s+)[0-9]+/\\1${{ inputs.baudrate }}/" \