Skip to content

Commit

Permalink
CI workflow for iMX (#14293)
Browse files Browse the repository at this point in the history
* Add build script to build imx project

TEST:
export IMX_SDK_ROOT=${PATH_TO_IMX8_YOCTO_SDK}
or
source ${PATH_TO_IMX8_YOCTO_SDK}/environment-setup-cortexa53-crypto-poky-linux

./scripts/examples/imxlinux_example.sh examples/lighting-app/linux/
examples/lighting-app/linux/out/aarch64

Signed-off-by: Haoran Wang <elven.wang@nxp.com>

* Restyled by whitespace

* Restyled by shellharden

* Restyled by shfmt

* Add i.MX Github workflow

Add the build workflow to validate the compiling with i.MX SDK.

Signed-off-by: Haoran Wang <elven.wang@nxp.com>

* Add badge for i.MX Linux platform CI

Signed-off-by: Haoran Wang <elven.wang@nxp.com>

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Jan 12, 2024
1 parent 08474e8 commit 1071796
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/examples-linux-imx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (c) 2022 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build example - i.MX Linux

on:
push:
pull_request:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
cancel-in-progress: true

jobs:
imx:
name: Linux i.MX Build
timeout-minutes: 70

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-imx:0.5.52

steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Build App
timeout-minutes: 10
run: |
./scripts/examples/imxlinux_example.sh \
examples/lighting-app/linux/ examples/lighting-app/linux/out/aarch64
- name: Build chip-tool
timeout-minutes: 10
run: |
./scripts/examples/imxlinux_example.sh \
examples/chip-tool examples/chip-tool/out/aarch64
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
![Examples - Linux Standalone](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20Standalone/badge.svg)
![Examples - ESP32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ESP32/badge.svg)
![Examples - K32W with SE051](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20K32W%20with%20SE051/badge.svg)
![Examples - i.MX Linux](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20i.MX%20Linux/badge.svg)

![Android](https://github.com/project-chip/connectedhomeip/workflows/Android/badge.svg)

Expand Down
49 changes: 49 additions & 0 deletions scripts/examples/imxlinux_example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

#
# Copyright (c) 2022 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -e
set -x
if [ "$#" != 2 ]; then
exit -1
fi

source "$(dirname "$0")/../../scripts/activate.sh"

if [ "$IMX_SDK_ROOT" = "" ]; then
if [ "$CROSS_COMPILE" != "aarch64-poky-linux-" ]; then
echo "i.MX SDK root not aarch64"
exit -1
fi
else
source "$IMX_SDK_ROOT"/environment-setup-cortexa53-crypto-poky-linux
fi
env

PLATFORM_CFLAGS='-DCHIP_DEVICE_CONFIG_WIFI_STATION_IF_NAME=\"mlan0\"", "-DCHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD=\"udhcpc -b -i %s \"'
PKG_CONFIG_SYSROOT_DIR=$PKG_CONFIG_SYSROOT_DIR \
PKG_CONFIG_LIBDIR="$PKG_CONFIG_PATH" \
gn gen --check --fail-on-unused-args --root="$1" "$2" --args="target_os=\"linux\" target_cpu=\"arm64\" arm_arch=\"armv8-a\"
import(\"//build_overrides/build.gni\")
target_cflags=[ \"--sysroot=$SDKTARGETSYSROOT\", \"$PLATFORM_CFLAGS\" ]
target_ldflags = [ \"--sysroot=$SDKTARGETSYSROOT\" ]
custom_toolchain=\"\${build_root}/toolchain/custom\"
target_cc=\"$OECORE_NATIVE_SYSROOT/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc\"
target_cxx=\"$OECORE_NATIVE_SYSROOT/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++\"
target_ar=\"$OECORE_NATIVE_SYSROOT/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ar\""

ninja -C "$2"

0 comments on commit 1071796

Please sign in to comment.