From bbef8582786e1b92ba73272f04d103d20c39881c Mon Sep 17 00:00:00 2001 From: Silabs-ThieuVu <65759766+Silabs-ThieuVu@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:46:23 +0700 Subject: [PATCH] Update 01-Generate_Firmware.yaml --- .github/workflows/01-Generate_Firmware.yaml | 217 +++++--------------- 1 file changed, 54 insertions(+), 163 deletions(-) diff --git a/.github/workflows/01-Generate_Firmware.yaml b/.github/workflows/01-Generate_Firmware.yaml index 9c92ac99..b557937b 100644 --- a/.github/workflows/01-Generate_Firmware.yaml +++ b/.github/workflows/01-Generate_Firmware.yaml @@ -14,6 +14,15 @@ on: description: 'Branch to test' type: string default: 'dev' + ADAPTER_SN_MG12: + description: 'Adapter serial number of MG12' + type: string + default: '440189400' + ADAPTER_SN_MG24: + description: 'Adapter serial number of MG24' + type: string + default: '440133193' + env: AM_CORRETTO_17: https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz SLC_CLI_URL: https://www.silabs.com/documents/login/software/slc_cli_linux.zip @@ -34,15 +43,18 @@ jobs: contents: read pull-requests: write env: - BOARD_NAME: brd4187c + BOARD_NAME_MG12: brd4161a + BOARD_NAME_MG24: brd4187c + ADAPTER_SN_MG12: ${{ github.event.inputs.ADAPTER_SN_MG12 }} #440189400 + ADAPTER_SN_MG24: ${{ github.event.inputs.ADAPTER_SN_MG24 }} #440133193 HOST_IP: 192.168.1.69 TOOL_DIRS: arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin COMPILER: GCC TOOL_CHAINS: GCC TASK: gen-only COMPONENT: all - ADAPTER_SN: 440133193 - CHIP: EFR32MG24BXXXF1536 + CHIP_MG12: EFR32MG12 + CHIP_MG24: EFR32MG24BXXXF1536 steps: - name: Trigger run: echo "Triggered by ${{github.event_name}} event" @@ -65,16 +77,25 @@ jobs: - name: Install Simplicity SDK if: always() run: | + if [ -d "simplicity_sdk" ]; then + echo "Removing existing simplicity_sdk folder..." + rm -rf simplicity_sdk + fi git clone $SIM_REPO - cd simplicity_sdk + cd simplicity_sdk || exit ls -la cd .. ls -la - name: Install Gecko SDK if: always() run: | + if [ -d "gecko_sdk_$SDK_VER" ]; then + echo "Removing existing gecko_sdk_$SDK_VER folder..." + rm -rf gecko_sdk_$SDK_VER + fi + echo "Cloning the repository..." git clone $GECKO_SDK_REPO gecko_sdk_$SDK_VER - cd gecko_sdk_$SDK_VER + cd gecko_sdk_$SDK_VER || exit git checkout tags/$SDK_VER ls -la mkdir extension @@ -153,7 +174,7 @@ jobs: export SDK_PATH=$PWD/gecko_sdk_$SDK_VER export PATH=$PATH:$PWD/amazon-corretto-17.0.12.7.1-linux-x64/bin echo $PATH - echo 2 | sudo update-alternatives --config java + echo 2 | sudo update-alternatives --config java || exit 1 java --version slc --version slc configuration --sdk=${SDK_PATH} @@ -161,170 +182,40 @@ jobs: slc signature trust --sdk $SDK_PATH slc configuration -gcc=$TOOL_DIRS make prepare - cd build + cd build || exit 1 + echo "Generate image for MG12" + export ADAPTER_SN_MG12=${{ env.ADAPTER_SN_MG12}} + export BOARD_NAME_MG12=${{ env.BOARD_NAME_MG12 }} slc signature trust -extpath $SDK_PATH/extension/IEC60730_Libs - cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_INTEGRATION_TESTING=ON -DBOARD_NAME=$BOARD_NAME - cmake --build . --target integration_test_info -j4 - export ADAPTER_SN=440133193 - export LST_PATH=$PWD/test/integration_test/build/brd4187c/integration_test_iec60730_watchdog/S + cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_INTEGRATION_TESTING=ON -DBOARD_NAME=$BOARD_NAME_MG12 || exit 1 + cmake --build . --target integration_test_info -j4 || exit 1 + export LST_PATH=$PWD/test/integration_test/build/$BOARD_NAME_MG12/integration_test_iec60730_watchdog/S export JLINK_PATH=/opt/SEGGER/JLink/libjlinkarm.so - export HOST_IP=192.168.1.69 - bash execute_integration_test.sh $BOARD_NAME $TASK $COMPONENTS $ADAPTER_SN $COMPILER - - name: Upload firmware + export HOST_IP=$HOST_IP + bash execute_integration_test.sh $BOARD_NAME_MG12 $TASK $COMPONENTS $ADAPTER_SN_MG12 $COMPILER || exit 1 + + echo "Generate image for MG24" + export ADAPTER_SN_MG24=${{ env.ADAPTER_SN_MG24}} + export BOARD_NAME_MG24=${{ env.BOARD_NAME_MG24 }} + slc signature trust -extpath $SDK_PATH/extension/IEC60730_Libs + cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_INTEGRATION_TESTING=ON -DBOARD_NAME=$BOARD_NAME_MG24 || exit 1 + cmake --build . --target integration_test_info -j4 || exit 1 + export LST_PATH=$PWD/test/integration_test/build/$BOARD_NAME_MG24/integration_test_iec60730_watchdog/S + export JLINK_PATH=/opt/SEGGER/JLink/libjlinkarm.so + export HOST_IP=$HOST_IP + bash execute_integration_test.sh $BOARD_NAME_MG24 $TASK $COMPONENTS $ADAPTER_SN_MG24 $COMPILER || exit 1 + + - name: Upload firmware MG12 uses: actions/upload-artifact@v4.3.4 with: - name: firmware_mg24_gcc - path: ${{ github.workspace }}/build/test/integration_test/build/${{ env.BOARD_NAME }}/integration_test_iec60730_invariable_memory/NS/ + name: firmware_mg12_gcc + path: ${{ github.workspace }}/build/test/integration_test/build/$BOARD_NAME_MG12/integration_test_iec60730_invariable_memory/NS/ warn: Output a warning but do not fail the action retention-days: 90 - job2: - name: Generate Firmware for MG12 with GCC - runs-on: ubuntu-20.04 - permissions: - contents: read - pull-requests: write - env: - BOARD_NAME: brd4161a - HOST_IP: 192.168.1.69 - TOOL_DIRS: arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin - COMPILER: GCC - TOOL_CHAINS: GCC - PLATFORM: MG12 - TASK: gen-only - COMPONENT: all - ADAPTER_SN: 440189400 - CHIP: EFR32MG12 - steps: - - name: Trigger - run: echo "Triggered by ${{github.event_name}} event" - - name: Check Branch Input - run: | - if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - if [ -z "${{ github.event.inputs.branch }}" ]; then - echo "Branch input is required for manual trigger." - exit 1 - fi - fi - - name: Checkout - uses: actions/checkout@v4.1.7 - with: - ref: "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref }}" - - name: Log Current Branch and Commit - run: | - echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" - echo "Current commit: $(git rev-parse HEAD)" - - name: Install Simplicity SDK - if: always() - run: | - git clone $SIM_REPO - cd simplicity_sdk - ls -la - cd .. - ls -la - - name: Install Gecko SDK - if: always() - run: | - git clone $GECKO_SDK_REPO gecko_sdk_$SDK_VER - cd gecko_sdk_$SDK_VER - git checkout tags/$SDK_VER - ls -la - mkdir extension - cd extension - git clone https://github.com/SiliconLabs/IEC60730_Libs.git - cd IEC60730_Libs - git checkout create-unit-test-functions-in-lib-iec60730 - ls -la - cd .. - ls -la - cd .. - ls -la - - name: Install Amazon Corretto 17 - if: always() - run: | - wget $AM_CORRETTO_17 - tar -xzf amazon-corretto-17-x64-linux-jdk.tar.gz - ls -la - - name: Install SLC CLI - if: always() - run: | - wget $SLC_CLI_URL - unzip slc_cli_linux.zip - ls -la - - name: Install Simplicity Commander - if: always() - run: | - wget $COMMANDER_URL - unzip SimplicityCommander-Linux.zip - cd SimplicityCommander-Linux - ls -la - cd .. - mkdir commander - tar -xf SimplicityCommander-Linux/Commander_linux_x86_64_*.tar.bz commander - cd commander - ls -la - - name: Install GCC - if: always() - run: | - wget $GCC_URL - tar -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz - ls -la - cd arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi - ls -la - - name: Install Ninja build - run: | - sudo apt update - sudo apt -y install ninja-build - ninja --version - - name: Install python3.11 - if: always() - run: | - sudo apt update - sudo apt upgrade - sudo add-apt-repository ppa:deadsnakes/ppa -y - sudo apt update - sudo apt install python3.11 - python3.11 --version - which python3.11 - cat ~/.bashrc - echo "alias python3=python3.11" >> ~/.bashrc - echo "alias python3=python3.11" >> ~/.bash_profile - cat ~/.bashrc - source ~/.bash_profile - source ~/.bashrc - python3 --version - sudo apt install python3.11-full - sudo apt install python3-pip - - name: Generate image - run: | - export PATH=$PATH:$PWD/commander - export PATH=$PATH:$PWD/slc_cli - export JLINK_PATH=/opt/SEGGER/JLink/libjlinkarm.so - export TOOL_DIRS=$PWD/$TOOL_DIRS - export PATH=$PATH:/usr/bin/ - export SDK_PATH=$PWD/gecko_sdk_$SDK_VER - export PATH=$PATH:$PWD/amazon-corretto-17.0.12.7.1-linux-x64/bin - echo $PATH - echo 2 | sudo update-alternatives --config java - java --version - slc --version - slc configuration --sdk=${SDK_PATH} - ninja --version - slc signature trust --sdk $SDK_PATH - slc configuration -gcc=$TOOL_DIRS - make prepare - cd build - slc signature trust -extpath $SDK_PATH/extension/IEC60730_Libs - cmake --toolchain ../cmake/toolchain.cmake .. -DENABLE_INTEGRATION_TESTING=ON -DBOARD_NAME=$BOARD_NAME - cmake --build . --target integration_test_info -j4 - export ADAPTER_SN=440133193 - export LST_PATH=$PWD/test/integration_test/build/brd4187c/integration_test_iec60730_watchdog/S - export JLINK_PATH=/opt/SEGGER/JLink/libjlinkarm.so - export HOST_IP=192.168.1.69 - bash execute_integration_test.sh $BOARD_NAME $TASK $COMPONENTS $ADAPTER_SN $COMPILER - - name: Upload firmware + - name: Upload firmware MG24 uses: actions/upload-artifact@v4.3.4 with: - name: firmware_mg12_gcc - path: ${{ github.workspace }}/build/test/integration_test/build/${{ env.BOARD_NAME }}/integration_test_iec60730_invariable_memory/NS/ + name: firmware_mg24_gcc + path: ${{ github.workspace }}/build/test/integration_test/build/$BOARD_NAME_MG24/integration_test_iec60730_invariable_memory/NS/ warn: Output a warning but do not fail the action retention-days: 90