1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SlintAdvent Calendar 2024

Day 5

Toradex Verdin AM62 Dual で meta-slint を動かしてみた

Last updated at Posted at 2024-12-04

はじめに

この記事は Slint Advent Calendar 2024 5日目の記事です。

昨日は @hermit4 さんによる Pyside6(QML) vs Slint-Python(Slint) という記事でした。

現時点での最新版での Slint 1.8 で対応がはじまった Python ですが、コードがシンプルでとてもいいですね。
QML との比較も一長一短でとても参考になります。


先月後半に 合同会社シグナルスロット としてはじめて EdgeTech+ 2024 に参加するにあたり、Toradex Japan 株式会社 から展示用のボードをお借りすることができました。今回はそのうちの1つで Qt6 のデモを動かした際の作業を記事にしました。

Qt Advent Calendar 2024 の3日目に書いた Toradex Verdin AM62 Solo で meta-qt6 を動かしてみた の Slint 版です。

image.png

ハードウェア構成

デバイスの準備

Toradex Development Center の Quickstart Guide のデバイスを設定していきます。

image.png

配線

image.png

Verdin AM62 を Mallow にセットする

Unboxing and Setup Cables - Mallow Carrier Board に手順が書いてあります。

ディスプレイを Mallow に接続する

First Steps with Capacitive Touch Display 10.1 Inch DSI に手順が書いてあります。

イメージのフラッシュの手順

Toradex Easy Installer

Download Toradex Easy Installer から Version 6 の Verdin AM62 のものをダウンロードし、展開します。

ホストPCに dfu-util が必要です。

// Gentoo Linux の場合
$ sudo emerge -avt dfu-util

リカバリーモードにする

NXP i.MX and TI AM62x Recovery Mode に手順が書いてあります。

以下のピンをショートさせて、電源を入れます。

image.png

USB-C でホスト PC と接続する

以下のように認識されました。

[2280653.562256] usb 7-2.3: new high-speed USB device number 15 using xhci_hcd
[2280653.654786] usb 7-2.3: New USB device found, idVendor=0451, idProduct=6165, bcdDevice= 2.00
[2280653.654799] usb 7-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[2280653.654804] usb 7-2.3: Product: AM62x DFU
[2280653.654808] usb 7-2.3: Manufacturer: Texas Instruments, Inc.
[2280653.654813] usb 7-2.3: SerialNumber: 01.00.00.00

リカバリー

$ ./recovery-linux.sh
Bus 007 Device 121: ID 0451:6165 Texas Instruments, Inc. AM62x DFU
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
Device ID 0451:6165
Device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Interface #1 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0110
Device returned transfer size 512
Copying data from DFU device to PC
Upload  [=========================] 100%          200 bytes
Upload done.
Received a total of 200 bytes
dfu-util: can't detach
Resetting USB to switch back to Run-Time mode
Bus 007 Device 121: ID 0451:6165 Texas Instruments, Inc. AM62x DFU
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Waiting for device, exit with ctrl-C
Opening DFU capable USB device...
Device ID 0451:6165
Device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0110
Device returned transfer size 512
Copying data from PC to DFU device
Download        [=========================] 100%       321922 bytes
Download done.
DFU state(6) = dfuMANIFEST-SYNC, status(0) = No error condition is present
dfu-util: unable to read DFU status after completion (LIBUSB_ERROR_IO)
Bus 007 Device 122: ID 1b67:4000 Toradex USB download gadget
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Waiting for device, exit with ctrl-C
Opening DFU capable USB device...
Device ID 1b67:4000
Device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0110
Device returned transfer size 4096
Copying data from PC to DFU device
Download        [=========================] 100%      1036059 bytes
Download done.
DFU state(7) = dfuMANIFEST, status(0) = No error condition is present
DFU state(2) = dfuIDLE, status(0) = No error condition is present
Done!
Resetting USB to switch back to Run-Time mode
Bus 007 Device 123: ID 1b67:4000 Toradex USB download gadget
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Waiting for device, exit with ctrl-C
Opening DFU capable USB device...
Device ID 1b67:4000
Device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Interface #1 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 0110
Device returned transfer size 4096
Copying data from PC to DFU device
Download        [=========================] 100%       985963 bytes
Download done.
DFU state(7) = dfuMANIFEST, status(0) = No error condition is present
DFU state(2) = dfuIDLE, status(0) = No error condition is present
Done!
Resetting USB to switch back to Run-Time mode
Downloading Toradex Easy Installer...
uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.5.165-0-g7347a80

Success 1    Failure 0


7:21     8/ 8 [Done                                  ] FB: done

USB デバイスの認識

リカバリー後はNICとして認識されます。

[2280984.055215] usb 7-2.3: new high-speed USB device number 23 using xhci_hcd
[2280984.148231] usb 7-2.3: New USB device found, idVendor=1b67, idProduct=4049, bcdDevice= 0.01
[2280984.148243] usb 7-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[2280984.148248] usb 7-2.3: Product: 0073 Verdin AM62 Dual 1GB ET
[2280984.148253] usb 7-2.3: Manufacturer: Toradex
[2280984.148257] usb 7-2.3: SerialNumber: 15479088
[2280984.226483] cdc_ncm 7-2.3:1.0: MAC-Address: 32:ab:2b:da:f6:d3
[2280984.226829] cdc_ncm 7-2.3:1.0 eth1: register 'cdc_ncm' at usb-0000:22:00.3-2.3, CDC NCM (NO ZLP), 32:ab:2b:da:f6:d3
[2280984.254033] cdc_ncm 7-2.3:1.0 enp34s0f3u2u3: renamed from eth1

VNC 接続をする

今回の SoM はデフォルトでは DSI 接続のディスプレイには対応しておらず、HDMI には非対応のため、ネットワーク経由で GUI を表示する必要があります。

Tezi の詳細ドキュメント などを読むと、RDNIS は 192.168.11.1 が初期状態で割り当てられているようなので、対応する enp34s0f3u2u3192.168.11.2 などに設定し、VNC で実機にアクセスします。

image.png

実機の有線LANを接続すると、インストール可能なイメージの一覧をインターネット経由で取得します。

image.png

イメージを格納した USB メモリを差し込むと、それが表示されるようになります。

image.png

では、次にこのイメージを自分で作成していきましょう。

OS のイメージの作成

なるべく最低限の環境からはじめたいので、Yocto を自分でビルドすることにします。

初期設定

Docker で Ubuntu 24.04 を起動し、初期設定を行います。

$ docker run -it ubuntu:24.04 /bin/bash
root@fee456f40266:/# apt-get update
root@fee456f40266:/# DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential chrpath cpio curl debianutils diffstat file gawk gcc-multilib git-core iproute2 iputils-ping language-pack-en liblz4-tool openssh-server pigz python3 python3-git python3-jinja2 python3-pexpect python3-pip rsync socat sudo texinfo tmux unzip vim wget xz-utils zstd
root@fee456f40266:/# update-locale LANG=en_US.UTF-8

24.04 の docker イメージには既に ubuntu ユーザーが存在するので、以降の作業はそのユーザーで行います。

root@fee456f40266:/# su - ubuntu
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

git のユーザーの設定

ubuntu@fee456f40266:~$ git config --global user.email "[メールアドレス]"
ubuntu@fee456f40266:~$ git config --global user.name "[名前]"

repo の取得

ubuntu@fee456f40266:~$ curl https://storage.googleapis.com/git-repo-downloads/repo > repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 47141  100 47141    0     0   520k      0 --:--:-- --:--:-- --:--:--  523k
ubuntu@fee456f40266:~$ chmod +x repo

Toradex の kirkstone を取得

ubuntu@fee456f40266:~$ ~/repo init -u git://git.toradex.com/toradex-manifest.git -b kirkstone-6.x.y -m tdxref/default.xml
Downloading Repo source from https://gerrit.googlesource.com/git-repo
repo: Updating release signing keys to keyset ver 2.3

Your identity is: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
If you want to change this, please re-run 'repo init' with --config-name

Testing colorized output (for 'repo diff', 'repo status'):
  black    red      green    yellow   blue     magenta   cyan     white
  bold     dim      ul       reverse
Enable color display in this user account (y/N)? y

repo has been initialized in /home/ubuntu
ubuntu@fee456f40266:~$ ~/repo sync
Fetching: 100% (16/16), done in 3m20.524s
Checking out:  93% (15/16), done in 0.398s
Checking out:   6% (1/16), done in 0.062s
repo sync has finished successfully.
ubuntu@fee456f40266:~$ ls layers/
meta-arm        meta-freescale-3rdparty  meta-openembedded  meta-security  meta-toradex-bsp-common  meta-toradex-distro  meta-toradex-ti  openembedded-core
meta-freescale  meta-freescale-distro    meta-qt5           meta-ti        meta-toradex-demos       meta-toradex-nxp     meta-yocto

meta-slint を追加

Slint 公式の meta-slint を追加しましょう。
なお、この meta-slint は C++ から slint を扱うためのレイヤーで、Rust を利用する場合は meta-rust を利用するのがよいようです。
今回は meta-slint に含まれる slint のデモを動かしてみます。

meta-slint は meta-rust-bin に依存しているので、こちらも追加します。
また、デモが meta-clang に依存しているので、こちらも追加します。

ubuntu@fee456f40266:~/layers$ git clone https://github.com/rust-embedded/meta-rust-bin.git layers/meta-rust-bin
Cloning into 'meta-rust-bin'...
remote: Enumerating objects: 1223, done.
remote: Counting objects: 100% (590/590), done.
remote: Compressing objects: 100% (171/171), done.
remote: Total 1223 (delta 448), reused 461 (delta 403), pack-reused 633 (from 1)
Receiving objects: 100% (1223/1223), 396.04 KiB | 6.29 MiB/s, done.
Resolving deltas: 100% (631/631), done.
ubuntu@fee456f40266:~/layers$ git clone https://github.com/slint-ui/meta-slint.git layers/meta-slint
Cloning into 'meta-slint'...
remote: Enumerating objects: 906, done.
remote: Counting objects: 100% (234/234), done.
remote: Compressing objects: 100% (118/118), done.
remote: Total 906 (delta 93), reused 209 (delta 80), pack-reused 672 (from 1)
Receiving objects: 100% (906/906), 113.33 KiB | 4.53 MiB/s, done.
Resolving deltas: 100% (424/424), done.
ubuntu@fee456f40266:~/layers$ git clone https://github.com/kraj/meta-clang.git --branch kirkstone
Cloning into 'meta-clang'...
remote: Enumerating objects: 11763, done.
remote: Counting objects: 100% (544/544), done.
remote: Compressing objects: 100% (325/325), done.
remote: Total 11763 (delta 314), reused 349 (delta 204), pack-reused 11219 (from 1)
Receiving objects: 100% (11763/11763), 2.45 MiB | 6.88 MiB/s, done.
Resolving deltas: 100% (7158/7158), done.

am62 ディレクトリ以下にビルドの設定をする

ubuntu@fee456f40266:~$ . layers/openembedded-core/oe-init-build-env am62
You had no conf/local.conf file. This configuration file has therefore been
created for you from /home/ubuntu/layers/openembedded-core/meta/conf/local.conf.sample
You may wish to edit it to, for example, select a different MACHINE (target
hardware). See conf/local.conf for more information as common configuration
options are commented.

You had no conf/bblayers.conf file. This configuration file has therefore been
created for you from /home/ubuntu/layers/openembedded-core/meta/conf/bblayers.conf.sample
To add additional metadata layers into your configuration please add entries
to conf/bblayers.conf.

The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
    https://docs.yoctoproject.org

For more information about OpenEmbedded see the website:
    https://www.openembedded.org/


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-full-cmdline
    core-image-sato
    core-image-weston
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86-64'.

Other commonly useful commands are:
 - 'devtool' and 'recipetool' handle common recipe tasks
 - 'bitbake-layers' handles common layer tasks
 - 'oe-pkgdata-util' handles common target package tasks

レイヤーの追加

ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-arm/meta-arm-toolchain/
NOTE: Starting bitbake server...
ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-arm/meta-arm/
NOTE: Starting bitbake server...
ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-ti/meta-ti-bsp/
NOTE: Starting bitbake server...
ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-toradex-bsp-common/
NOTE: Starting bitbake server...
ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-toradex-ti/
NOTE: Starting bitbake server...
ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-openembedded/meta-oe/
NOTE: Starting bitbake server...
ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-rust-bin/
NOTE: Starting bitbake server...
ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-slint/
NOTE: Starting bitbake server...
ubuntu@fee456f40266:~/am62$ bitbake-layers add-layer ../layers/meta-clang/
NOTE: Starting bitbake server...

ビルドの設定

ubuntu@fee456f40266:~/am62$ vi conf/local.conf

ビルド対象の設定をします。

MACHINE = "verdin-am62"

DSI のディスプレイを使えるようにデバイスツリーの設定をします。
Device Tree Overlays on Toradex System on Modules を参考にしました。

TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT:remove = " verdin-am62_dsi-to-hdmi_overlay.dtbo"
TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT:append = " verdin-am62_panel-cap-touch-10inch-dsi_overlay.dtbo"

それから、meta-slint の README に従って、以下の設定をします。

PREFERRED_VERSION_slint-cpp = "1.8.0"
PREFERRED_VERSION_slint-cpp-native = "1.8.0"

PACKAGECONFIG:append:pn-slint-cpp = " backend-linuxkms renderer-skia "
PACKAGECONFIG:remove:pn-slint-cpp = " renderer-femtovg "

# TOOLCHAIN_HOST_TASK:append = " nativesdk-slint-cpp"

linuxkms で動作させるには egl が必要なので、以下の設定を追加します。

DISTRO_FEATURES:append = " opengl"

slint のデモを追加します。

IMAGE_INSTALL:append = " slint-demos"

ssh で入れるようにします。

IMAGE_FEATURES:append = " ssh-server-openssh"
IMAGE_INSTALL:append = " openssh openssh-sftp-server"
IMAGE_INSTALL:append = " source-han-sans-jp-fonts"

ビルド

ubuntu@fee456f40266:~/am62$ bitbake core-image-base
Loading cache: 100% |########################################################################################################################################| Time: 0:00:00
Loaded 167 entries from dependency cache.
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.64.0.bb: Unsupported OS: eabi. Only Linux is supported.                      | ETA:  0:00:16
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.57.0.bb: Unsupported OS: eabi. Only Linux is supported.
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.66.1.bb: Unsupported OS: eabi. Only Linux is supported.
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.82.0.bb: Unsupported OS: eabi. Only Linux is supported.
ERROR: /home/ubuntu/layers/meta-slint/recipes-slint/slint/slint-cpp_1.3.0.bb: Unsupported OS: eabi. Only Linux is supported.                                 | ETA:  0:00:14
WARNING: /home/ubuntu/layers/meta-slint/recipes-slint/slint/slint-cpp_1.3.0.bb: Exception during build_dependencies for cmake_do_configure
WARNING: /home/ubuntu/layers/meta-slint/recipes-slint/slint/slint-cpp_1.3.0.bb: Error during finalise of mc:k3r5:/home/ubuntu/layers/meta-slint/recipes-slint/slint/slint-cpp_1.3.0.bb
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.59.0.bb: Unsupported OS: eabi. Only Linux is supported.                      | ETA:  0:00:15
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.67.1.bb: Unsupported OS: eabi. Only Linux is supported.
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.83.0.bb: Unsupported OS: eabi. Only Linux is supported.
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.77.0.bb: Unsupported OS: eabi. Only Linux is supported.
ERROR: Parsing halted due to errors, see error messages above                                                                                                | ETA:  0:00:16
ERROR: /home/ubuntu/layers/meta-rust-bin/recipes-devtools/rust/rust-bin-cross_1.75.0.bb: Unsupported OS: eabi. Only Linux is supported.

Summary: There were 2 WARNING messages.
Summary: There were 11 ERROR messages, returning a non-zero exit code.

というエラーが出ます。設定が悪いのか、コードが悪いのかは不明ですが、とりあえず os が 'linux' でないということはないので、os は 'linux' であることにして回避しました。

ubuntu@fee456f40266:~/am62$ vi ../layers/meta-rust-bin/classes/rust_bin-common.bbclass
    if not os == 'linux':
        os = 'linux'
        # bb.fatal("Unsupported OS: %s. Only Linux is supported." % os)

再度 bitbake をすることで、すべてが正常にビルドできました。

インストールイメージのコピー

ubuntu@fee456f40266:~/am62$ scp deploy-ti/images/verdin-am62/core-image-base-verdin-am62-20241204075709-Tezi.tar tasuku@172.17.0.1:/home/tasuku/Downloads/
(tasuku@172.17.0.1) Password:
core-image-base-verdin-am62-20241204075709-Tezi.tar                                                                                       100%   77MB 630.2MB/s   00:00

USB メモリ上に展開し、ボードに差します

$ tar xf ~/Downloads/core-image-base-verdin-am62-20241204075709-Tezi.tar -C /run/media/tasuku/usbmemory/ && sudo umount /run/media/tasuku/usbmemory/

image.png

一番上のエントリーが自分でビルドした Yocto のイメージなので、それをダブルクリックします。

image.png

「Yes」をクリックします。

image.png

インストールが終わると以下の画面に遷移します。

image.png

「Reboot」をクリックします。

デモアプリの実行

実機に ssh で入ります。

$ ssh root@verdin-am62.local
root@verdin-am62:~# printerdemo

image.png

root@verdin-am62:~# slide_puzzle

image.png

root@verdin-am62:~# gallery

image.png

root@verdin-am62:~# energy-monitor

image.png

おわりに

今回は Toradex Japan さんにお借りした AM62 のボードで meta-slint をビルドし、Slint のデモアプリを実行してみました。

実際に自分で書いたのアプリを動かす場合はどうするのか気になりますね。

明日は @hermit4 さんによる Slint言語入門(1) です。お楽しみに!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?