ZHCADP2 January   2024 AM3351 , AM3352 , AM3354 , AM3356 , AM3357 , AM3358 , AM3358-EP , AM3359 , AM4372 , AM4376 , AM4377 , AM4378 , AM4379 , AM620-Q1 , AM623 , AM625 , AM625-Q1 , AM625SIP , AM62A3 , AM62A3-Q1 , AM62A7 , AM62A7-Q1 , AM62P , AM62P-Q1

 

  1.   1
  2.   摘要
  3.   商标
  4. 1引言
  5. 2当前设计
  6. 3支持
  7. 4演示
  8. 5总结
  9. 6参考资料

支持

我们的演示使用了 SK-AM62B,有关该器件的更多信息,请参阅以下链接:https://www.ti.com.cn/tool/cn/SK-AM62B。关于软件,可以按照以下步骤使用 Yocto 编译演示:

  1. 对于您的 Ubuntu 主机,下载先决程序:https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/09_00_00_03/exports/docs/linux/Overview_Building_the_SDK.html#prerequisites-one-time-setup。
  2. git clone https://git.ti.com/git/arago-project/oe-layersetup.git tisdk
  3. cd tisdk
  4. ./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-09.00.00-config.txt
  5. cd sources
  6. git clone -b kirkstone https://github.com/kraj/meta-clang.git
  7. cd meta-arago/meta-arago-demos/recipes-apps
  8. mkdir matter && cd matter
  9. 创建一个名为 matter_git.bb 的文件并添加以下内容:
    SUMMARY = "Matter IoT connectivity on TI boards"
    DESCRIPTION = "This recipe primes the matter environment"
    LICENSE = "Apache-2.0"
    LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
    
    BRANCH = "master"
    SRC_URI = "gitsm://github.com/project-chip/connectedhomeip.git;protocol=https;branch=${BRANCH};lfs=1"
    
    SRCREV = "a98bc64856aa161197e7dc7c1ffbdcc43323eda3"
    
    do_matter_bootstrap[network] = "1"
    do_compile[network] = "1"
    
    TARGET_CC_ARCH += "${LDFLAGS}"
    DEPENDS += " glib-2.0 gn-native ninja-native avahi dbus-glib-native pkgconfig-native python3-native boost zap-native openssl-native ca-certificates-native clang-native"
    RDEPENDS_${PN} += " libavahi-client openssl "
    FILES:${PN} += "usr/share"
    INSANE_SKIP:${PN} += "dev-so debug-deps strip"
    
    PACKAGECONFIG ?= ""
    PACKAGECONFIG[debug] = "is_debug=true,is_debug=false"
    
    GN_TARGET_ARCH_NAME:aarch64 = "arm64"
    GN_TARGET_ARCH_NAME:arm = "arm"
    GN_TARGET_ARCH_NAME:x86 = "x86"
    GN_TARGET_ARCH_NAME:x86-64 = "x64"
    
    def gn_target_arch_name(d):
        """Returns a GN architecture name corresponding to the target machine's
        architecture."""
        name = d.getVar("GN_TARGET_ARCH_NAME")
        if name is None:
            bb.fatal('Unsupported target architecture. A valid override for the '
                'GN_TARGET_ARCH_NAME variable could not be found.')
        return name
    
    # this variable must use spaces and double quotes for parameter strings because
    # *gn* is evil
    GN_ARGS = " \
        ${PACKAGECONFIG_CONFARGS} \
        target_cpu="${@gn_target_arch_name(d)}" \
        target_arch="${TUNE_FEATURES}" \
        target_os="linux" \
        treat_warnings_as_errors=false \
        enable_rtti=true \
        enable_exceptions=true \
    "
    
    # Make sure pkg-config, when used with the host's toolchain to build the
    # binaries we need to run on the host, uses the right pkg-config to avoid
    # passing include directories belonging to the target.
    GN_ARGS += 'host_pkg_config="pkg-config-native"'
    
    S = "${WORKDIR}/git"
    
    common_configure() {
        # this block must use spaces and double quotes for strings because *gn* is
        # evil
        PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR} \
        PKG_CONFIG_LIBDIR=${PKG_CONFIG_PATH} \
        gn gen out/ --args='
            ${GN_ARGS}
            import("//build_overrides/build.gni")
            target_cflags=[
                "-DCHIP_DEVICE_CONFIG_WIFI_STATION_IF_NAME=\"wlan0\"",
                "-DCHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD=\"udhcpc -b -i %s \"",
            ]
            custom_toolchain="${build_root}/toolchain/custom"
            target_cc="${CC}"
            target_cxx="${CXX}"
            target_ar="${AR}"
        '
    }
    
    export https_proxy
    export http_proxy
    export ftp_proxy
    export no_proxy
    
    do_matter_bootstrap() {
        . ${S}/scripts/bootstrap.sh
    }
    
    do_configure() {
        . scripts/activate.sh
        pip install click
    
        cd ${S}/examples/chip-tool
        common_configure
    
        cd ${S}/examples/lock-app/linux
        common_configure
    
        cd ${S}/examples/thermostat/linux
        common_configure
    
        cd ${S}/examples/lighting-app/linux
        common_configure
    }
    
    do_compile() {
        . scripts/activate.sh
    
        cd ${S}/examples/chip-tool
        ninja -C out/
    
        cd ${S}/examples/lock-app/linux
        ninja -C out/
    
        cd ${S}/examples/thermostat/linux
        ninja -C out/
    
        cd ${S}/examples/lighting-app/linux
        ninja -C out/
    }
    
    do_install() {
        install -d -m 755 ${D}${bindir}
    
        # Install chip-tool
        install ${S}/examples/chip-tool/out/chip-tool ${D}${bindir}
    
        # lock-app
        install ${S}/examples/lock-app/linux/out/chip-lock-app ${D}${bindir}
        install ${S}/examples/thermostat/linux/out/thermostat-app ${D}${bindir}
        install ${S}/examples/lighting-app/linux/out/chip-lighting-app ${D}${bindir}
    }
    
    addtask matter_bootstrap after do_unpack before do_configure
    
    INSANE_SKIP_${PN} = "ldflags"
  10. 创建一个名为 zap_git.bb 的文件并添加以下内容:
    PN = "zap-native"
    SUMMARY = "ZAP prebuilt tools"
    DESCRIPTION = "ZAP prebuilt binaries"
    LICENSE = "Apache-2.0"
    LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
    
    PACKAGES = "${PN}"
    
    PV = "v2023.08.04-nightly"
    SRC_URI = "https://github.com/project-chip/zap/releases/download/${PV}/zap-linux-x64.zip;unpack=yes"
    SRC_URI[sha256sum] = "b254a0c066ef6b1fe7c2bdd1ab5b137ca80413f0952dfe6e64f4b0fdc4479b55"
    
    S = "${WORKDIR}"
    
    #INSANE_SKIP:${PN} = " already-stripped arch file-rdeps "
    BBCLASSEXTEND = "native"
    INHIBIT_PACKAGE_STRIP = "1"
    INHIBIT_SYSROOT_STRIP = "1"
    INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
    INHIBIT_FILE_RDEPS = "1"
    INHIBIT_PACKAGE_DEBUG_SPLIT_CHECK = "1"
    INHIBIT_PACKAGE_DEPMODE_CHECK = "1"
    INHIBIT_PACKAGE_RELOCATE = "1"
    INHIBIT_PACKAGE_UNPACK = "1"
    
    INSANE_SKIP:${PN} += "dev-so"
    inherit native
    
    do_install() {
        install -d -m 0755 ${D}${bindir}/
        cp -ar zap* ${D}${bindir}/
        # This is a workaround to bypass the issue that zap-cli modified by build system
        chmod 444 ${D}${bindir}/zap-cli
    }
    
    do_package_qa[noexec] = "1"
    EXCLUDE_FROM_SHLIBS = "1"
    
    # This is a workaround to bypass the issue that zap-cli modified by build system
    do_deploy() {
    chmod 755 ${D}${bindir}/zap-cli
    }
    
    do_populate_sdk:append() {
    chmod 755 ${D}${bindir}/zap-cli
    }
    
    addtask deploy after do_install do_populate_sysroot
    addtask deploy before do_cleansstate
    addtask deploy before do_clean
  11. cd ../../../../../
  12. cd sources/bitbake/lib/bb/fetch2/
  13. 按如下方式修改 gitsm.py:
    diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py
    index c5f7c03c..ee852224 100644
    --- a/lib/bb/fetch2/gitsm.py
    +++ b/lib/bb/fetch2/gitsm.py
    @@ -122,6 +122,7 @@ class GitSM(Git):
        url += ';protocol=%s' % proto
        url += ";name=%s" % module
        url += ";subpath=%s" % module
    +   url += ";lfs=1"
    
        ld = d.createCopy()
        # Not necessary to set SRC_URI, since we're passing the URI to
    @@ -238,7 +239,7 @@ class GitSM(Git):
        # All submodules should already be downloaded and configured in the tree. This simply sets
        # up the configuration and checks out the files. The main project config should remain
    # unmodified, and no download from the internet should occur.
    -   runfetchcmd("%s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir)
    +   runfetchcmd("GIT_LFS_SKIP_SMUDGE=1 %s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir)
    
    def implicit_urldata(self, ud, d):
        import shutil, subprocess, tempfile
  14. cd ../../../../../build/
  15. 打开文件 conf/local.conf 并在文件底部添加以下内容:IMAGE_INSTALL:append = "matter"
  16. . conf/setenv
  17. MACHINE=am62xx-evm bitbake-layers add-layer ../sources/meta-clang/
  18. MACHINE=am62xx-evm bitbake tisdk-default-image
  19. 使用以下目录中生成的 WIC 映像烧录 SD 卡:./arago-tmp-default-glibc/deploy/images/am62xx-evm/tisdk-default-image-am62xx-evm.wic.xz

生成 wic 映像后,请参阅以下使用 SD 卡启动 EVM 的说明:https://dev.ti.com/tirex/content/tirex-product-tree/am62x-devtools/docs/am62x_skevm_quick_start_guide.html