Yocto Kirkstone - MayQueenTechCommunity/WAFER-IMX8MP GitHub Wiki
Feature | |
---|---|
System | Kirkstone 4.0 LTS |
Display | Weston Desktop with Wayland fraemwork (HW acceleration) |
Wireless | WiFi6 STA/AP mode WiFi Concurrent mode Bluetooth BR/EDR Bluetooth LE |
Nerual Network | CPU: OpenCV-Caffe, Pytorch NPU with NN-Streamer:Tensorflow-Lite |
Featured functions | Normal/QT5 toolchain, libgpiod |
Video support format | MP4, AVI, MKV, WEBM, 3gp |
Audio support format | WAV, MP3, AAC |
Press the download link of demo image from Android zone, or compiled our source code from github to generate image file.
If you want to flashing image using uuu tool, preparing UUU tool which can download from NXP official github, recommended version is V1.4.193
Extract the zip file of the archive.
Preparing a USB type-C cable, connect to the target board from host PC.
Reboot into "Serial Download Mode": press SW3
download key and click SW2
reset key on WAFER-IMX8MP (or plug-in the power adapter), then board will go to Serial Download Mode.
Host PC side should be got board information for download mode, then you can issue commands to flash images in image folder which extract zip file one
UUU way
Ubuntu host:
$ cd <image folder>
$ checking imx-image-full-wafer-imx8mp-<date>.rootfs.wic image file is exist
$ sudo uuu -b emmc_all imx-boot-wafer-imx8mp-sd.bin-flash_evk imx-image-full-wafer-imx8mp-<date>.rootfs.wic
Note that if your image was compiled by host PC, please extract the image inside the zst file first
$ sudo apt install zstd
$ zstd -d imx-image-full-wafer-imx8mp-20230926053708.rootfs.wic.zst
imx-image-full-wafer-imx8mp-20230926053708.rootfs.wic.zst: 8049913856 bytes
UMS way
Target board side, please boot into u-boot prompt:
$ ums 0 2 (it means usb0 port mounting to mmc2 as a mass storage)
Ubuntu host:
$ cd <image folder>
$ checking imx-image-full-wafer-imx8mp-<date>.rootfs.wic image file is exist
$ sudo bmaptool copy imx-image-full-wafer-imx8mp-<date>.rootfs.wic /dev/sdx (sdx is the device node which you want to flashing)
Note that if your image was compiled by host PC, please extract the image inside the zst file first
$ sudo apt install zstd
$ zstd -d imx-image-full-wafer-imx8mp-20230926053708.rootfs.wic.zst
imx-image-full-wafer-imx8mp-20230926053708.rootfs.wic.zst: 8049913856 bytes
Waiting flashing progress until 100% and exit UUU tool, then reboot the board directly.
Login default username = root, no passwod, press enter directly.
repo init -u https://github.com/QNAP-android-internal/iei-imx-yocto-manifest.git -b imx-linux-kirkstone -m imx-5.15.71-2.2.0.xml
repo sync
If you have no repo command, please install it first:
$ sudo apt install repo
Please follow this chapter to setup an Yocto compile environment first, then step by step to compile flashable image.
There are two different methods you can use to set up the build environment. One is to install the required packages onto your host filesystem. Another is to use a docker container, where the installation of the required packages is automated for you.
General Packages Installation ( Ubuntu 20.04 or above, note that some packages are different name with Ubuntu 22.04 )
$ sudo apt-get install gawk wget git git-core diffstat unzip texinfo gcc-multilib build-essential \
chrpath socat cpio python python3 python3-pip python3-pexpect \
python3-git python3-jinja2 libegl1-mesa pylint3 rsync bc bison \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm \
language-pack-en coreutils texi2html file docbook-utils \
python-pysqlite2 help2man desktop-file-utils \
libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake \
groff curl lzop asciidoc u-boot-tools libreoffice-writer \
sshpass ssh-askpass zip xz-utils zstd liblz4-tool kpartx vim screen
Or adapt Docker Container based compile environment (Optional)
$ sudo docker run --privileged=true --name mx8_build -v /home/<user name>/<source folder>:/home/mnt -t -i onlywig/imx8_build bash
(first time)
$ sudo docker ps -a
$ sudo docker start <your container id>
$ docker exec -it --user wig imx8_build bash (after first time)
Source the compile relative commands:
For WAFER-IMX8MP
$ DISTRO=fsl-imx-xwayland MACHINE=wafer-imx8mp source iei-imx-setup-release.sh -b build-xwayland-wafer-imx8mp
Get the IEI WiFi firmware (optional):
please contact IEI sales <[email protected]> to get zip file first.
$ cp <source folder>/linux-firmware-iei.zip <source code>/sources/meta-iei-imx-bsp/
$ cd <source code>/sources/meta-iei-imx-bsp/
$ unzip linux-firmware-iei.zip
$ mkdir -p recipes-kernel/linux-firmware
$ mv linux-firmware-iei.bb files recipes-kernel/linux-firmware/
In order to add firmware files to rootfs, please add configuration to conf file:
$ vim conf/machine/wafer-imx8mp.conf
Add "linux-firmware-iei " to "IMAGE_INSTALL:append" variable and save the file.
For a full build:
$ bitbake -v imx-image-full
For clean the output image relate files:
$ bitbake -c clean imx-image-full
For clean the output image with downloaded files:
$ bitbake -c cleanall imx-image-full
# | shortcut set | function |
---|---|---|
1 | super + s | make a screenshot of the desktop |
2 | super + r | record start/stop a video of the desktop |
3 | super + Tab | swich active windows |
Relate behavior of UART ports as following:
UART port | RS232 | RS232(HW Flow Control) | RS422 | RS485 |
---|---|---|---|---|
ttyUSB0 | PASS | PASS | PASS | PASS(half duplex) |
ttymxc2 | PASS | PASS | N/A | PASS(half duplex) |
In RS485 mode, please issue adb commands to change transmission direction as follows:
gpioset gpiochip4 8=1 (ttymxc2 TX)
gpioset gpiochip4 8=0 (ttymxc2 RX)
gpioset gpiochip6 2=1 (ttyUSB0 TX)
gpioset gpiochip6 2=0 (ttyUSB0 RX)
Note that due to interface is difference, ttyUSB0 has a bit complicated, if you want to change direction, please close the ttyUSB0 port first and change direction, then re-open again. ttymxc2 does support dynamic change direction, no need close the port.
Please adapt gpioinfo, gpioset and gpioget to test GPIO configuration
GPIO layout as follows figures:
Also can use JP2's pin-6 as GND.
GPIO Name | GPIO number |
---|---|
EXT_GPIO1 | GPIO5_8 => Bank=5,Line=8 |
EXT_GPIO2 | GPIO5_9 => Bank=5,Line=9 |
EXT_GPIO3 | GPIO5_10 => Bank=5,Line=10 |
EXT_GPIO4 | GPIO5_11 => Bank=5,Line=11 |
EXT_GPIO5 | GPIO5_12 => Bank=5,Line=12 |
EXT_GPIO6 | GPIO5_13 => Bank=5,Line=13 |
EXT_GPIO7 | GPIO5_14 => Bank=5,Line=14 |
EXT_GPIO8 | GPIO5_15 => Bank=5,Line=15 |
Note that if setting one pin as input pin, please use GET function only. If setting one pin as output pin, please use SET function only, DON'T use GET after SET function, this pin will change to input pin.
Platform | specific function | dtb name |
---|---|---|
WAFER-IMX8MP | Default TQ101AJ02 10.1" MIPI-DSI panel RS422 RS485 MAX98090 codec |
imx8mp-b643-ppc.dtb imx8mp-b643-ppc-mipi-dsi-tq101aj02.dtb imx8mp-b643-ppc-uart-rs422.dtb imx8mp-b643-ppc-uart-rs485.dtb imx8mp-b643-ppc-sound-max98090.dtb |
Step 1. Boot up into u-boot prompt (press any key when u-boot is counting down) using debug console
Step 2. Issue commands to change specific dtb file
Example: Load tq101aj02 10.1" mipi-dsi panel
u-boot=> setenv fdtfile imx8mp-b643-ppc-mipi-dsi-tq101aj02.dtb
Example: Load uart as rs422 mode
u-boot=> setenv fdtfile imx8mp-b643-ppc-uart-rs422.dtb
Example: Load uart as rs485 mode
u-boot=> setenv fdtfile imx8mp-b643-ppc-uart-rs485.dtb
Example: Overlay maxim max98090 as default audio codec (Special SKU. only)
u-boot=> setenv fdtfile imx8mp-b643-ppc-sound-max98090.dtb
Example: Restore no any overlay function
u-boot=> setenv fdtfile imx8mp-b643-ppc.dtb
save your overlay configuration for every boot later, if you just want to boot current setting once, you can ignore
this step.
u-boot=> saveenv
boot into Yocto system
u-boot=> boot
If users have application development requirement on Yocto, please issue commands as follows steps
$ bitbake -c populate_sdk imx-image-full
After compiled, the path of SDK toolchain as follows
$ ls tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-imx-image-full-armv8a-wafer-imx8mp-toolchain-5.15-kirkstone.sh
Then setup the enviroment using SDK toolcain (need assign a specific path).
sh ./fsl-imx-xwayland-glibc-x86_64-imx-image-full-armv8a-wafer-imx8mp-toolchain-5.15-kirkstone.sh
source <target environment setup path>/fsl-imx-xwayland-glibc-x86_64-imx-image-full-armv8a-wafer-imx8mp-toolchain-5.15-kirkstone.sh
Checking aarch64 based cross compiler gcc already be exported
$ aarch64-poky-linux-gcc --version
aarch64-poky-linux-gcc (GCC) 11.3.0
You can starting develop your own apps! Note that if you need additional library, you have to add relate packages to machine conf, then re-generate SDK toolchain again.
Add SDL2 library and LVGL demo to machine conf file
$ vim conf/machine/wafer-imx8mp.conf
Add "libsdl2 lvgl-sdl1.0 " to "IMAGE_INSTALL:append" variable and save the file.
After compiling and boot up into system, issue command to run LVGL demo
sh-5.1# lvgl-demo
Step 1. Please following Generate Cross Compiler for WAFER-IMX8MP
chapter, generate SDK toolchain first.
Step 2. Create a new QT6 project (version 6.2 is recommended) using QT Creator
Step 3. source the SDK toolchain, and do the cmake
and make
on the folder of QT6 specific project, to compile applications
Step 4. Copy the compiled application to Yocto rootfs of target WAFER-IMX8MP
Step 5. Excute application, enjoy!
WAFER-IMX8MP with Yocto Kirkstone provide much NPU demo base on python3 + tensorflow-lite framework, we implement some edge demo as follows:
Object detection:
# python3 /home/root/.nxp-demo-experience/scripts/machine_learning/MLDemoLauncher.py detect
Id detection:
# python3 /home/root/.nxp-demo-experience/scripts/machine_learning/MLDemoLauncher.py id
Pose detection:
# python3 /home/root/.nxp-demo-experience/scripts/machine_learning/MLDemoLauncher.py pose
Note that these demos will showing a selection GUI first, please choose the device node of target camera for source, and choose NPU as default backend, then click "Run" button to running the demo.
Adapt gstreamer which supports avi, mp4, mkv and webm format files, please change to root user and issue quick command to play video:
# gplay-1.0 test.mp4 --audio-sink="alsasink device=hw:0"
please check your target sound card using `cat /proc/asound/cards` command
Please plug-in camera module first (doesn't matter using MIPI-CSI or USB), then checking the correct device node of target module
# gst-launch-1.0 v4l2src device=/dev/videoX ! 'video/x-raw,format=YUY2,width=1280,height=720,pixel-aspect-ratio=1/1,framerate=30/1' ! waylandsink
/dev/videoX means target device node, for example: /dev/video3