i.MX Processors Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX Processors Knowledge Base

Discussions

Sort by:
One of the most important features of Yocto is its ability to handle sublayers. To understand the sublayers please Yocto Project Development Manual Start creating meta-custom folder, then create the other folders. For example: meta-daiane/ ├── conf │   └── layer.conf ├── README ├── recipes-core │   └── helloworld │       ├── helloworld │       │   └── hello_world.c │       └── helloworld_0.0.bb └── recipes-daiane     └── images         └── dai-image-hello.bb It´s possible to create recipes-kernel and place there your defconfig, or create a bbappend to apply your patches to kernel, or even create a recipes-multimedia and place there custom application for gstreamer, for example. Here, the custom application example is a helloworld application. One important tip: Yocto see recipes name as PACKAGENAME_VERSION.bb, It means, yocto uses "_" (underline) to separate the package name from package version on a recipe file name. So, if you call your helloworld application as hello_world_1.0.bb Yocto will think your application is called "hello" and the version is something around "world_1.0" Please, be careful. LAYER.CONF This is the file that gives new layer live. Find the content of mine layer.conf below: # We have a conf and classes directory, add to BBPATH BBPATH .= ":${LAYERDIR}" # We have a packages directory, add to BBFILES BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \             ${LAYERDIR}/recipes-*/*/*.bbappend" BBFILE_COLLECTIONS += "daiane" BBFILE_PATTERN_daiane := "^${LAYERDIR}/" BBFILE_PRIORITY_daiane = "4" As soon as the new custom layer is created, it MUST include it to  conf/bblayers.conf file. Please see the example: LCONF_VERSION = "6" BBPATH = "${TOPDIR}" BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" BBFILES ?= "" BBLAYERS = " \   ${BSPDIR}/sources/poky/meta \   ${BSPDIR}/sources/poky/meta-yocto \   \   ${BSPDIR}/sources/meta-openembedded/meta-oe \   \   ${BSPDIR}/sources/meta-fsl-arm \   ${BSPDIR}/sources/meta-fsl-arm-extra \   ${BSPDIR}/sources/meta-fsl-demos \   \   ${BSPDIR}/sources/meta-daiane \ " Please, find the tarball with sample meta layer attached to this document. It includes one image that will install the Hello World application: $ bitbake dai-image-hello When the content of image tar ball is extracted, hello_world was installed and it was for ARM: $ find -name hello* ./usr/bin/hello_world $ file ./usr/bin/hello_world ./usr/bin/hello_world: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped Go to Yocto Training - HOME Go to Task #9 - How to add bad/ugly
View full article
Sometimes it is helpful/faster to build a i.MX8MM boot binary outside of the Yocto environment. There are instructions on how to accomplish this on different places, this document tries to provide an example for the i.MX8M Mini LPDDR4 EVK, whenever possible pointing how to build for other boards. For the 8MM SoC a boot image is generated by imx-mkimage tool and requires: - u-boot - ARM trusted firmware image - ddr training firmware 1. Download and Build u-boot: mkdir imx-boot-bin cdimx-boot-bin git clone https://source.codeaurora.org/external/imx/uboot-imx.git cd uboot-imx/ git checkout -b imx_v2019.04_4.19.35_1.1.0 origin/imx_v2019.04_4.19.35_1.1.0 (Optional) Here you can "git log -1" to check that the commit matches SRCREV on the recipe. Next, use the BSP SDK script to setup the cross compilation environment, instructions on how to build it are here. source /opt/fsl-imx-wayland/4.19-warrior/environment-setup-aarch64-poky-linux export ARCH=arm Build make clean Supported boards have configuration files on "configs". Using the LPDDR4 EVK here: make imx8mm_evk_defconfig make 2.   Download and build the ARM Trusted Firmware cd .. git clone https://source.codeaurora.org/external/imx/imx-atf.git cd imx-atf/ git checkout -b imx_4.19.35_1.1.0 origin/imx_4.19.35_1.1.0 (Optional) Again, you can "git log -1" to check that the commit matches SRCREV on the recipe. https://source.codeaurora.org/external/imx/meta-fsl-bsp-release/tree/imx/meta-bsp/recipes-bsp/imx-atf/imx-atf_2.0.bb?h=warrior-4.19.35-1.1.0 Build: make PLAT=imx8mm bl31 If you run into this error: aarch64-poky-linux-ld.bfd: unrecognized option '-Wl,-O1' aarch64-poky-linux-ld.bfd: use the --help option for usage information make: *** [Makefile:712: build/imx8mm/release/bl31/bl31.elf] Error 1 try:  unset LDFLAGS make PLAT=imx8mm bl31 3. Download the LPDDR4 training binaries It is on firmware-imx, recipe is here: https://source.codeaurora.org/external/imx/meta-fsl-bsp-release/tree/imx/meta-bsp/recipes-bsp/firmware-imx?h=warrior-4.19.35-1.1.0 cd .. mkdir firmware-imx cd firmware-imx wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.5.bin chmod a+x firmware-imx-8.5.bin ./firmware-imx-8.5.bin 4. Download imx-mkimage and build the boot image cd .. git clone https://source.codeaurora.org/external/imx/imx-mkimage.git cd imx-mkimage/ git checkout -b imx_4.19.35_1.1.0 origin/imx_4.19.35_1.1.0 (Optional) "git log -1" matches SRCREV on: https://source.codeaurora.org/external/imx/meta-fsl-bsp-release/tree/imx/meta-bsp/recipes-bsp/imx-mkimage/imx-mkimage_git.inc?h=warrior-4.19.35-1.1.0 Now, you can check the build targets and required binaries at iMX8M/soc.mak For the flash_evk for the imx8mm we will need binaries: u-boot: u-boot-spl.bin, u-boot-nodtb.bin, fsl-imx8mm-evk.dtb  ARM trusted firmware: bl31.bin LPDDR4 files: lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin mkimage for mkimage_uboot Copy all these to imx-mkimage/iMX8M/ cp ../uboot-imx/spl/u-boot-spl.bin iMX8M/ cp ../uboot-imx/u-boot-nodtb.bin iMX8M/ cp ../uboot-imx/arch/arm/dts/fsl-imx8mm-evk.dtb iMX8M/ cp ../imx-atf/build/imx8mm/release/bl31.bin iMX8M/ cp ../firmware-imx/firmware-imx-8.5/firmware/ddr/synopsys/lpddr4_pmu_train_* iMX8M/ cp ../uboot-imx/tools/mkimage iMX8M/mkimage_uboot Build: make SOC=iMX8MM flash_evk Output binary is on ./iMX8M/flash.bin 5. Program on the SD Card: sudo dd if=iMX8M/flash.bin of=/dev/<path to your sd> bs=1024 seek=33
View full article
i.MX6DQ HDMI dongle board uses BCM4330 which is SDIO interface as wireless module. When we try to run Ubuntu oneiric on HDMI dongle board, after correctly insmod bcm4330.ko, we found Ubuntu NetworkManger can't recognize this interface: the /var/log/syslog shows the following error: Jan  1 00:01:08 linaro-ubuntu-desktop NetworkManager[4787]:    SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/wlan0, iface: wlan0) Jan  1 00:01:08 linaro-ubuntu-desktop NetworkManager[4787]:    SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/wlan0, iface: wlan0): no ifupdown configuration found. Jan  1 00:01:08 linaro-ubuntu-desktop NetworkManager[4787]: <warn> /sys/devices/virtual/net/wlan0: couldn't determine device driver; ignoring... After using Google search, we found /sys/devices/virtual/net/wlan0 directory dose not has directory "device", this "device" directory should be exist at network interface, without it, NetworkManager will get error "couldn't determine device driver; ignoring...",  the "device" is just this network interface come from, and it should link to the real device under one hardware bus. While the bcm4330 Linux driver from Broadcom does not setup network interface real "device" so we need add this real "device" before the driver registers a network interface. Refer to the attached diff file for this modification
View full article
    OpenSSL is popular software library for applications that secure communications over computer networks against eavesdropping or need to identify the party at the other end. It is widely used in internet web servers, serving a majority of all web sites. OpenSSL contains an open-source implementation of the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols, it is a robust, commercial-grade, and full-featured toolkit for the SSL and TLS protocols. OpenSSL is also a general-purpose cryptography library. Its core library, written in the C programming language, implements basic cryptographic functions and provides various utility functions. Wrappers allowing the use of the OpenSSL library in a variety of computer languages are available. More and more embeded systems, like IoT gateway, ePOS, based on i.MX use OpenSSL for their secure communications and cryptographic operations. But it's cryptography library is pure software implementation which need to occupy lots of CPU resouce and the perfermance is very weak than dedicated hardware IP (like CAAM).    CAAM is the i.MX's cryptographic acceleration and assurance module, which serves as NXP's latest cryptographic acceleration and offloading hardware. It combines functions previously implemented in separate modules to create a modular and scalable acceleration and assurance engine. It also implements block encryption algorithms, stream cipher algorithms, hashing algorithms, public key algorithms (i.MX6UL/i.MX7D/S), and a hardware random number generator.   The official Yocto release (L4.1.15_2.0.0-ga) of the i.MX only enable cryptodev for accelerating symmetric algorithms and hashing algorithms, not support asymmetric algorithms(RSA, ECC). And its engine in OpenSSL(version 1.0.2h) also miss some features which is used to support symmetric algorithms and hashing algorithms, for example, AES ECB, SHA224/256, etc. These patches in the post will close the above gaps for i.MX Linux system. The software environments as the belows: Linux kernel: imx_4.1.15_2.0.0_ga cryptodev: 1.8 OpenSSL: 1.0.2h The patches include the following key features: 1, Add public key cryptography part in CAAM driver, through protocol commands, to implement a number of public (and private) key functions. These are DSA and ECDSA sign/verify, Diffie-Hellman (DH) and ECDH key agreement, ECC key generation, DLC key generation, RSA encryption/decryption, RSA key-generation finalization. 2, Add big number operation and elliptic curve math in CAAM driver to implement addition, subtraction, multiplication, exponentiation, reduction, inversion, greatest common divisor, prime testing and point add, point double, point multiply. 3, Add API in cryptodev to support RSA encryption/decryption, DSA/ECDSA sign/verify, DH/ECDH key agreement, ECC & DLC & RSA key generation and big number operation and elliptic curve math. 4, Add public key cryptography functions, hardware rng, and missing hash symmetric algorithms in OpenSSL crytodev engine. Note: 1, You can refer to ecdhtest.c, ecdsatest.c, dhtest.c, dsatest.c, rsa_test.c for how to use crytodev engine in your applications based on libcryto.so. You can also find their executable programs in folder openssl-1.0.2h/test after compiling. 2, If you want to call crytodev API directly to accelerate public key cryptography operations, please refer to asymmetric_cipher.c in cryptodev-linux-1.8/tests. Current Limitation: 1, CAAM driver don't support AES GCM/CCM but hardware supporting. I plan to add the feature next version. 2, ECDSA sign/verify will fail on some binary curves (sect163r1, sect163r2, sect193r1, sect193r2, sect233r1, sect283r1, sect409r1, sect571r1 and X9.62 binary curves). I will try to find the root cause and fix it.   ==================================== for  some binary curves (sect163r1, sect163r2, sect193r1, sect193r2, sect233r1, sect283r1, sect409r1, sect571r1 and X9.62 binary curves)  are rarely used, so i will try to find the root cause when i'm free.  +++++++++++++++++++++++    updating for Linux-4.14.78-1.1.10 ++++++++++++++++++++++++++++ This updating is for Yocto release of Linux -4.14.78-1.1.10. The new software environments as the belows: Linux kernel: imx_4.14.78_1.1.10 cryptodev: 1.9 OpenSSL: 1.0.2p HW platform: i.MX6UL, i.MX7D/S, i.MX8M/8M Mini, i.MX8/8X. The patches include the following new features: 1, support  RSA key generation but defaultly use openssl build-in function (BN_generate_prime_ex) to create prime p, q for higher security. If need to use CAAM accelerating,  please comment Macro USE_BUILTIN_PRIME_GENERATION, but don't confirm its security. 2, Add Manufacturing-protection feature, and you can refer to manufacturing_protection_test function in asymmetric_cipher.c. 3, Support AES GCM in cryptodev. 4, git clone https://gitee.com/zxd2021-imx/meta-openssl-caam.git, git checkout Linux-4.14.78-1.1.10 and copy meta-openssl-caam to folder <Yocto 4.14.78-1.1.10 dir>/sources/ 5, Run DISTRO=fsl-imx-wayland MACHINE=imx6ulevk source fsl-setup-release.sh -b build-imx6ulevk and add BBLAYERS += " ${BSPDIR}/sources/meta-openssl-caam " into /build-imx6ulevk/conf/bblayers.conf 6, bitbake fsl-image-validation-imx 7, Run the below command on your i.MX6UL EVK board. modprobe cryptodev openssl genrsa -f4 -engine cryptodev 512 -elapsed openssl speed dsa -engine cryptodev -elapsed openssl genrsa -f4 -engine cryptodev 1024 -elapsed openssl speed rsa -engine cryptodev -elapsed openssl genrsa -f4 -engine cryptodev 2048 -elapsed openssl speed ecdsa -engine cryptodev -elapsed openssl genrsa -f4 -engine cryptodev 3072 -elapsed openssl speed ecdh -engine cryptodev -elapsed openssl genrsa -f4 -engine cryptodev 4096 -elapsed openssl speed -evp sha256 -engine cryptodev -elapsed openssl speed -evp aes-128-cbc -engine cryptodev -elapsed openssl speed -evp aes-128-ecb -engine cryptodev -elapsed openssl speed -evp aes-128-cfb -engine cryptodev -elapsed openssl speed -evp aes-128-ofb -engine cryptodev -elapsed openssl speed -evp des-ede3 -engine cryptodev -elapsed openssl speed -evp des-cbc -engine cryptodev -elapsed openssl speed -evp des-ede3-cfb -engine cryptodev -elapsed +++++++++++++++++++++++    updating for Linux-4.14.98-2.3.3 ++++++++++++++++++++++++++++ This updating is for Yocto release of Linux -4.14.98-2.3.3. The new software environments as the belows: Linux kernel: imx_4.14.98-2.3.3 cryptodev: 1.9 OpenSSL: 1.0.2p HW platform: i.MX6UL, i.MX7D/S, i.MX8M/8M Mini/8M Nano, i.MX8/8X. The patches include the following new features: 1, git clone https://gitee.com/zxd2021-imx/meta-openssl-caam.git, git checkout Linux-4.14.98-2.3.3 and copy meta-openssl-caam to folder <Yocto 4.14.98-2.3.3 dir>/sources/ 2, Run DISTRO=fsl-imx-wayland MACHINE=imx8mmevk source fsl-setup-release.sh -b build-imx8mmevk and add BBLAYERS += " ${BSPDIR}/sources/meta-openssl-caam " into /build-imx8mmevk/conf/bblayers.conf 3, bitbake fsl-image-validation-imx 4, Run the below command on your i.MX8M Mini EVK board. modprobe cryptodev openssl genrsa -f4 -engine cryptodev 512 -elapsed openssl speed dsa -engine cryptodev -elapsed openssl genrsa -f4 -engine cryptodev 1024 -elapsed openssl speed rsa -engine cryptodev -elapsed openssl genrsa -f4 -engine cryptodev 2048 -elapsed openssl speed ecdsa -engine cryptodev -elapsed openssl genrsa -f4 -engine cryptodev 3072 -elapsed openssl speed ecdh -engine cryptodev -elapsed openssl genrsa -f4 -engine cryptodev 4096 -elapsed openssl speed -evp sha256 -engine cryptodev -elapsed openssl speed -evp aes-128-cbc -engine cryptodev -elapsed openssl speed -evp aes-128-ecb -engine cryptodev -elapsed openssl speed -evp aes-128-cfb -engine cryptodev -elapsed openssl speed -evp aes-128-ofb -engine cryptodev -elapsed openssl speed -evp des-ede3 -engine cryptodev -elapsed openssl speed -evp des-cbc -engine cryptodev -elapsed openssl speed -evp des-ede3-cfb -engine cryptodev -elapsed +++++++++++++++++++++++    updating for Linux-4.19.35-1.1.2 ++++++++++++++++++++++++++++ This updating is for Yocto release of Linux 4.19.35-1.1.2​​.  Software environments as the belows: Linux kernel: imx_4.19.35-1.1.2 cryptodev: 1.10 OpenSSL: 1.1.1l HW platform: i.MX6UL, i.MX7D/S, i.MX8M/8M Mini/8M Nano, i.MX8/8X. How to build: 1, git clone https://gitee.com/zxd2021-imx/meta-openssl-caam.git, git checkout Linux-4.19.35-1.1.2 and copy meta-openssl-caam to folder <Yocto 4.19.35-1.1.2 dir>/sources/ 2, Run DISTRO=fsl-imx-wayland MACHINE=imx8mmevk source imx-setup-release.sh -b build-imx8mmevk and add BBLAYERS += " ${BSPDIR}/sources/meta-openssl-caam " into <Yocto 4.19.35-1.1.2 dir>/build-imx8mmevk/conf/bblayers.conf. 3, Run bitbake fsl-image-validation-imx. 4, Run the below command on your i.MX8M Mini EVK board. modprobe cryptodev openssl speed dsa openssl speed rsa openssl speed ecdsa openssl speed ecdh openssl genrsa -f4 -engine devcrypto 512 openssl genrsa -f4 -engine devcrypto 1024 openssl genrsa -f4 -engine devcrypto 2048 openssl genrsa -f4 -engine devcrypto 3072 openssl genrsa -f4 -engine devcrypto 4096 openssl speed -evp sha256 -engine devcrypto -elapsed openssl speed -evp aes-128-cbc -engine devcrypto -elapsed openssl speed -evp aes-128-ecb -engine devcrypto -elapsed openssl speed -evp aes-128-cfb -engine devcrypto -elapsed openssl speed -evp aes-128-ofb -engine devcrypto -elapsed openssl speed -evp des-ede3 -engine devcrypto -elapsed openssl speed -evp des-cbc -engine devcrypto -elapsed openssl speed -evp des-ede3-cfb -engine devcrypto -elapsed +++++++++++++++++++++++    updating for Linux-5.4.70-2.3.4 ++++++++++++++++++++++++++++ This updating is for Yocto release of Linux 5.4.70_2.3.4​​.  Software environments as the belows: Linux kernel: imx_5.4.70_2.3.4 cryptodev: 1.10 OpenSSL: 1.1.1l HW platform: i.MX6UL, i.MX7D/S, i.MX8M/8M Mini/8M Nano/8M Plus, i.MX8/8X. How to build: 1, git clone https://gitee.com/zxd2021-imx/meta-openssl-caam.git, git checkout Linux-5.4.70-2.3.4  and copy meta-openssl-caam to folder <Yocto 5.4.70_2.3.4 dir>/sources/ 2, Run DISTRO=fsl-imx-wayland MACHINE=imx8mmevk source imx-setup-release.sh -b build-imx8mmevk and add BBLAYERS += " ${BSPDIR}/sources/meta-openssl-caam " into <Yocto 5.4.70_2.3.4 dir>/build-imx8mmevk/conf/bblayers.conf. 3, Run bitbake imx-image-multimedia. 4, Run the below command on your i.MX8M Mini EVK board. modprobe cryptodev openssl speed dsa openssl speed rsa openssl speed ecdsa openssl speed ecdh openssl genrsa -f4 -engine devcrypto 512 openssl genrsa -f4 -engine devcrypto 1024 openssl genrsa -f4 -engine devcrypto 2048 openssl genrsa -f4 -engine devcrypto 3072 openssl genrsa -f4 -engine devcrypto 4096 openssl speed -evp sha256 -engine devcrypto -elapsed openssl speed -evp aes-128-cbc -engine devcrypto -elapsed openssl speed -evp aes-128-ecb -engine devcrypto -elapsed openssl speed -evp aes-128-cfb -engine devcrypto -elapsed openssl speed -evp aes-128-ofb -engine devcrypto -elapsed openssl speed -evp des-ede3 -engine devcrypto -elapsed openssl speed -evp des-cbc -engine devcrypto -elapsed openssl speed -evp des-ede3-cfb -engine devcrypto -elapsed     +++++++++++++++++++++++    updating for Linux-5.10.52-2.1.0 ++++++++++++++++++++++++++++ This updating is for Yocto release of Linux 5.10.52_2.1.0​​.  Software environments as the belows: Linux kernel: lf-5.10.y cryptodev: 1.12 OpenSSL: 1.1.1l HW platform: i.MX6UL, i.MX7D/S, i.MX8M/8M Mini/8M Nano/8M Plus, i.MX8/8X. How to build: 1, git clone https://gitee.com/zxd2021-imx/meta-openssl-caam.git, git checkout Linux-5.10.52-2.1.0 and copy meta-openssl-caam to folder <Yocto 5.10.52_2.1.0 dir>/sources/ 2, Run DISTRO=fsl-imx-xwayland MACHINE=imx8mmevk source imx-setup-release.sh -b build-imx8mmevk and add BBLAYERS += " ${BSPDIR}/sources/meta-openssl-caam " into <Yocto 5.10.52_2.1.0 dir>/build-imx8mmevk/conf/bblayers.conf. 3, Run bitbake imx-image-multimedia. 4, Run the below command on your i.MX8M Mini EVK board. modprobe cryptodev openssl speed dsa openssl speed rsa openssl speed ecdsa openssl speed ecdh openssl genrsa -f4 -engine devcrypto 512 openssl genrsa -f4 -engine devcrypto 1024 openssl genrsa -f4 -engine devcrypto 2048 openssl genrsa -f4 -engine devcrypto 3072 openssl genrsa -f4 -engine devcrypto 4096 openssl speed -evp sha256 -engine devcrypto -elapsed openssl speed -evp aes-128-cbc -engine devcrypto -elapsed openssl speed -evp aes-128-ecb -engine devcrypto -elapsed openssl speed -evp aes-128-cfb -engine devcrypto -elapsed openssl speed -evp aes-128-ofb -engine devcrypto -elapsed openssl speed -evp des-ede3 -engine devcrypto -elapsed openssl speed -evp des-cbc -engine devcrypto -elapsed openssl speed -evp des-ede3-cfb -engine devcrypto -elapsed   +++++++++++++++++++++++    updating for Linux-5.15.71-2.2.0 ++++++++++++++++++++++++++++ This updating is for Yocto release of Linux 5.15.71-2.2.0​​.  Software environments as the belows: Linux kernel: lf-5.15.71-2.2.0 cryptodev: 1.12 OpenSSL: 3.1.0 HW platform: i.MX6UL, i.MX7D/S, i.MX8M/8M Mini/8M Nano/8M Plus, i.MX8/8X. How to build: 1, git clone https://gitee.com/zxd2021-imx/meta-openssl-caam.git, git checkout Linux-5.15.71-2.2.0 and copy meta-openssl-caam to folder <Yocto 5.15.71_2.2.0 dir>/sources/ 2, Run DISTRO=fsl-imx-xwayland MACHINE=imx8mmevk source imx-setup-release.sh -b build-imx8mmevk and add BBLAYERS += " ${BSPDIR}/sources/meta-openssl-caam " into <Yocto 5.15.71_2.2.0 dir>/build-imx8mmevk/conf/bblayers.conf. 3, Run bitbake imx-image-multimedia. 4, Run the below command on your i.MX8M Mini EVK board. modprobe cryptodev openssl speed sm2 openssl speed dsa openssl speed rsa openssl speed ecdsa openssl speed ecdh openssl genrsa -f4 -engine devcrypto 512 openssl genrsa -f4 -engine devcrypto 1024 openssl genrsa -f4 -engine devcrypto 2048 openssl genrsa -f4 -engine devcrypto 3072 openssl genrsa -f4 -engine devcrypto 4096 openssl speed -evp sha256 -engine devcrypto -elapsed openssl speed -evp aes-128-cbc -engine devcrypto -elapsed openssl speed -evp aes-128-ecb -engine devcrypto -elapsed openssl speed -evp aes-128-cfb -engine devcrypto -elapsed openssl speed -evp aes-128-ofb -engine devcrypto -elapsed openssl speed -evp des-ede3 -engine devcrypto -elapsed openssl speed -evp des-cbc -engine devcrypto -elapsed openssl speed -evp des-ede3-cfb -engine devcrypto -elapsed    
View full article
Introduction LVDS display panel driving data flow: Display quality: To get the best display quality for 24bit LVDS display panel in Android, we should use 32bit framebuffer, make IPUv3 display Engine and LDB output 24bit pixels, since RGB component information is aligned from source to destination.  2 stages to enable display: Uboot splash screen and Kernel framebuffer Guidelines Uboot splash screen:    Change should be done in board file, like board/freescale/mx6q_sabresd/mx6q_sabresd.c:    1. Set video mode in struct fb_videomode according to the new 24bit LVDS display panel’s spec(please, refer to the example at the end of this doc).    2. Set up pwm, iomux/display related clock trees in lcd_enable(). Note that these should be aligned with Kernel settings to support smooth UI transition        from Uboot splash screen to Kernel framebuffer.    3. Set the output pixel format of IPUv3 display engine and LDB to IPU_PIX_FMT_RGB24 when calling ipuv3_fb_init().    4. Set pixel clock according to the new 24bit LVDS display panel’s spec when calling ipuv3_fb_init().    5. If dual LDB channels are needed to support tough display video mode(high resolution or high pixel clock frequency), we need to enable both of the two LDB        channels and set LDB to work at split mode. LDB_CTRL register should be set accordingly in lcd_enable(). Kernel framebuffer:    As we may add ‘video=‘  and ‘ldb=’ options in kernel bootup command line, Kernel code is more flexible to handle different LVDS display panels with various display color depth than Uboot code. For detail description of ‘video=’ and ‘ldb=’ option, please refer to MXC Linux BSP release notes and Android User Guide. Some known points are:    1. Add a video mode in struct fb_videomode in drivers/video/mxc/ldb.c according to the new 24bit LVDS display panel’s spec(please, refer to the example at        the end of this doc).    2. Set up pwm backlight/display related iomux in platform code.   3. Set appropriate ‘video=‘ option in kernel bootup command line, for example:        video=mxcfb0:dev=ldb,LDB-NEW,if=RGB24,fbpix=RGB32     4. Set appropriate ‘ldb=‘ option in kernel bootup command line if dual LDB channels are needed to support tough display video mode, for example:        ldb=spl0 (IPUv3 DI0 is used)  or  ldb=spl1 (IPUv3 DI1 is used)    5. Set appropriate ‘fbmem=‘ option in kernel bootup command line to reserve enough memory for framebuffer. For example, if we use 1280x800 LVDS panel        for fb0 and fb0 is in RGB32 pixel format, then ‘fbmem=12M’ should be used, since the formula is:        fbmem= width*height*3(triple buf)*Bytes_per_pixel= 1280*800*3*4B=12MB An Example to Set struct fb_videomode:    Let’s take a look at the timing description quoted from a real 1280x800@60 24bit LVDS panel spec: And, standard linux struct fb_videomode definition in include/linux/fb.h: struct fb_videomode {         const char *name;       /* optional */         u32 refresh;            /* optional */         u32 xres;         u32 yres;         u32 pixclock;         u32 left_margin;         u32 right_margin;         u32 upper_margin;         u32 lower_margin;         u32 hsync_len;         u32 vsync_len;         u32 sync;         u32 vmode;                u32 flag; };    What we need to do is to set every field of struct fb_videomode correctly according to the timing description of LVDS display panel’s spec:     1. name: we can set it to ‘LDB-WXGA’.    2. refresh: though it’s optional, we can set it to typical value, that is, 60(60Hz refresh rate).    3. xres: the active width, that is, 1280.    4. yres: the active height, that is, 800.    5. pixclock: calculate with this formula – pixclock=(10^12)/clk_freq. Here, typically, for this example, pixclock=(10^12)/71100000=14065.    6. left_margin/right_margin/hsync_len:        They are the same to HS Back Porch(HBP)/HS Front Porch(HFP)/HS Width(HW) in the spec. Since the spec only tells us that typically        HBP+HFP+HW=160. We may set left_margin=40, right_margin=40, hsync_len=80.    7. upper_margin/lower_margin/vsync_len:        Similar to horizontal timing, the vertical ones can be set to upper_margin=10, lower_margin=3, vsync_len=10.    8. sync: Since the timing chart tells us that hsync/vsync are active low, so we don’t need to set FB_SYNC_HOR_HIGH_ACT or        FB_SYNC_VERT_HIGH_ACT. Moreover, clock polarity and data polarity are invalid, so we set sync to be zero here.    9. vmode: this is a progressive video mode, so set vmode to FB_VMODE_NONINTERLACED.    10. flag: the video mode is provided by driver, so set flag to FB_MODE_IS_DETAILED.
View full article
The instructions is based on building wayland-weston on Ubuntu prebuilt image. The same can be applied to other build systems as well. PREREQUISITIES The following is the software environment required: - Ubuntu Oneiric (11.10) distribution. (Download Pre-built Ubuntu demo image from www.freescale.com/imx6) - Wayland/Weston : Wayland dependencies are listed in http://wayland.freedesktop.org/building.html. - 0001-DRM-condition.patch and 0002-Enable-weston-for-Vivante-GPU.patches for Weston. WAYLAND VERSION This release is based on Wayland 1.1.0 version. BUILDING The steps are based on wayland building from http://wayland.freedesktop.org/building.html. Download wayland-1.1.0.tar.xz from http://wayland.freedesktop.org/releases.html    3. Setting up the environment. This need to be performed on the target $export WLD=/usr $export LD_LIBRARY_PATH=$WLD/lib $export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/ $export ACLOCAL="aclocal -I $WLD/share/aclocal"        Also, create the 'share/aclocal' directory.                $mkdir -p $WLD/share/aclocal       Let us consider, extracting the package to /opt $cd /opt $tar xvvf wayland-1.1.0.tar.xz $cd wayland-1.1.0 $ ./configure --prefix=$WLD --disable-documentation $ make $ make install   4. Setting up GPU-VIV graphics drivers The GPU-VIV graphics drivers are available as part of BSP release. Get the gpu-viv-wl-bin-mx6q-{VER}.tar.gz for 4.0.0 release gpu-viv-wl-bin-mx6q-3.0.35-4.0.0.tar.gz from the BSP-Source/pkgs Extract to the target $ROOTFS The prebuilt root file system (rootfs) may come with prebuilt GPU driver. By default, it may set to EGL framebuffer. To enable Wayland/Weston support, make EGL and GAL point to correct binaries as shown below: $ ls –l $(ROOTFS)/usr/lib/libEGL.so* libEGL.so -> libEGL-wl.so libEGL.so.1 -> libEGL-wl.so $ ls –l $(ROOTFS)/usr/lib/libGAL.so                            libGAL.so -> libGAL-wl.so   5. Build the libxkbcommon as in http://wayland.freedesktop.org/building.html 6. We will need Cairo stack as Weston clients depend on Cairo for rendering. Please build Cairo as described in http://wayland.freedesktop.org/building.html, but note that, for now, we do not enable gl backend for Cairo, so the '--enable-gl --enable-xcb' flags must not be used when building. 7. Building Weston     Now add the following environment settings in the terminal window. (Note the "`"- backtick - character). export WLD=/usr export LD_LIBRARY_PATH=$WLD/lib export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/ export ACLOCAL="aclocal -I $WLD/share/aclocal" export LD_LIBRARY_PATH="/usr/lib" export LDFLAGS="-lwayland-server -lwayland-client -lwayland-server -lwayland-cursor -lpixman-1" export COMPOSITOR_LIBS="-lGLESv2 -lEGL -lGAL -lwayland-server -lxkbcommon -lpixman-1" export COMPOSITOR_CFLAGS="-I $WLD/include -I $WLD/include/pixman-1 -L$SDK_DIR/drivers -DLINUX=1 -DEGL_API_FB -DEGL_API_WL" export CLIENT_CFLAGS="-I $WLD/include -I $WLD/include/cairo -I $WLD/include/pixman-1" export CLIENT_LIBS="-lGLESv2 -lEGL -lwayland-client -lwayland-cursor -lxkbcommon" export SIMPLE_EGL_CLIENT_CFLAGS="-DLINUX=1 -DEGL_API_FB -DEGL_API_WL -I $WLD/include" export SIMPLE_EGL_CLIENT_LIBS="-lGLESv2 -lEGL -lwayland-client -lwayland-cursor" export IMAGE_LIBS="-lwayland-cursor" export WESTON_INFO_LIBS="-lwayland-client" Apply the two patches 0001-DRM-condition.patch and 0002-Enable-weston-for-Vivante-GPU.patch. Build the Weston. $cd /opt $tar xvvf weston-1.1.1.tar.xz $ cd weston-1.1.1     $ ./configure --prefix=$WLD \         --disable-setuid-install \         --disable-x11-compositor --disable-drm-compositor \         --disable-rpi-compositor --disable-wayland-compositor \         --disable-weston-launch --disable-libunwind \         --disable-xwayland-test \ WESTON_NATIVE_BACKEND="fbdev-backend.so" $ make $ make install RUNNING Also, Weston must be run as root. copy weston.ini and weston-desktop-shell.ini to /root/.config/ . In terminal window, export LD_LIBRARY_PATH="/usr/lib" export XDG_RUNTIME_DIR=/tmp Execute 'src/weston'. You should see a blue screen fading in. In a different terminal, enter 'clients/simple-shm &'. You should see a scrolling color pattern. You can then enter 'clients/simple-egl &' to see a 3D client  action.
View full article
Dear all, Below a small howto to get rid of the usual file copy to your rootfs. This is my way of automatically include files to my generated image under yocto. 1. Create a recipe Under source/meta Below in plain text: SUMMARY = "My test videos" DESCRIPTION = "Test Videos" HOMEPAGE = "" LICENSE = "CLOSED" MY_FILES = "/home/freerod/Videos/demo_video_VGA_25fps.MP4" inherit allarch do_install() { install -d ${D}${datadir}/movies install -m 0644 ${MY_FILES} ${D}${datadir}/movies/ } FILES_${PN} += "${datadir}/movies" This aims at creating a movies directory in: /usr/share/movies within the rootfs, with the named demo_video_VGA_25fps.MP4 in it 2. CORE_IMAGE_EXTRA_INSTALL += "myvideos" 3. Check that the video will be put into the generated rootfs: freerod@ubuntu:~/mx6/fsl-yocto-3.14.28_1.0.0/build_mx6dl$ ll tmp/work/all-poky-linux/myvideos/1.0-r0/packages-split/myvideos/usr/share/movies/demo_video_VGA_25fps.MP4 -rw-r--r-- 2 freerod freerod 14076709 Jun  2 01:40 tmp/work/all-poky-linux/myvideos/1.0-r0/packages-split/myvideos/usr/share/movies/demo_video_VGA_25fps.MP4
View full article
If you want to use a USB camera (these types of cameras are also called 'Web Cameras') with GStreamer on i.MX6 devices (Linux Kernel version >= 3.035), you need to either load the module dynamically or compile and link statically selecting (Y) the following config on the Kernel configuration      Device Drivers -> Multimedia support -> Video capture adapters -> V4L USB devices -> <*> USB Video Class (UVC) After the Kernel image has been built, flash it into the target, plug the web cam, then on a (target) terminal run      gst-launch v4l2src ! mfw_v4lsink You should see what the camera is capturing on the display. In case you need to encode the camera src data, you need to place the encoder into the pipeline      gst-launch v4l2src num-buffers=100  ! queue ! vpuenc codec=0 ! matroskamux ! filesink location=output.mkv sync=false We are using a certain codec (codec=0 means mpeg4), check options using 'gst-inspect vpuenc'.
View full article
Application Note AN13872  Enabling SWUpdate on i.MX 6ULL, i.MX 8M Mini, and i.MX 93 is available on www.nxp.com    SWUpdate: Embedded Systems become more and more complex. Software for Embedded Systems have new features and fixes can be updated in a reliable way. Most of time, we need OTA(Over-The-Air) to upgrade the system. Like Android has its own update system. Linux also need an update system. SWUpdate project is thought to help to update an embedded system from a storage media or from network. However, it should be mainly considered as a framework, where further protocols or installers (in SWUpdate they are called handlers) can be easily added to the application. Mongoose daemon mode: Mongoose is a daemon mode of SWUpdate that provides a web server, web interface and web application. Mongoose is running on the target board(i.MX8MM EVK/i.MX8QXP MEK).Using Web browser to access it.   Suricatta daemon mode: Suricatta regularly polls a remote server for updates, downloads, and installs them. Thereafter, it reboots the system and reports the update status to the server. The screenshot is SWUpdate scuricatta working with hawkbit server.          
View full article
Introduction This is a sharing of my experience about porting the audio codec WM8960 in Linux BSP. I know this driver is not the perfect one.  If you find any place is not good in the driver, please let me know. This driver is modified base on the wm8960.c in L3.0.35 Linux BSP. This document is talking about how to modify the codec driver. The Audio Codec driver is located in linux/sound/soc/codec/wm8960.c. ALSA The Audio Codec driver is based on ALSA to setup up all the things. For details, please see : AlsaProject Advanced Linux Sound Architecture - Wikipedia, the free encyclopedia. kcontrols are defined in linux/include/sound/soc.h and soc-dapm.h. Audio controls and path in WM8960 Left and Right Input signal path Output signal path Base on the input and output signal diagrams, we can setup all the controls that we want in the driver. Such as switches, volume controls, PGA controls and so on. All the controls below can be used in the alsamixer. static const struct snd_kcontrol_new wm8960_snd_controls[] = { SOC_DOUBLE_R_TLV("PCM DAC Playback Volume", WM8960_LDAC, WM8960_RDAC, 0, 255, 0, dac_tlv), //LDACVOL , RDACVOL SOC_DOUBLE_R_TLV("PCM ADC Capture Volume", WM8960_LADC, WM8960_RADC, 0, 255, 0, adc_tlv), //LADCVOL, RADCVOL SOC_DOUBLE_R_TLV("Headphone Volume", WM8960_LOUT1, WM8960_ROUT1, 0, 127, 0, out_tlv), SOC_DOUBLE_R("Headphone ZC Switch", WM8960_LOUT1, WM8960_ROUT1,    7, 1, 0), SOC_DOUBLE_R_TLV("Speaker Volume", WM8960_LOUT2, WM8960_ROUT2, 0, 127, 0, out_tlv), SOC_DOUBLE_R("Speaker ZC Switch", WM8960_LOUT2, WM8960_ROUT2, 7, 1, 0), SOC_DOUBLE_R("Capture Volume ZC Switch", WM8960_LINVOL, WM8960_RINVOL, 6, 1, 0), SOC_SINGLE_TLV("Input Volume of LINPUT1", WM8960_LINVOL, 0, 63, 0, in_tlv),  //LINVOL SOC_SINGLE_TLV("Input Volume of RINPUT1", WM8960_RINVOL, 0, 63, 0, in_tlv),  //RINVOL SOC_SINGLE_TLV("Input Boost Volume LINPUT3", WM8960_INBMIX1, 4, 7, 0, boost_tlv),    //RIN3BOOST SOC_SINGLE_TLV("Input Boost Volume LINPUT2", WM8960_INBMIX1, 1, 7, 0, boost_tlv),    //RIN2BOOST SOC_SINGLE_TLV("Input Boost Volume RINPUT3", WM8960_INBMIX2, 4, 7, 0, boost_tlv),    //LIN3BOOST SOC_SINGLE_TLV("Input Boost Volume RINPUT2", WM8960_INBMIX2, 1, 7, 0, boost_tlv),    //LIN2BOOST SOC_SINGLE_TLV("PGA LB2LOVOL-Bypass from Left Boost", WM8960_BYPASS1, 4, 7, 1, bypass_tlv),    //LB2LOVOL SOC_SINGLE_TLV("PGA LI2LOVOL-Bypass from LINPUT3", WM8960_LOUTMIX, 4, 7, 1, bypass_tlv),    //LI2LOVOL SOC_SINGLE_TLV("PGA RB2ROVOL-Bypass from Right Boost", WM8960_BYPASS2, 4, 7, 1, bypass_tlv),    //RB2ROVOL SOC_SINGLE_TLV("PGA RI2ROVOL-Bypass from RINPUT3", WM8960_ROUTMIX, 4, 7, 1, bypass_tlv),    //RI2ROVOL SOC_SINGLE("Capture Mute (Left)", WM8960_LINVOL, 7, 1, 0), // LINMUTE SOC_SINGLE("Capture Mute (Right)", WM8960_RINVOL, 7, 1, 0), // RINMUTE SOC_SINGLE("PCM Playback -6dB Switch", WM8960_DACCTL1, 7, 1, 0), SOC_SINGLE("Speaker DC gain", WM8960_CLASSD3, 3, 5, 0), SOC_SINGLE("Speaker AC gain", WM8960_CLASSD3, 0, 5, 0), SOC_ENUM("ADC Polarity", wm8960_enum[0]), SOC_SINGLE("ADC High Pass Filter Switch", WM8960_DACCTL1, 0, 1, 0), SOC_ENUM("DAC Polarity", wm8960_enum[2]), SOC_SINGLE_BOOL_EXT("DAC Deemphasis Switch", 0, wm8960_get_deemph, wm8960_put_deemph), SOC_ENUM("3D Filter Upper Cut-Off", wm8960_enum[2]), SOC_ENUM("3D Filter Lower Cut-Off", wm8960_enum[3]), SOC_SINGLE("3D Depth", WM8960_3D, 1, 15, 0), SOC_SINGLE("3D", WM8960_3D, 0, 1, 0), SOC_ENUM("ALC Function", wm8960_enum[4]), SOC_SINGLE("ALC Max Gain", WM8960_ALC1, 4, 7, 0), SOC_SINGLE("ALC Target", WM8960_ALC1, 0, 15, 1), SOC_SINGLE("ALC Min Gain", WM8960_ALC2, 4, 7, 0), SOC_SINGLE("ALC Hold Time", WM8960_ALC2, 0, 15, 0), SOC_ENUM("ALC Mode", wm8960_enum[5]), SOC_SINGLE("ALC Decay", WM8960_ALC3, 4, 15, 0), SOC_SINGLE("ALC Attack", WM8960_ALC3, 0, 15, 0), SOC_SINGLE("Noise Gate Threshold", WM8960_NOISEG, 3, 31, 0), SOC_SINGLE("Noise Gate Switch", WM8960_NOISEG, 0, 1, 0), SOC_ENUM("Capture Left Boost", wm8960_enum[6]), //LMICBOOST SOC_ENUM("Capture Right Boost", wm8960_enum[7]), //RMICBOOT }; 1. SOC_SINGLE(xname, reg, shift, max, invert) To setup a simple switch, we can use SOC_SINGLE. e.g SOC_SINGLE("PCM Playback -6dB Switch", WM8960_DACCTL1, 7, 1, 0), - The name of this control is “PCM Playback -6dB Switch”. - The register in WM8960 is WM8960_DACCTL1 . (the register address is 0x5, defined in wm8960.h) - ‘7’ : The 7th bit in DACCTL1 register is used to enable/disable the DAC 6dB Attenuate. - ‘1’ : Only one enable or disable option. - ‘0’ : the value you set is not inverted. 2. SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) To setup a switch with levels, we can use SOC_SINGLE_TLV. e.g. In this example, the left input volume control is from 000000(-17.25dB) to 111111(+30dB). Each step is 0.75dB. Total is 63 steps. SOC_SINGLE_TLV("Input Volume of LINPUT1", WM8960_LINVOL, 0, 63, 0, in_tlv), The scale of in_tlv declare like this: static const DECLARE_TLV_DB_SCALE(in_tlv, -1725, 75, 0); in_tlv : the name of the scale. -1725 : start from -17.25dB 75: each step is 0.75dB 0: the step is start from 0. For some volume control case the first step is "mute", then the step is start from 1 so change this number to 1. for example: The 0000 0000 of the DAC volume control is digital mute. static const DECLARE_TLV_DB_SCALE(dac_tlv, -12700, 50, 1); 3. SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) SOC_DOUBLE_R is a stereo version of SOC_SINGLE. You can control the left and right channel at the same time. e.g. SOC_DOUBLE_R("Headphone ZC Switch", WM8960_LOUT1, WM8960_ROUT1, 7, 1, 0), 4. SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) SOC_DOUBLE_R_TLV is the stereo version of SOC_SINGLE_TLV. e.g. SOC_DOUBLE_R_TLV("PCM DAC Playback Volume", WM8960_LDAC, WM8960_RDAC, 0, 255, 0, dac_tlv), 5. SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) When the control option are some texts, we can use SOC_ENUM to enum the options. e.g. MIC boost 5.1. setup the array for the texts. static const char *wm8960_micboost[] = {"0dB","+13dB","+20dB","+29dB"}; 5.2. use the SOC_ENUM_SINGLE. static const struct soc_enum wm8960_enum[] = {      SOC_ENUM_SINGLE(WM8960_DACCTL1, 5, 4, wm8960_polarity),      SOC_ENUM_SINGLE(WM8960_DACCTL2, 5, 4, wm8960_polarity),      SOC_ENUM_SINGLE(WM8960_3D, 6, 2, wm8960_3d_upper_cutoff),      SOC_ENUM_SINGLE(WM8960_3D, 5, 2, wm8960_3d_lower_cutoff),      SOC_ENUM_SINGLE(WM8960_ALC1, 7, 4, wm8960_alcfunc),      SOC_ENUM_SINGLE(WM8960_ALC3, 8, 2, wm8960_alcmode),      SOC_ENUM_SINGLE(WM8960_LINPATH, 4, 4, wm8960_micboost),      SOC_ENUM_SINGLE(WM8960_RINPATH, 4, 4, wm8960_micboost), }; 5.3.  use SOC_ENUM to add the controls for MIC boost. SOC_ENUM("Capture Left Boost", wm8960_enum[6]), SOC_ENUM("Capture Right Boost", wm8960_enum[7]), After created all the controls, we can start to create the switches. The following switches created base on the input and output diagrams. I used the same name from datasheet of each switch. It will more easy to find out the proper switch in alsamixer. static const struct snd_kcontrol_new wm8960_lin[] = { SOC_DAPM_SINGLE("<- LMP2", WM8960_LINPATH, 6, 1, 0), //LMP2 SOC_DAPM_SINGLE("<- LMP3", WM8960_LINPATH, 7, 1, 0), //LMP3 SOC_DAPM_SINGLE("<- LMN1", WM8960_LINPATH, 8, 1, 0), //LMN1 }; static const struct snd_kcontrol_new wm8960_lin_boost[] = { SOC_DAPM_SINGLE("<- LMIC2B", WM8960_LINPATH, 3, 1, 0), //LMIC2B }; static const struct snd_kcontrol_new wm8960_rin[] = { SOC_DAPM_SINGLE("<- RMP2", WM8960_RINPATH, 6, 1, 0), //RMP2 SOC_DAPM_SINGLE("<- RMP3", WM8960_RINPATH, 7, 1, 0), //RMP3 SOC_DAPM_SINGLE("<- RMN1", WM8960_RINPATH, 8, 1, 0), //RMN1 }; static const struct snd_kcontrol_new wm8960_rin_boost[] = { SOC_DAPM_SINGLE("<- RMIC2B", WM8960_RINPATH, 3, 1, 0), //RMIC2B }; static const struct snd_kcontrol_new wm8960_loutput_mixer[] = { SOC_DAPM_SINGLE("<- LD2LO", WM8960_LOUTMIX, 8, 1, 0), //LD2LO SOC_DAPM_SINGLE("<- LI2LO", WM8960_LOUTMIX, 7, 1, 0), //LI2LO SOC_DAPM_SINGLE("<- LB2LO", WM8960_BYPASS1, 7, 1, 0), //LB2LO }; static const struct snd_kcontrol_new wm8960_routput_mixer[] = { SOC_DAPM_SINGLE("<- RD2RO", WM8960_ROUTMIX, 8, 1, 0), //RD2RO SOC_DAPM_SINGLE("<- RI2RO", WM8960_ROUTMIX, 7, 1, 0), //RI2RO SOC_DAPM_SINGLE("<- RB2RO", WM8960_BYPASS2, 7, 1, 0), //RB2RO }; static const struct snd_kcontrol_new wm8960_mono_out[] = { SOC_DAPM_SINGLE("<- L2MO", WM8960_MONOMIX1, 7, 1, 0), //L2MO SOC_DAPM_SINGLE("<- R2MO", WM8960_MONOMIX2, 7, 1, 0), //R2MO }; Then, create the inputs, ADC, DAC, mixers, PGA and outputs. static const struct snd_soc_dapm_widget wm8960_dapm_widgets[] = { SND_SOC_DAPM_INPUT("LINPUT1"), SND_SOC_DAPM_INPUT("RINPUT1"), SND_SOC_DAPM_INPUT("LINPUT2"), SND_SOC_DAPM_INPUT("RINPUT2"), SND_SOC_DAPM_INPUT("LINPUT3"), SND_SOC_DAPM_INPUT("RINPUT3"), SND_SOC_DAPM_MICBIAS("MICB", WM8960_POWER1, 1, 0), SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8960_POWER1, 5, 0, wm8960_lin_boost, ARRAY_SIZE(wm8960_lin_boost)), SND_SOC_DAPM_MIXER("Right Boost Mixer", WM8960_POWER1, 4, 0, wm8960_rin_boost, ARRAY_SIZE(wm8960_rin_boost)), SND_SOC_DAPM_MIXER("Left Input PGA", WM8960_POWER3, 5, 0, wm8960_lin, ARRAY_SIZE(wm8960_lin)), SND_SOC_DAPM_MIXER("Right Input PGA", WM8960_POWER3, 4, 0, wm8960_rin, ARRAY_SIZE(wm8960_rin)), SND_SOC_DAPM_ADC("Left ADC", "Capture", WM8960_POWER1, 3, 0), SND_SOC_DAPM_ADC("Right ADC", "Capture", WM8960_POWER1, 2, 0), SND_SOC_DAPM_DAC("Left DAC", "Playback", WM8960_POWER2, 8, 0), SND_SOC_DAPM_DAC("Right DAC", "Playback", WM8960_POWER2, 7, 0), SND_SOC_DAPM_MIXER("Left Output Mixer", WM8960_POWER3, 3, 0, wm8960_loutput_mixer, ARRAY_SIZE(wm8960_loutput_mixer)), SND_SOC_DAPM_MIXER("Right Output Mixer", WM8960_POWER3, 2, 0, wm8960_routput_mixer, ARRAY_SIZE(wm8960_routput_mixer)), SND_SOC_DAPM_PGA("Left HP PGA", WM8960_POWER2, 6, 0, NULL, 0), SND_SOC_DAPM_PGA("Right HP PGA", WM8960_POWER2, 5, 0, NULL, 0), SND_SOC_DAPM_PGA("Left Speaker PGA", WM8960_POWER2, 4, 0, NULL, 0), SND_SOC_DAPM_PGA("Right Speaker PGA", WM8960_POWER2, 3, 0, NULL, 0), SND_SOC_DAPM_PGA("Right Speaker Output", WM8960_CLASSD1, 7, 0, NULL, 0), //SPK_OP_EN SND_SOC_DAPM_PGA("Left Speaker Output", WM8960_CLASSD1, 6, 0, NULL, 0), SND_SOC_DAPM_OUTPUT("SPK_LP"), SND_SOC_DAPM_OUTPUT("SPK_LN"), SND_SOC_DAPM_OUTPUT("HP_L"), SND_SOC_DAPM_OUTPUT("HP_R"), SND_SOC_DAPM_OUTPUT("SPK_RP"), SND_SOC_DAPM_OUTPUT("SPK_RN"), SND_SOC_DAPM_OUTPUT("OUT3"), }; Now, we can start to route the audio path. The path is from right to left , like : { “destination”, “switch”, “source” } So, lets take the LINPUT1 to ADC as an example: { "Left Input PGA", "<- LMN1", "LINPUT1" }, { "Left Boost Mixer", "<- LMIC2B", "Left Input PGA" }, { "Left ADC", NULL, "Left Boost Mixer" }, Another example is DAC to Headphone.                 { "Left Output Mixer", "<- LD2LO", "Left DAC" },                 { "Right Output Mixer", "<- RD2RO", "Right DAC" },                 { "Left HP PGA", NULL, "Left Output Mixer" },                 { "Right HP PGA", NULL, "Right Output Mixer" },                 { "HP_L", NULL, "Left HP PGA" },                 { "HP_R", NULL, "Right HP PGA" }, In linux, you can run "alsamixer" to turn on/off the switches and adjust the volumes. (this picture is an example of alsamixer of other codec, not for wm8960) In alsamixer, use 'M' to turn the switch on/off,  use arrow keys to control the volumes. wm8960_dai_ops is another important part in the driver. Here is the ops of the wm8960_dai. static struct snd_soc_dai_ops wm8960_dai_ops = {                 .hw_params = wm8960_hw_params,                 .digital_mute = wm8960_mute,                 .set_fmt = wm8960_set_dai_fmt,                 .set_clkdiv = wm8960_set_dai_clkdiv,                 .set_pll = wm8960_set_dai_pll, }; wm8960_hw_params : used to set the PCM format (16bit/24bit), set the deemph, alc_rates and etc. wm8960_mute:  used to mute the output wm8960_set_dai_fmt : used to set the Master/Slave mode, set the interface format (I2S, DSP, Left justified and Right justified) and set the clock inversion. wm8960_set_dai_clkdiv: used to set the CLK divider such as DACDIV, ADCDIV, BCLKDIV and so on. wm8960_set_dai_pll: used to calculate the proper PLL values. In the wm8960_set_dai_pll, we need to calculate the proper PLL values. Base on the table, if the MCLK >14.4, the sysclk prescale divider is 2. So, set the sysclk pre-divider to 2 before finding pll_factors. if (freq_in > 15000000 ) {                                 /* update sysclk div */                                 reg = snd_soc_read(codec, WM8960_CLOCK1) & 0x1f9;                                 snd_soc_write(codec, WM8960_CLOCK1, reg | 0x4);                                 clk_in = clk_in/2;                                 }                 if (freq_in && freq_out) {                                 ret = pll_factors(clk_in, freq_out, &pll_div);                                 if (ret != 0)                                                 return ret;                 } In the driver, there are two names are important. One is the name of codec dai. The name is “wm8960”. Make sure this codec dai name is the same codec dai name used in the imx-wm8960.c. static struct snd_soc_dai_driver wm8960_dai = {                 .name = "wm8960",                 .playback = {                                 .stream_name = "Playback",                                 .channels_min = 1,                                 .channels_max = 2,                                 .rates = WM8960_RATES,                                 .formats = WM8960_FORMATS,},                 .capture = {                                 .stream_name = "Capture",                                 .channels_min = 1,                                 .channels_max = 2,                                 .rates = WM8960_RATES,                                 .formats = WM8960_FORMATS,},                 .ops = &wm8960_dai_ops,                 .symmetric_rates = 1, }; Another name is the I2C device id. Make sure the I2C name is same as the name used in your_board.c file. static const struct i2c_device_id wm8960_i2c_id[] = {                 { "wm8960", 0 },                 { } }; MODULE_DEVICE_TABLE(i2c, wm8960_i2c_id); static struct i2c_driver wm8960_i2c_driver = {                 .driver = {                                 .name = "wm8960",                                 .owner = THIS_MODULE,                 },                 .probe =    wm8960_i2c_probe,                 .remove =   __devexit_p(wm8960_i2c_remove),                 .id_table = wm8960_i2c_id, }; Here is the name used in your_board.c static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {     {         I2C_BOARD_INFO("wm8960", 0x1a),     }, } Machine driver imx-wm8960.c Basically, the machine driver is the connection between wm8960.c and the i.MX. It is modified base on the imx-wm8962.c. I didn't add the HP and MIC detection in this driver. If you need the HP and MIC detection, please take the imx-wm8962.c for reference. Here is an example of my_board.c. The following platform data pass to the machine driver from my board. static struct platform_device audio_wm8960_device = {     .name = "imx-wm8960", }; static struct mxc_audio_platform_data wm8960_pdata; static int wm8960_clk_enable(int enable) {     if (enable)         clk_enable(clko);     else         clk_disable(clko);     return 0; } static int mxc_wm8960_init(void) {     int rate;     clko = clk_get(NULL, "clko_clk");     if (IS_ERR(clko)) {         pr_err("can't get CLKO clock.\n");         return PTR_ERR(clko);     }     /* both audio codec and comera use CLKO clk*/     rate = clk_round_rate(clko, 24000000);     clk_set_rate(clko, rate);     wm8960_pdata.sysclk = rate;     return 0; } static struct mxc_audio_platform_data wm8960_pdata = {     .ssi_num = 1,     .src_port = 2,     .ext_port = 3,     .init = mxc_wm8960_init,     .clock_enable = wm8960_clk_enable, }; I attach the driver and the machine driver here. I hope this document is useful for you.
View full article
Here is a quick summary at building a bootloader, a kernel and a root filesystem for the i.MX 6 sabre sd platform, using buildroot. This assumes you have a "working" Linux development environment at hand (e.g. Debian). Buildroot is a fine build system, which makes deploying Linux on embedded platforms really easy. It is comparable to Yocto in spirit, but much simpler. Thanks to my colleague gillestalis, buildroot now has builtin support for the i.MX6 sabre sd platform. Get buildroot sources We will use git to fetch buildroot sources: $ git clone git://git.busybox.net/buildroot This should create a buildroot directory with all the latest sources (after a while). Note that for more stability you might want to checkout a release instead of the latest version; to do so, list the available release tags with e.g. git tag -l '201*', and git checkout <the-desired-tag>. Compile The beauty of buildroot is that it will take care of everything for you, including preparing a cross compiler. You can download and build everything by doing: $ cd buildroot $ make freescale_imx6sabresd_defconfig $ make This should download and build everything, so it will take a while. buildroot detects the number of CPUs you have in your machine and builds with parallel jobs automatically; no need to specify any -j argument to make here. All build results fall under the output/images folder: output/images/ +- rootfs.ext2 +- rootfs.tar +- u-boot.bin `- uImage Format the SD card As for Debian, we need to format the SD card with two partitions; one small FAT partition to contain the Linux kernel, and one large ext4 partition, which will contain the root filesystem with the buildroot generated userspace. Also, we need to make sure we leave some space for u-boot starting from offset 1024B. Here is an example SD card layout: +-----+------+--------+-----+---------------+----------------- | MBR |  ... | u-boot | ... | FAT partition | Linux partition ... +-----+------+--------+-----+---------------+----------------- 0     512    1024           1M              ~257M (offsets in bytes) Here is an example SD card layout, as displayed by fdisk: Device    Boot      Start         End      Blocks   Id  System /dev/sdc1            2048      526335      262144    c  W95 FAT32 (LBA) /dev/sdc2          526336     8054783     3764224   83  Linux (units: 512B sectors) You can format the FAT boot partition with: # mkfs.vfat /dev/<your-sd-card-first-partition> Your SD card first partition is typically something in /dev/sd<X>1 or/dev/mmcblk<X>p1. You can format the Linux partition with: # mkfs.ext4 /dev/<your-sd-card-second-partition> Your SD card second partition is typically something in /dev/sd<X>2 or/dev/mmcblk<X>p2. Put on SD As explained here, u-boot should reside at offset 1024B of your SD card. Also, as buildroot generates an u-boot.bin (and not an u-boot.imx) we should skip its first KB, too. In summary, to put u-boot on your SD, do:   # dd if=output/images/u-boot.bin of=/dev/<your-sd-card> bs=1k seek=1 skip=1   # sync Your SD card device is typically something in /dev/sd<X> or /dev/mmcblk<X>. Note that you need write permissions on the SD card for the command to succeed, so you might need to su - as root, or use sudo, or do a chmod a+w as root on the SD card device node to grant permissions to users. Similarly to what this post describes, you can copy the kernel to the FAT boot partition with: # mount /dev/<your-sd-card-second-partition> /mnt # cp output/images/uImage /mnt/ # umount /mnt Your SD card first partition is typically something in /dev/sd<X>1 or/dev/mmcblk<X>p1. And not unlike what is done in this post, You can install your generated root filesystem to the Linux partition with: # mount /dev/<your-sd-card-second-partition> /mnt # tar -C /mnt -xvf output/images/rootfs.tar # umount /mnt Your SD card second partition is typically something in /dev/sd<X>2 or/dev/mmcblk<X>p2. Boot! Your SD card is ready for booting. Insert it in the SD card slot of your i.MX6 sabre sd platform, connect to the USB to UART port with a serial terminal set to 115200 baud, no parity, 8bit data and power up the platform. Like with Debian, u-boot default settings will not allow it to boot from the SD card, so we need to interrupt it by pressing enter at u-boot prompt for the first boot and setup u-boot environment to fix this: MX6Q SABRESD U-Boot > setenv bootargs_mmc 'setenv bootargs ${bootargs} root=/dev/mmcblk1p2 rootwait' MX6Q SABRESD U-Boot > setenv bootcmd_mmc 'run bootargs_base bootargs_mmc; mmc dev 2; fatload mmc 2:1 ${loadaddr} ${kernel}; bootm' MX6Q SABRESD U-Boot > setenv bootcmd 'run bootcmd_mmc' MX6Q SABRESD U-Boot > saveenv Saving Environment to MMC... Writing to MMC(2)... done As this is saved in the SD card it need only to be done once at first boot. You can reboot your board or type boot; your buildroot system should boot to a prompt: (...) Welcome to Buildroot buildroot login: From there you may login as root. Enjoy! Tweak buildroot uses Linux kernel kconfig to handle its configuration. So, as for the Linux kernel, changes to the configuration can be done with e.g.: $ make menuconfig Most of the options can be tuned from there, including (most importantly) which packages get installed into the generated root filesystem. This is configuration section 'Filesystem images'. Further details are documented in buildroot manual. Tips ccache is natively supported by buildroot and can be easily enabled with configuration option BR2_CCACHE. If you only use the generated rootfs.tar as described in this post and do not care about the rootfs.ext2, you might as well save a few seconds of build by disabling its generation. This is done with configuration option BR2_TARGET_ROOTFS_EXT2. It is recommended to install an ssh server inside the target for further development. This is conveniently done with configuration option BR2_PACKAGE_OPENSSH. See also... Other root filesystems may make more sense for you; see this post for a Debian root filesystem, and this post for a minimal busybox filesystem. Freescale Yocto Project main page
View full article
Hello everyone, this document will explain on how to use the UUU (Universal Update Utility) tool to flash Linux to an i.MX device (i.MX 8MM).   Requirements:   MX 8M Mini EVK UUU tool documentation, available here Linux Binary Demo Files - i.MX 8MMini EVK UUU 1.2.135 binary Serial console emulator (tera term or putty)   UUU auto script For this example is used the L4.14.98_2.0.0_ga demo image for the i.MX 8MM, inside the demo image we will find the auto script, which by default flash the eMMC of the board, the structure of the script is as following   /***********************************************************************************/ uuu_version 1.2.39   # This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ SDP: boot -f imx-boot-imx8mmevk-sd.bin-flash_evk   # This command will be run when ROM support stream mode # i.MX8QXP, i.MX8QM SDPS: boot -f imx-boot-imx8mmevk-sd.bin-flash_evk   # These commands will be run when use SPL and will be skipped if no spl # SDPU will be deprecated. please use SDPV instead of SDPU # { SDPU: delay 1000 SDPU: write -f imx-boot-imx8mmevk-sd.bin-flash_evk -offset 0x57c00 SDPU: jump # }   # These commands will be run when use SPL and will be skipped if no spl # if (SPL support SDPV) # { SDPV: delay 1000 SDPV: write -f imx-boot-imx8mmevk-sd.bin-flash_evk -skipspl SDPV: jump # }   FB: ucmd setenv fastboot_dev mmc FB: ucmd setenv mmcdev ${emmc_dev} FB: ucmd mmc dev ${emmc_dev} FB: flash -raw2sparse all fsl-image-validation-imx-imx8mmevk.sdcard FB: flash bootloader imx-boot-imx8mmevk-sd.bin-flash_evk FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi; FB: ucmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0 FB: done /***********************************************************************************/    In short, when the board goes into serial downloader mode UUU downloads the bootloader to internal RAM, once done and uboot is running, through fastboot utility it will flash .sdcard file and uboot to the eMMC on the board.   More information about the protocol UUU use please refer to the UUU documentation (UUU.pdf) section 5 Supported protocol.   Running the tool In order to run the tool the binary of uuu needs to be downloaded, the binary files can be downloaded from the link above, uuu.exe is for Windows and uuu is for Linux. Once downloaded it can be placed inside the same file as the demo image, this so it is easy to run and cleaner on the shell commands.   Windows In windows OS the tool should be run using the Windows PowerShell in administrator mode, once open we will run the next commands: > .\uuu.exe uuu.auto   Linux >$ sudo ./uuu uuu.auto   The tool will start running and should be waiting for any i.MX device to be detected by host pc   Preparing the board For the board to be flashed it is needed to be in download mode, the switch configuration (i.MX 8MM EVK) is as following: SW1101  -  1010XXXXXX SW1102  -  XXXXXXXXX0   Connect a USB cable from the host pc which will run the tool to the USB OTG/TYPE C port, usually specified as download, on the board.   Connect a USB cable from the host to the OTG-to-UART for console output, usually specified as debug, on the board.   Open terminal emulator program with the following settings: Bits per second - 115200 Data bits - 8 Parity - None Stop bits - 1 Flow control - None   Power on the board, the download will start and the serial prompt will show the progress in uboot, wait until the tool show success.   Finally power off the board and change the switch configuration to boot from the eMMC, power on the board again and it should boot successfully!   Built in scripts One can use the built in scripts using the -b option to burn the bootloader  and the rootfs to the target flash, just type the command accordingly to the target flash device.    SD Write bootloader only: Windows: > .\uuu.exe -b sd <bootloader> Linux: $ sudo ./uuu -b sd <bootloader>   Replace <bootloader> for your .imx/.bin file, example using the i.MX 8MM for Windows and Linux respectively below. > .\uur.exe -b sd imx-boot-imx8mmevk-sd.bin-flash_evk $ sudo ./uuu -b sd imx-boot-imx8mmevk-sd.bin-flash_evk    Write whole Linux image Windows: > .\uuu.exe -b sd_all <bootloader> <rootfs>.sdcard Linux: $ sudo ./uuu -b sd_all <bootloader> <rootfs>.sdcard   Replace <bootloader> and <rootfs> for the name of your .imx/.bin and .sdcard files respectively, example using the i.MX 8MM below. > .\uuu.exe -b sd_all  imx-boot-imx8mmevk-sd.bin-flash_evk fsl-image-validation-imx-imx8mmevk.sdcard $ sudo ./uuu -b sd_all  imx-boot-imx8mmevk-sd.bin-flash_evk fsl-image-validation-imx-imx8mmevk.sdcard   eMMC Write bootloader only Windows: > .\uuu.exe -b emmc <bootloader> Linux: $ sudo ./uuu -b emmc <bootloader>   Example using i.MX 8MM > .\uuu.exe -b emmc imx-boot-imx8mmevk-sd.bin-flash_evk $ sudo ./uuu -b emmc imx-boot-imx8mmevk-sd.bin-flash_evk   Write whole Linux image Windows: > .\uuu.exe -b emmc_all <bootloader> <rootfs>.sdcard Linux: $ sudo ./uuu -b emmc_all <bootloader> <rootfs>.sdcard   Example using i.MX 8MM > .\uuu.exe -b emmc_all imx-boot-imx8mmevk-sd.bin-flash_evk fsl-image-validation-imx-imx8mmevk.sdcard $ sudo ./uuu -b emmc_all imx-boot-imx8mmevk-sd.bin-flash_evk fsl-image-validation-imx-imx8mmevk.sdcard   Hope this will helpful for everyone who is starting to use this flashing tool.
View full article
Overview AVB/TSN Wikipedia: Audio Video Bridging (AVB) is a common name for the set of technical standards which provide improved synchronization, low-latency, and reliability for switched Ethernet networks. AVB was initially developed by the Institute of Electrical and Electronics Engineers (IEEE) Audio Video Bridging task group of the IEEE 802.1 standards committee. In November 2012, Audio Video Bridging task group was renamed to Time-Sensitive Networking (TSN) task group to reflect the expanded scope of its work, which is to "provide the specifications that will allow time-synchronized low latency streaming services through IEEE 802 networks". Further standardization efforts are ongoing in IEEE 802.1 TSN task group.   AVB and TSN technologies and standards: Standard Area of Definition Title of Standard AVB/TSN IEEE 802.1AS Timing and synchronization Timing and Synchronization for Time-Sensitive Applications (gPTP) AVB TSN IEEE 802.1Qav Forwarding and queuing Forwarding and Queuing for Time-Sensitive Streams (FQTSS) AVB IEEE 802.1Qat Path control and reservation Stream Reservation Protocol (SRP) AVB IEEE 802.1BA Bridging Audio Video Bridging (AVB) Systems AVB IEEE 1722 AVTP AV transport Layer 2 Transport Protocol for Time Sensitive Applications AVB IEEE 1722 AVDECC Device manage and control Device Discovery, Enumeration, Connection Management and Control Protocol AVB IEEE 802.1Qbu and IEEE 802.3br Forwarding and queuing Frame preemption TSN IEEE 802.1Qbv Forwarding and queuing Enhancements for scheduled traffic TSN IEEE 802.1Qca Path control and reservation Path control and reservation TSN IEEE 802.1Qcc Central configuration method Enhancements and performance improvements TSN IEEE 802.1Qci Time-based ingress policing Per-stream filtering and policing TSN IEEE 802.1CB Seamless redundancy Frame replication and elimination for reliability TSN   Since many of the standards are only for TSN switch/bridges and i.MX8MP is design to be a TSN/AVB endpoint, this demo does not implement a full stack or full standards. It only demonstrates the basic end-to-end point (talker to listener) A/V streaming without bridge or switch.   Below table shows what this demo supports: Standard Software Hardware IEEE 802.1AS Linuxptp ENET_QoS IP IEEE 802.1Qav/Qbu/Qbv TC qdisc (taprio, mqprio, etf, cbs) ENET_QoS IP (multi queue + EST, FPE, CBS) IEEE 1722 AVTP Libavtp N/A   Demo introduction Two i.MX8MP EVK boards are used for this demo, one act as a AVB talker to send A/V streams, the other one act as a AVB listener to receive A/V streams who can be playback to audio codec and sink video to screen. The two boards are connected by a RJ45 ethernet cable on each ENET2 port (only ENET2 port has TSN features). Three streams’ type and SR (Stream Reservation) class are defined as below to grantee time sensitive (sub-microsecond synchronization), low latency and bandwidth on the ethernet: Stream A: SR class A, AVTP Compressed Video Format, H.264 profile High, 1920x1080, 30 fps. Stream B: SR class B, AVTP Audio Format, PCM 16-bit sample, 48 kHz, stereo, 12 frames per AVTPDU. Other stream: Best-effort streams These three TSN streams would be allocated into different traffic control (TC) class for egress in Linux. Different TC class would be mapped to different hardware queues with dedicated DMA channel, thanks to the multi-queue support by ENET_QoS IP. Then the traffic control apply different scheduling policy on each queues for different types of streams egress, to make sure highest priority or critical packet can be sent in the correct time slot. The TSN streams are transmitted over Virtual LANs (VLANs). Bridges use the VLAN priority information (PCP) to identify Stream Reservation (SR) traffic classes which are handled according to the Forward and Queuing Enhancements for Time-Sensitive Streams (FQTSS) mechanisms described in Chapter 34 of the IEEE 802.1Q standard.   The demo is built up by following blocks: Linux TC (traffic control): streams egress control to meet AVB/TSN requirements, which take advantage of the i.MX8MP TSN ENET IP. Linux PTP: clock sync in network, which take advantage of the i.MX8MP TSN ENET IP. Libavtp: Time Sensitive Applications AV Transport protocol. ALSA: AVTP audio format plugin uses the libavtp to transmit and receive AVTP audio PCM streams. Gstreamer: avtp plugin uses the libavtp to transmit and receive AVTP audio/video streams (video should be encoded as H264, audio PCM). x264enc and libav is a software H.264 video encoder/decoder, which alternative to the on chip VPU acceleration plugin, due to the VPU plugin is not supported in the latest Gstreamer version (1.17.x).     Traffic control This demo can use two different traffic control qdisc settings: mqprio + cbs: use CBS features taprio + pfifo: use EST and FPE features (802.1Qbu/bv). The pfifo is the default traffic control class, which use FIFO schedule policy for egress packets. The CBS class is actually handled by hardware IP to select which queue for transmit in a certain time slot.   Credit Base Shaper (CBS) CBS parameters come straight from the IEEE 802.1Q-2018 specification. They are the following: idleSlope: rate credits are accumulated when queue isn’t transmitting; sendSlope: rate credits are spent when queue is transmitting; hiCredit: maximum amount of credits the queue is allowed to have; loCredit: minimum amount of credits the queue is allowed to have;     Enhancements to Scheduled Traffic (EST) The IEEE 802.1Qbv defines the schedule for each of the queues on every egress port which makes the implementation aware of traffic arrival schedule. This information can be used to block the lower priority traffic from transmission in this time window/slot. This ensures that scheduled traffic is forwarded from sender to receiver through all the network nodes with a deterministic delay. The i.MX8MP uses the gate control list with configurable time slot and frame preempt (IEEE 802.1Qbu) features to support EST. Other than the CBS, the gate control list control the egress transmission by a fixed open interval for that queue.   Build demo Build L5.4.24_2.1.0 $MACHINE=imx8mpevk DISTRO=fsl-imx-xwayland source imx-setup-release.sh -b build-8mp $bitbake  fsl-image-validation-imx Prepare a SD card and burn it with the built out images. To add tc/tcpdump command in iproute2 package, please add package into IMAGE_INSTALL_append variable into conf/local.conf: IMAGE_INSTALL_append = " iproute2 iproute2-tc tcpdump Rebuild kernel Rebuild the kernel after applying the 0001-qenet-add-queue-avoid-panic.patch (attached), and overwrite the Image and imx8mp-evk.dtb on the boot partition of the SD card.   Install the toolchain $bitbake -f fsl-image-validation-imx -c populate_sdk $sh tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-fsl-image-validation-imx-aarch64-imx8mpevk-toolchain-5.4-zeus.sh The toolchain would be installed into /opt/fsl-imx-xwayland/5.4-zeus/   Create a install folder $mkdir <your install folder> Create a folder to install all of the shared libraries, binaries and configure files which built out manually in this doc. After built done, you should copy all of the contents in this folder to target board root.   Build libavtp $source /opt/fsl-imx-xwayland/5.4-zeus/environment-setup-aarch64-poky-linux $git clone https://github.com/Avnu/libavtp.git $cd libavtp $meson build $ninja -C build Copy the built out .so and .pc into the toolchain rootfs: $sudo cp build/libavtp.so* /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/lib/ $sudo cp build/meson-private/*.pc /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/lib/pkgconfig/ To make sure you have avtp package installed correctly: $pkg-config --list-all | grep avtp Copy the .so into the install folder: $cp build/libavtp.so* <install folder>/usr/lib/ Copy header files: $cp libavtp/include/* files <toolchain_path>/sysroots/aarch64-poky-linux/usr/lib Build ALSA aaf plugin The AAF (ALSA AVTP Audio Format) plugin is a PCM plugin that uses Audio Video Transport Protocol (AVTP) to transmit/receive audio samples through a Time-Sensitive Network (TSN) capable network. The plugin enables media applications to easily implement AVTP Talker and Listener functionalities.   $cd <yocto build>/tmp/work/aarch64-mx8mp-poky-linux/alsa-plugins/1.1.9-r0/alsa-plugins-1.1.9 $./configure --build=x86_64-linux --host=aarch64-poky-linux --target=aarch64-poky-linux --prefix=<your install folder>/usr --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/opt/samba/nxa23059/jailhouse/yocto-5.x/build-8mp/tmp/work/aarch64-mx8mp-poky-linux/alsa-plugins/1.1.9-r0/recipe-sysroot  --disable-static  --enable-aaf --disable-jack --disable-libav --disable-maemo-plugin --disable-maemo-resource-manager --enable-pulseaudio --enable-samplerate --with-speex=lib $make $make install   Build Gstreamer AVTP plugins Build Gstreamer 1.17.x (commit e4f7cdb0df7b) $git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git $cd gstreamer $patch -p1 < gstreamer-1.0-pass-build.patch $meson build --prefix=<your install folder>/usr $ninja -C build $ninja -C build install After Gstreamer is installed into <your install folder>, please fix the “prefix” path in the .pc files by, and copy to the toolchain folders: $cd <your install folder> $grep -lR <your install folder> ./lib/pkgconfig/ | xargs sed -i 's/<your install folder>/\/usr/g' NOTE: Make sure you use the ‘\’ for ‘/’ convert in your path. $cp -rf ./usr/* /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/   Build gst-plugins-base (commit 22827e8f) $git clone https://gitlab.freedesktop.org/gstreamer/gst-plugins-base.git $cd gst-plugins-base $patch -p1 < gst-plugins-base-pass-build.patch $meson build --prefix=<your install folder>/usr $ninja -C build $ninja -C build install   Build gst-plugins-bad (commit ed14e0d5a) $git clone https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad.git $cd gst-plugins-bad $meson build --prefix=<your install folder>/usr $ninja -C build $ninja -C build install If you met gdbus-codegen issue, please remove the “--c-generate-autocleanup” and “--output-directory” parameters in the build/build.ninja If you met issue of include file like: “…/gst/gl/gstglapi.h:24:10: fatal error: gst/gl/gstglconfig.h: No such file or directory.” Please modify the build/build.ninja to correct the -I header file parameter of the build. After gst-plugins-base and gst-plugins-bad installed into <your install folder>, please fix the “prefix” path in the .pc files and copy them into the toolchain folders: $cd <your install folder> $grep -lR <your install folder> ./lib/pkgconfig/ | xargs sed -i 's/<your install folder>/\/usr/g' NOTE: Make sure you use the ‘\’ for ‘/’ convert in your path. $cp -rf ./usr/* /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/   Build H.264 SW plugins AVTPDU uses H.264 as payload for streaming, this requires H.264 encoder/decoder plugins, either software or hardware accelerations. Since we upgrade the Gstreamer and its plugins to a new version, the VPU plugins cannot be used anymore. So software H.264 plugins are required: x264 for encoder, libav for decoder.   Build x264 As the yocto actually has the x264 recipes, but not included in our bblayers, we need to copy the x264 source into our bblayers path under <yocto>/source to build: $cp -rf ./poky/meta/recipes-multimedia/x264 ./meta-openembedded/meta-multimedia/recipes-multimedia/ $vi ./meta-openembedded/meta-multimedia/recipes-multimedia/x264_git.bb Remove the LICENSE_FLAGS line $bitbake -f x264 -c do_install $sudo cp -rf tmp/work/aarch64-poky-linux/x264/r2917+gitAUTOINC+72db437770-r0/image/usr/* /opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr/ Build gst-plugins-ugly (commit 995a135d) $git clone https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly.git $cd gst-plugins-ugly$meson build --prefix=<your install folder>/usr $ninja -C build $ninja -C build install If you met build issue, please remove "if have_cxx" from meson.build Build libav As the yocto actually has the libav recipes, but not included in our bblayers, we need to copy the its source into our bblayers path under <yocto>/source: $cp -rf ./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav ./meta-openembedded/meta-multimedia/recipes-multimedia/gstreamer $vi ./meta-openembedded/meta-multimedia/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.16.1.bb Remove the LICENSE_FLAGS line $bitbake -f gstreamer1.0-libav -c do_install $cp tmp/work/aarch64-mx8mp-poky-linux/gstreamer1.0-libav/1.14.0-r0/image/usr/lib/gstreamer-1.0/libgstlibav.so <your install folder>/usr/lib/gstreamer-1.0 Now you have all of the Gstreamer plugins which required for AVB/TSN audio/video demo: avtpsrc, avtpsink, avtpaafpay, avtpaafdepay, avtpcvfpay, avtpcvfdepay x264_enc (encoder), avdec_h264 (decoder)   Install binaries Final step is to copy all of your built out files from <your install folder> into your board / root, and boot up the board. Verify the Gstreamer plugins install correctly or not: $export GST_PLUGIN_PATH= /usr/lib/gstreamer-1.0/ $gst-inspect-1.0 Check if the above Gstreamer plugins we built out can be found by gst-instpect.   System Setup VLAN The ENTE_QoS is assigned to eth1 instance. So create eth1.5 for vlan id 5: $ip link add link eth1 name eth1.5 type vlan id 5 \         egress-qos-map 2:2 3:3 $ip link set eth1.5 up Qdiscs The TSN control plane is implemented through the Linux Traffic Control (TC) System. The transmission algorithms specified in the Forwarding and Queuing for Time-Sensitive Streams (FQTSS) chapter of IEEE 802.1Q-2018 are supported via TC Queuing Disciplines (qdiscs). Linux currently provides the following qdiscs relating to TSN: Multiply queue qdiscs (These two qdiscs are mutually exclusive, select one for your demo): MQPRIO: Mapping the TC class into different hardware queue in IP. TAPRIO: Implements the Enhancements for Scheduled Traffic introduced by IEEE 1Qbv/Qbu. This is supported by i.MX8MP ENET_QoS IP through EST features: Qbv – Time aware shaper Qbu - frame preemption. CBS qdisc: Implements the Credit-Based Shaper introduced by the IEEE 802.1Qav This is supported by i.MX8MP ENET_QoS IP through EST (Enhancements to Scheduled Traffic) features. It works with mqprio qdisc together. ETF qdisc: While not an FQTSS feature, Linux also provides the Earliest TxTime First (ETF) qdisc which enables the LaunchTime Since the i.MX8MP ENET_QoS IP does not support LaunchTime feature, this qdisc configurations would be ignored.   MQPRIO qdisc $tc qdisc add dev eth1 parent root handle 100 mqprio \         num_tc 3 \         map 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 \         queues 1@0 1@1 1@2 \         hw 1 NOTE, since ENET_QoS Q0 does not support hardware CBS, we have to avoid using Q0 for AVB streaming. Here’s the mapping: socket SO_PRIORITY 2 -> TC CLASS 2 -> Q2 socket SO_PRIORITY 3 -> TC CLASS 1 -> Q1 Other socket priority -> TC CLASS 0 -> Q0   TAPRIO qdisc Create a root qdisc handle to map the different CLASS streams to hardware queues w/ GCL (gate control list). This root handle maps the CLASS A stream to queue Q1, CLASS B stream to Q2, and others to Q0 by the “map” and “queues” parameters, same as mqprio above. The Q1/Q2(CLASS1/2) gates are open in the first 300us interval, then only Q1(CLASS1) gate is open in the next 300us with all other CLASS gated. The last sched-entry defines in after Q1 is open after 300us, all of the CLASS gates are open for next 200us. Then loopback to the first sched-entry for gate control. Please note in this demo, we only enable features to support the 802.1Qbv, the Qbu (Frame preempt) requires patches for iproute2. $tc qdisc add dev eth1 parent root handle 100 taprio \         num_tc 3 \         map 0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 \         queues 1@0 1@1 1@2 \         base-time 1000000000 \         sched-entry S 0x6 300000 \         sched-entry S 0x2 300000 \         sched-entry S 0x7 200000 \         flags 0x2   CBS qdisc Q1 CBS for video, Q2 CBS for audio: $tc qdisc replace dev eth1 parent 100:2 handle 777 cbs \         idleslope 98688 sendslope -901312 hicredit 153 locredit -1389 \         offload 1 $tc qdisc replace dev eth1 parent 100:3 handle 888 cbs \         idleslope 3648 sendslope -996352 hicredit 12 locredit -113 \        offload 1 NOTE: By default, the Q0 will be allocated for pfifo qdisc class if we do not define them.   ETF qdisc As ENET_QOS does not support hardware launch time in IP, the ETF qdisc would not be used here.   TimeSync Run the ptp4l and phc2sys in background, and use check_clocks to check the ptp sync works. $ptp4l -i eth1 -f ./gPTP.cfg --step_threshold=1 & $pmc -u -b 0 -t 1 "SET GRANDMASTER_SETTINGS_NP clockClass 248 \         clockAccuracy 0xfe offsetScaledLogVariance 0xffff \         currentUtcOffset 37 leap61 0 leap59 0 currentUtcOffsetValid 1 \         ptpTimescale 1 timeTraceable 1 frequencyTraceable 0 \         timeSource 0xa0" $phc2sys -s eth1 -c CLOCK_REALTIME --step_threshold=1 \         --transportSpecific=1 -w &  $./check_clocks -d eth1 The PTP Hardware Clock (PHC)  synced between PTP master/slave means the RMS offset between PHC and GM (master clock) is < 100ns. PHC and system clock (CLOCK_REALTIME) synced means the clock offset < 100ns   NOTE: The check_clocks source code can be downloaded from here. cfg is described below, if you want to identify which is master and which is slave, use “masterOnly 1” or “slaveOnly 1” in this configuration file. #                                                                 # 802.1AS example configuration containing those attributes which # differ from the defaults.  See the file, default.cfg, for the   # complete list of available options.                              #                                                                 [global]                                                          gmCapable               1                                         priority1               248                                        priority2               248                                       logAnnounceInterval     0                                         logSyncInterval         -3                                        syncReceiptTimeout      3                                          neighborPropDelayThresh 800                                       min_neighbor_prop_delay -20000000                                 assume_two_step         1                                         path_trace_enabled      1                                         follow_up_info          1                                         transportSpecific       0x1                                        ptp_dst_mac             01:80:C2:00:00:0E                         network_transport       L2                                        delay_mechanism         P2P                                        Run demo ALSA AAF audio To run the alsa AAF demo, please add aaf0 and converter0 plugin device into /etc/asound.conf: pcm.aaf0 {         type aaf         ifname eth1.5         addr 01:AA:AA:AA:AA:AA         prio 2         streamid AA:BB:CC:DD:EE:FF:000B         mtt 50000         time_uncertainty 1000         frames_per_pdu 12         ptime_tolerance 100 }    pcm.converter0 {         type linear         slave {                 pcm "hw:2,0"                 format S16_LE         } }   The “aaf0” plugin device defines the ethernet interface which AAF runs on, the socket priority which mapping to Traffic Class in kernel TC, the stream-id for the aaf streaming. The “converter0” plugin device is used for convert the S16_BE format to S16_LE for the wm8960 PCM audio.   Select one device as AVB talker, and run: $speaker-test -p 25000 -F S16_BE -c 2 -r 48000 -D aaf0 Select one device as AVB talker, and run: $arecord -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D aaf0 | aplay -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D converter0 You can hear the sound on the listener device. You can also check which qdisc queue is used for AAF by: $tc -s qdisc   Gstreamer AAF audio Select one device as AVB talker, and run: $gst-launch-1.0 clockselect. \( clock-id=realtime \     audiotestsrc samplesperbuffer=12 is-live=true ! \     audio/x-raw,format=S16BE,channels=2,rate=48000 ! \     avtpaafpay mtt=50000000 tu=1000000 streamid=0xAABBCCDDEEFF000B processing-deadline=0 ! \     avtpsink ifname=eth1.5 address=01:AA:AA:AA:AA:AA priority=2 processing-deadline=0 \)   Select one device as AVB listener, and run: $gst-launch-1.0 clockselect. \( clock-id=realtime \     avtpsrc ifname=eth1.5 ! avtpaafdepay streamid=0xAABBCCDDEEFF000B ! \     queue max-size-bytes=0 max-size-buffers=0 max-size-time=0 ! \     audioconvert ! audioresample !  alsasink device="hw:2,0" \)   Gstreamer CVF video Select one device as AVB talker, and run: $gst-launch-1.0 clockselect. \( clock-id=realtime \     videotestsrc is-live=true ! video/x-raw,width=480,height=320,framerate=15/1 ! \     clockoverlay ! x264enc bframes=0  key-int-max=1 speed-preset=1 tune=4 ! h264parse config-interval=-1 ! \     avtpcvfpay processing-deadline=20000000 mtu=1400 mtt=2000000 tu=125000 streamid=0xAABBCCDDEEFF000A ! \     avtpsink ifname=eth1.5 priority=3 processing-deadline=20000000 \) NOTE: To eliminate the h.264 software encoding/decoding overhead with acceptable latency for this demo, we use several parameters for x264enc element: bframes: x264enc and avdec_h264 together was found to have issues, remove bframes in the stream would help. key-int-max: decoder can only decode the frame when a keyframe is present on stream to make sure decoder can work as faster as it can, the distance between two keyframes must be set to closest. speed-preset: to low down the CPU loading for encoding, we use the option to make encoding as faster as we can. (=1 means ultrafast) tune: 4 means zero latency ‘mtu=1400’ parameters for avtpcvfpay element is very important, if using the default mtu=1500, the listener cannot get the AVTPDUs package correctly from VLAN. The reason is unknown yet.   Select one device as AVB listener, and run: $gst-launch-1.0 clockselect. \( clock-id=realtime \     avtpsrc ifname=eth1.5 ! avtpcvfdepay streamid=0xAABBCCDDEEFF000A ! \     queue max-size-bytes=0 max-size-buffers=0 max-size-time=0 ! \     avdec_h264 ! videoconvert ! clockoverlay halignment=right ! waylandsink \)   The demo screenshot below: there are two clocks show on the videotestsrc stream: left one is the timestamp recorded before x264enc encoding on the AVB talker side, right one is the timestamp recorded after avdec_h265 decoding and do video convert to YUV frames on AVB listener side. You can see the timestamp is sync in seconds.     Deep dive Packet sniffer Use tcpdump on board to dump the L2 ethernet packet: ./tcpdump -i eth1 ether proto 0x22f0 -w dump.pcap The AVTP ether protocol code is 0x22f0 embedded inside the ether frame, or you can use "vlan 5" VLAN id for tcpdump parameters to dump. Then open this dump.pcap in the windows/Linux PC by the wireshark tool, it will automatically show the protocol inside the package, it can also parser the IEEE1722 (AVTP) CVF/AFF package header as below:   Precise latency measurement The clockoverlay plugin used in the above talker/listener is actually seconds level precision, which can not reflect the latency from talker videotestsrc -> listener avdec_h264 decoding finish. Here need a little hack to the clockoverlay element in the gst-plugins-base to get the millisecond precision. The patch is attached (gst-plugins-base-clockoverlay-us.patch), please apply and rebuild the gst-plugins-base, then replace the libgstpango.so on the board /usr/lib/gstreamer-1.0/. When doing CVF demo, you can take a picture of the screen, and check the two clock's diff. During my test, the latency is about 50ms, which include all the cost of encoding, AVTP packaging, streaming, ethernet transmit, ethernet receive, AVTP unpack and frame decoding. To measure the package latency from transmit port (talker) to receive port (listener), you can use the tcpdump on both end-points. And compare the Epoch Time the packet dumped: "Epoch Time: 1596252905.688243000 seconds". The delta of the epoch time of the same packet is around 100us~500us. This latency actually includes the AF_PACKET clone cost in kernel netfilter, also the tcpdump application schedule latency.   References Getting started with AVB on Linux: https://tsn.readthedocs.io/avb.html TSN vs AVB: https://dornerworks.com/blog/avb-vs-tsn-choose-the-best-deterministic-ethernet-solution-for-your-networked-devices/ ALSA aaf: https://fossies.org/linux/alsa-plugins/doc/aaf.txt Gstreamer avtp: https://gstreamer.freedesktop.org/documentation/avtp/index.html AVTP: https://avnu.org/wp-content/uploads/2014/05/AVnu-AAA2C_Audio-Video-Transport-Protocol-AVTP_Dave-Olsen.pdf MX8MP RM
View full article
Design Check Lists: HW Design Checking List for i.MX6DQSDL HW Design Checking List for i.Mx53 Hardware Design Checklist for i.MX28 HW_Design_Checking_List_for_i.MX6SoloX i.MX6UL Hardware design checklist   DDR Design Tool: I.MX53 DDR3 Script Aid imx53 DDR stress tester V0.042 i.Mx6DQSDL DDR3 Script Aid MX6DQP DDR3 Script Aid i.Mx6DQSDL LPDDR2 Script Aid i.Mx6SL LPDDR2 Script Aid i.MX6SX DDR3 Script Aid I.MX6UL DDR3 Script Aid i.MX6UL_LPDDR2_Script_Aid i.MX6ULL_DDR3_Script_Aid  i.MX6ULL_LPDDR2_Script_Aid  MX6SLL_LPDDR2_Script_Aid  MX6SLL_LPDDR3_Script_Aid  i.MX6 DDR Stress Test Tool V1.0.3 i.MX6/7 DDR Stress Test Tool V3.00 i.MX8MSCALE DDR Tool Release  i.MX8M DDR3L register programming aid  i.MX 8/8X Family DDR Tools Release   Application Notes: MX_Design_Validation_Guide I.MX6 series USB Certification Guides
View full article
Don't forget to update your source code. How to customize the image Enter <yocto>/source and find any image available: $ find -name *image*.bb ./meta-fsl-demos/recipes-fsl/images/fsl-image-gui-sdk.bb ./meta-fsl-demos/recipes-fsl/images/fsl-image-test.bb ./meta-fsl-demos/recipes-fsl/images/fsl-image-gui.bb ./meta-fsl-demos/recipes-qt/images/qt-in-use-image.bb ./meta-fsl-demos/recipes-qt/images/qte-in-use-image.bb ./meta-openembedded/meta-initramfs/recipes-bsp/images/initramfs-kexecboot-klibc-image.bb ./meta-openembedded/meta-initramfs/recipes-bsp/images/initramfs-kexecboot-image.bb ./meta-openembedded/meta-oe/recipes-support/imagemagick/imagemagick_6.7.5.bb ./meta-openembedded/meta-oe/recipes-multimedia/libsdl-image/libsdl-image_1.2.12.bb ./poky/meta-hob/recipes-core/images/hob-image.bb ./poky/meta-skeleton/recipes-multilib/images/core-image-multilib-example.bb ./poky/meta/recipes-devtools/mkelfimage/mkelfimage_svn.bb ./poky/meta/recipes-sato/images/core-image-sato-dev.bb ./poky/meta/recipes-sato/images/core-image-sato.bb ./poky/meta/recipes-sato/images/core-image-sato-sdk.bb ./poky/meta/recipes-qt/images/qt4e-demo-image.bb ./poky/meta/recipes-core/images/core-image-minimal.bb ./poky/meta/recipes-core/images/core-image-base.bb ./poky/meta/recipes-core/images/core-image-minimal-dev.bb ./poky/meta/recipes-core/images/core-image-minimal-initramfs.bb ./poky/meta/recipes-core/images/build-appliance-image.bb ./poky/meta/recipes-core/images/core-image-minimal-mtdutils.bb ./poky/meta/recipes-extended/images/core-image-lsb-sdk.bb ./poky/meta/recipes-extended/images/core-image-basic.bb ./poky/meta/recipes-extended/images/core-image-lsb-dev.bb ./poky/meta/recipes-extended/images/core-image-lsb.bb ./poky/meta/recipes-graphics/images/core-image-directfb.bb ./poky/meta/recipes-graphics/images/core-image-x11.bb ./poky/meta/recipes-graphics/images/core-image-clutter.bb ./poky/meta/recipes-graphics/xcb/xcb-util-image_0.3.9.bb ./poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2012.04.01.bb ./poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2011.06.bb ./poky/meta/recipes-bsp/u-boot/u-boot-mkimage_2011.03.bb ./poky/meta/recipes-rt/images/core-image-rt-sdk.bb ./poky/meta/recipes-rt/images/core-image-rt.bb The above images (and packages with 'image' in file name) may be used as a base image, where new packages may be added, or example of new images. bitbake -s  shows any *available* package locally. Grep for the name of desired package: $ bitbake -s | grep calibrat calibrateproto                      :0.0+gitAUTOINC+1da6fd1e2c7a49648245c98481fabea8b9690a8c-r2             libxcalibrate                       :0.0+gitAUTOINC+209d83af61ed38a002c8096377deac292b3e396c-r0             xinput-calibrator                   :0.7.5+gitAUTOINC+c01c5af807cb4b0157b882ab07a893df9a810111-r1 For example, the package name is xinput-calibrator, in order to include this package this would be the string needed. The dependency tree is shown with $ bitbake -g fsl-image-test For the fsl-image-test. Or any other image Include the package name on the image definition file. $ cd meta-fsl-demos/ $ vim recipes-fsl/images/fsl-image-test.bb Include the package name on IMAGE_INSTALL list: IMAGE_INSTALL += " \     packagegroup-fsl-gstreamer \     packagegroup-fsl-tools-testapps \     packagegroup-fsl-tools-benchmark \ xinput-calibrator \ " In order to include the package on any image, configure conf/local.conf file the as the following: MACHINE ??= 'imx6qsabresd' DISTRO ?= 'poky' PACKAGE_CLASSES ?= "package_rpm" EXTRA_IMAGE_FEATURES = "debug-tweaks tools-sdk" USER_CLASSES ?= "buildstats image-mklibs image-prelink" PATCHRESOLVE = "noop" CONF_VERSION = "1" BB_NUMBER_THREADS = '8' PARALLEL_MAKE = '-j 8' ACCEPT_FSL_EULA = "1" CORE_IMAGE_EXTRA_INSTALL += "xinput-calibrator" And then $ bitbake fsl-image-test In order to add debug or native builder include on conf/local.conf: EXTRA_IMAGE_FEATURES += "tools-sdk" Every image created after that will include development tools. The same may be included in any bb image file. From Poky description: 'tools-sdk" - Adds development tools such as gcc, make, pkgconfig and so forth. "dev-pkg" - Adds -dev packages for all installed packages. This is useful if you want to develop against the libraries in the image. "tools-debug" - Adds debugging tools such as gdb and strace. If you don't like command line, or you prefer a window-like interface, you can take a look on HOB. See hob documentation https://www.yoctoproject.org/documentation/hob-manual See getting started video for hob Introducing Hob - YouTube Go to Yocto Training - HOME Go to Task #5 - Kernel
View full article
本文旨在说明基于i.MX8X如何设计硬件平 台,包括相关设计资源的收集与学习,硬件原 理图设计,layout,启动(bring up),量产准备, 及正式量产后的失效分析与失效控制。主要是 帮助厘清硬件开发相关从头到尾的问题。 请注意本文为培训和辅助文档,部分内容源 自PMIC/i.MX8X硬件开发指南,并作中文翻 译,强调重点,和查缺补漏,本文不是官方文 档的替代,请一切以官方文档为准。 目录: i.MX8X硬件参考平台 ................................................. 3 2 i.MX8X硬件设计资源 ................................................. 5 i.MX8X芯片相关设计资源 ............................................... 5 i.MX8QXP MEK板外设相关设计资源 ........................... 10 i.MX8QXP 硬件接口规范 .............................................. 11 3 i.MX8X原理图设计检查点 ........................................ 13 PMIC+i.MX8X供电能力和上电时序 .............................. 13 PMIC电源输出端设计 ................................................... 17 I.MX8X电源输入端及去耦设计 ..................................... 22 LPDDR4内存设计 ........................................................ 23 DDR3L内存设计 ........................................................... 25 I2C总线设计 ................................................................. 26 Reset,Wdog reset和On/Off设计建议 ......................... 27 PCIe设计 ...................................................................... 29 USB设计 ...................................................................... 30 晶体时钟设计 ............................................................... 32 JTAG信号端接设计 ...................................................... 34 未使用接口管脚的端接处理 .......................................... 35 GPIO管脚的设计策略 ................................................... 37 调试接口建议 ............................................................... 37 4 i.MX8X 布线设计检查点 ........................................... 40 PMIC电源输出端布线建议 ............................................ 40 i.MX8X端去耦电容摆放 ................................................ 41 电源布线建议 ............................................................... 41 PCB叠层建议 ............................................................... 43 内存布线通用建议 ........................................................ 43 LPDDR4内存布线建议 ................................................. 44 DDR3L内存布线建议.................................................... 45 内存信号完整性仿真建议 ............................................. 47 内存JEDEC信号兼容性测试 ......................................... 48 高速电路板布线建议..................................................... 49 时钟建议 ...................................................................... 50 信号线阻抗建议 ............................................................ 53 USB布线建议 ............................................................... 54 5 i.MX8X硬件散热设计 ............................................... 54 6 i.MX8X硬件启动bring up .......................................... 56 Bring up需要参考的文档与使用工具............................. 56 i.MX8X Bring up需要准备的文档与使用工具 ............................. 60 Bring up检查列表 .......................................................... 65 7 试产与量产前检查点 ................................................. 67 内存稳定性 ................................................................... 67 ESD与EMI考虑 ............................................................. 68 产线设计 ....................................................................... 69 8 i.MX8X失效分析流程 ................................................ 70 NXP失效分析服务 ........................................................ 70 NXP FA失效分析流程 ................................................... 70 筛查是否是芯片原生问题 .............................................. 72 9 量产厂线的EOS/ESD控制 ........................................ 73 什么是EOS/ESD ........................................................... 73 设计中的EOS/ESD风险检查点 ..................................... 75 生产产线中的EOS/ESD风险与防护 .............................. 78
View full article
After bitbake meta-toolchain the script to install the toolchain package is located under $ ls tmp/deploy/sdk/poky-eglibc-x86_64-arm-toolchain-1.4.1.sh    tmp/deploy/sdk/poky-eglibc-x86_64-arm-toolchain-1.4.1.sh In order to install it: $ source poky-eglibc-x86_64-arm-toolchain-1.4.1.sh     [sudo] password for daiane:     Enter target directory for SDK (default: /opt/poky/1.4.1):     You are about to install the SDK to "/opt/poky/1.4.1". Proceed[Y/n]?y     Extracting SDK...done     Setting it up...done     SDK has been successfully set up and is ready to be used. Hello World $ source /opt/poky/1.4.1/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi $ cd ~/test/ $ arm-poky-linux-gnueabi-gcc helloworld.c $ ls a.out                                                 helloworld.c                           $ ./a.out -bash: ./a.out: cannot execute binary file $ file a.out a.out: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped Kernel $ source /opt/poky/1.4.1/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi $ cd linux-2.6-imx $ git checkout remotes/origin/imx_3.0.35 $ export ARCH=arm $ export CROSS_COMPILE=$TARGET_PREFIX $ unset LDFLAGS $ make imx6_defconfig $ make uImage Make sure to have mkimage available on bin patch (if using mkimage from u-boot export its patch) Or, download the ubuntu pachage: sudo apt-get install uboot-mkimage UPDATE You may find the following error:   OBJCOPY arch/arm/boot/zImage   Kernel: arch/arm/boot/zImage is ready multiple (or no) load addresses: This is incompatible with uImages Specify LOADADDR on the commandline to build an uImage make[1]: *** [arch/arm/boot/uImage] Error 1 make: *** [uImage] Error 2 This is regarding a missing LOADADDR for mkimage to use to generate uImage with the right offset to be placed in the right LOADADDR. The address value is dependent on your hardware! And it is different depending on imx6 variations. So please be aware regarding what is your right value. If the machine you are using is supported in yocto project/meta-fsl-arm, for example, you can find the value related with your board in the file conf/machine/include/imx-base.inc or online here meta-fsl-arm - Layer containing Freescale ARM hardware support metadata It is the same value used in variable UBOOT_ENTRYPOINT. For example as of this writing for the Freescale SABRE-SD board looking in conf/machine/include/imx-base.inc UBOOT_ENTRYPOINT_mx6  = "0x10008000" Thus the build command would be: $ make uImage LOADADDR=0x10008000 So, as a quick reference table, I point here the 3 most wanted make command lines: imx28evk: $ make LOADADDR=0x40008000 imx53qsb: $ make LOADADDR=0x70008000 imx6qsabresd: $ make LOADADDR=0x10008000 Update 2 Suggested by cmcqueen1975 Building an autotools-based package. E.g. $ source /opt/poky/1.4.1/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi $ ./configure ${CONFIGURE_FLAGS} $ make $ make install the CONFIGURE_FLAGS is the variable depending on your very-own project. Go to Yocto Training - HOME Go to Task #7 - Create the toolchain
View full article
Building Freescale U-boot The U-boot provided by Freescale can be downloaded in the following link: http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/ 1 - Set the cross compiler environment variables. When using Yocto, it can be made by the following command (see more details at Yocto Trainning Yocto Training - HOME ) source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi 2 - Download the source code using "git clone": git clone  http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git 3 - Create a local branch based on some remote branch. In this example, lets use branch origin/imx_v2014.04_3.14.28_1.0.0_ga cd uboot-imx git checkout -b imx_v2014.04_3.14.28_1.0.0_ga_local origin/imx_v2014.04_3.14.28_1.0.0_ga 4 - Configure the project with the board you want to build. All board are listed on file boards.cfg. Check the exactly name of the choosen board and add "_config" to build the project. In this example, lets use mx6qsabresd make mx6qsabresd_config make 5 - The binary file will be generated and will be located at project root folder. The generated file in this case will be u-boot.imx 6 - More details can be found on files doc/README.imx6 doc/README.imximage README Building Mainline U-boot The U-boot project is developed and maintained by Denx Computer Systems can be downloaded in the following link: http://git.denx.de/?p=u-boot.git;a=summary 1 - Set the cross compiler environment variables. When using Yocto, it can be made by the following command (see more details at Yocto Trainning Yocto Training - HOME ) source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi 2 - Download the source code using "git clone": git clone http://git.denx.de/u-boot.git 3 - Check the name of the board on "configs" folder. In this case lets use mx6qsabresd_config make mx6qsabresd_config make 4 - The binary file will be generated and will be located at project root folder. The generated file in this case will be u-boot.imx
View full article
Application Note covering how to get the Silex SX-SDCAN working with the Sabre-SD i.MX6 Evaluation kit.
View full article
HDMI Dongle SW: The attachment is an HDMI dongle patch based on R13.4 GA. The patches include r13.4-ga-add-on-patches. You can patch it after applying R13.4 GA patch such as add-on patches. You can run script to revb_dongle_patch_install.sh to apply these patches. How to apply the hdmidongle_REVB_R13.4_patch-20121115.tgz: 1. Suppose your android source top is ~/myandroid 2. tar zfvx hdmidongle_REVB_R13.4_patch-20121115.tgz -C ~/ 3. copy revb_dongle_patch_install.sh to ~/ 4. cd hdmidongle_REVB_R13.4_patch 5. ~/revb_dongle_patch_install.sh 6. The  revb_dongle_patch_install.sh will take ~/myandroid as default directory to do patch 7. If your android source tree top is not ~/myandroid. For example, ~/myandroid_ICS, please run ~/revb_dongle_patch_install.sh ~/myandroid_ICS   The following is the release notes for  hdmidongle_REVB_R13.4_patch-20130118.tgz 1. New features:    a. uboot fastboot    b. ldo bypass    c. ntfs support    d. bluetooth A2DP   2. Bug fix    a. WifiDirect connect issue    b. realtek throughput issue with TPLink AP   3. File list:    README.TXT                                      --- this file    0001-uboot_fastboot.patch                       --- uboot fastboot  patch    0002-LDOBYPASS.patch                            --- enable ldo bypass  patch    0003-WifiDirect.patch                           --- wifi direct connect patch    0004-ntfs_support.patch                         --- ntfs support patch    0005-BT_enable.patch                            --- enable bluetooth A2DP    0006-1G_boot_stable.patch                       --- make 1G bootup stable    ntfs-3g.tar.gz                                  --- open source ntfs-3g for ntfs support    rtl8192ce_v4.0.0_6239.20121226_TPIOT1.tgz       --- realtek new driver for TPLink AP throughput issue    MD5SUM.TXT                                      --- md5 check sum   4. Patch guide    Please run md5sum -c MD5SUM.TXT first to confirm all the files received are ok.    All these patches are based on the patch release hdmidongle_REVB_R13.4_patch-20121115.tgz    You need to do as following: R13.4 GA--->patch hdmidongle_REVB_R13.4_patch-20121115.tgz --> patch hdmidongle_REVB_R13.4_patch-20130118.tgz    Supposed the ~/myandroid is your top directory of the android source tree.    Please run the following command to apply the patches .    $tar zfvx hdmidongle_REVB_R13.4_patch-20130118.tgz -C ~/    $cd ~/myandroid    $git apply  ~/hdmidongle_REVB_R13.4_patch-20130118/0001-uboot_fastboot.patch --verbose    $git apply  ~/hdmidongle_REVB_R13.4_patch-20130118/0002-LDOBYPASS.patch --verbose    $git apply  ~/hdmidongle_REVB_R13.4_patch-20130118/0003-WifiDirect.patch --verbose    $git apply  ~/hdmidongle_REVB_R13.4_patch-20130118/0004-ntfs_support.patch --verbose    $git apply  ~/hdmidongle_REVB_R13.4_patch-20130118/0005-BT_enable.patch --verbose    $git apply  ~/hdmidongle_REVB_R13.4_patch-20130118/0006-1G_boot_stable.patch --verbose    $rm -rf kernel_imx/drivers/net/wireless/rtl8192ce    $tar zfvx ~/hdmidongle_REVB_R13.4_patch-20130118/rtl8192ce_v4.0.0_6239.20121226_TPIOT1.tgz    $tar zfvx ~/hdmidongle_REVB_R13.4_patch-20130118/ntfs-3g.tar.gz -C external   5. Build and run     new patch 0007-battery_always_full.patch:   Some games check the battery capacity to determine, it could run or not. But on the hdmi dongle we have no real battery, it makes some games can not run on the hdmi dongle.  We enable the fake battery let the andorid feel it has battery and it is 100% full. 1. Please use this patch after patch hdmidongle_REVB_R13.4_patch-20130118.tgz 2. suppose your android top directory is ~/myandroid and you put he 0007-battery_always_full.patch in your home directory ~ 3. cd ~/myandroid 4. git apply --verbose ~/0007-battery_always_full.patch 5. please rebuild bootimage and run   patch   0008-boot_unlock_screen.patch: When bootup, it goes into desktop rather than screen locker.   1. suppose your android top directory is ~/myandroid and you put the 0008-boot_unlock_screen.patch in your home directory ~ 2. cd ~/myandroid 3. git apply --verbose ~/0008-boot_unlock_screen.patch 4. please rebuild systemtimage and run 2. cd ~/myandroid 3. git apply --verbose ~/0008-boot_unlock_screen.patch patch 0009-uboot-enable-mmu-fix.patch: This patch is for some issue in mmu enable. It will improve all the modules in uboot.   1. suppose your android top directory is ~/myandroid and you put the 0009-uboot-enable-mmu-fix.patch in your home directory ~ 2. cd ~/myandroid 3. git apply --verbose ~/0009-uboot-enable-mmu-fix.patch 4. please rebuild uboot  and rub     patch tarball   hdmidongle_REVB_R13.4_patch-20130123.tgz:   hdmidongle_REVB_R13.4_patch-20130123.tgz contains 0007-battery_always_full.patch  0008-boot_unlock_screen.patch 0009-uboot-enable-mmu-fix.patch remove attached files here: 0007-battery_always_full.patch  0008-boot_unlock_screen.patch 0009-uboot-enable-mmu-fix.patch     Remove hdmidongle_REVB_R13.4_patch-20130123.tgz, hdmidongle_REVB_R13.4_patch-20130118.tgz and upload hdmidongle_REVB_R13.4_patch-20130124.tgz   hdmidongle_REVB_R13.4_patch-20130124.tgz  contains all patches in hdmidongle_REVB_R13.4_patch-20130123.tgz, hdmidongle_REVB_R13.4_patch-20130118.tgz. Please use the  hdmidongle_REVB_R13.4_patch-20130124.tgz.   hdmidongle_REVB_R13.4_patch-20130131.tgz: Besides all the patches released before. Three more patches are added in this patch tar ball.     0010-boot_disable_screenlocker.patch                     --- For fix  0008-boot_unlock_screen.patch 0011-wm8326-DC_CONTROL_RATE.patch                        --- Change the wm8326 pmic rate to immediate voltage change 0012-Added-default-video-mode-check-make-sur.patch       --- Video mode check   hdmidongle_REVB_R13.4_patch-20130201.tgz:   Just change the readme  to place emphasis on   the 0006-1G_boot_stable.patch reverse   Reverse patch 0008-boot_unlock_screen.patch and 0006-1G_boot_stable.patch   0008-boot_unlock_screen.patch: it has some problem but doesn't do any harm to the hdmi dongle.                                                  Please use 0010-boot_disable_screenlocker.patch, instead. 0006-1G_boot_stable.patch:  The patch take more cpu delay to adapt the pmic, we change the pmic setting                                             in  0010-boot_disable_screenlocker.patch. This patch is no needed. And it will lower                                            the performance. Please reverse it.                                            cd ~/myandroid                                            git apply --verbose ~/0006-1G_boot_stable.patch                                                                                           hdmidongle_REVB_R13.4_patch-20130221.tgz: There are three important fixes include in this release. They make the dongle stable. 1. lowmem killer issue fix 2. Update realtek wifi driver to fix the soft ap issue 3. Wifi p2p framework fix to resovle wifi direct only one side work issue   Please read the README.TXT for detail and the other changes.   hdmidongle_REVB_R13.4_patch-20130308.tgz: This patch tar ball include all the patches in hdmidongle_REVB_R13.4_patch-20130221.tgz. Besides, it has a new patches 0020-DL_WifiDirect_Concunrrent_crash_fix.patch to fix the crash issue on DL board.   HDMI Dongle HW:   HDMI Dongle schematic, pcb, gerber and BOM have been attached, the detailed hardware feature has been list below:   Android 4.x HDMI Dongle SPECIFICATION Core Configure Operating System Android 4.x Operating System Based on Micro-PC Platform CPU Processor Freescale i.MX6x DualLite/Quad Core DRAM Storage DDR3 1GigaByte Size, Data rate 1066MT/s Flash Storage 4GigaByte NAND flash ROM Power System Power Supply DC JACK / Micro USB : 5V/2A LED Status Green: Power ON; Red: System Run Socket/Connector MicroSD Socket SDXC Support, Up to 32GB size USB HOST 2.0 USB 2.0 HOST Support USB OTG 2.0 USB 2.0 OTG Support Display/Audio HDMI Output HDMI TypeA Plug connector, 1080p@60Hz output Video Decoder Support Variety of Video Format: MPEG4/H.263/H.264/MJPEG/Xvid/VC-1/WMV/MPEG2/VP8... Audio Decoder Support Variety of Audio Format: MP3/AAC/LPCM/FLAC/AMR/AC3/WMA/Vorbis GPU Support GC2000 GPU core,2D/3D engine support,OpenGL support Wireless Network WiFi Network IEEE 802.11b/g/n,Up to 300Mbps,AP/P2P/Sta Mode Support Others Key Recovery key support RevB2     OTT TV BOX LINK: https://community.freescale.com/docs/DOC-94561   JB4.2 patches link : Patches for HDMI Dongle JB4.2.2_1.0.0-GA Release
View full article