Nuvoton MA35D1 Yocto Quick Start

  • こんにちは!私はNuvoton MA35D1 Yocto クイックスタートガイドの内容を読み終えました。このガイドでは、YoctoプロジェクトとDockerを使用したカスタムLinuxシステムの構築方法、イメージのプログラミング、高速アプリケーション開発について説明しています。MA35D1に関するご質問があれば、お気軽にお尋ねください。
  • Yoctoプロジェクトとは何ですか?
    Dockerコンテナを使用する利点は何ですか?
    イメージをプログラムする方法は?
    クロスコンパイル環境とは何ですか?
    ネットワークファイルシステムプログラミングとは?
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
| Photo by Jeffery Cheng| Photo by Jeffery Cheng
MA35D1 Yocto Quick Start
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Overview
Docker Environment Setup
Build Image by Yocto
Programming and System Boot
Fast Application Development
2
Agenda
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
This slide provides instructions on how to quickly build an MA35D1 image
PC specification standard
CPU: Intel i5-10400
Memory: 16 GB DDR RAM
Storage: 1 TB SSD Disk (200 GB of which is empty space)
Operation System: Linux OS or Linux Virtual Machine (VMware provide by Nuvoton)
A MA35D1 Docker container
Refer to MA35D1 Quick Start Environment Setup section
If you used VMware provide by Nuvoton, you have already created a MA35D1 Docker container
Software Tool
Programming NuWriter
3
Overview
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
VMware Setting
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
This VMware Image offers a Linux development environment for MA35D1. If you utilize the VMware Image, you
can bypass the Docker steps for building the Image
User Name: user
Password: user
Execute the following command and skip to page 15
5
Start up with VMware
$ cd ~/
shared/yocto/
$ repo
sync
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Docker
Environment Setup
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Docker enables the packaging of code and its dependencies into containers.
Each container is independent and based on the host OS, ensuring they operate in isolation without
impacting each other. Containers run more efficiently than virtual machines, resulting in faster
performance
7
Development Environment Docker
Host OS
Docker Container
Container1
App 1
Basic OS
based on Host
Container2
App 2
Basic OS
based on Host
Container3
App 3
Basic OS
based on Host
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
The necessary packages must be installed before building
Ubuntu and Debian
8
Environment Setup (1/4)
$
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm curl
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
This demo is under Ubuntu distribution. If you use virtual machine, ensure your RAM at least 5GB
Update existing list of packages
Install a few prerequisite packages which let apt use packages over HTTPS
Add Dockers official GPG key for the official Docker repository to your system
Set up the stable repository, add the Docker repository to APT sources
9
Environment Setup (2/4)
$
sudo apt-get update
$
sudo apt install apt-transport-https ca-certificates curl software-properties-common
$ curl
-fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
$
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
6. Update the package database with the Docker packages from the newly added repo
7. Install Docker
8. Download the Docker Script for MA35D1
10
Environment Setup (3/4)
$
sudo apt-get update
$
sudo apt-get install docker-ce docker-ce-cli containerd.io
$
git clone https://github.com/OpenNuvoton/MA35D1_Docker_Script.git
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
9. Enter docker-yocto folder, build docker image.It may take one hour to get about 710 files
10. Enter docker image, and your command line head will be like nuvoton@a24d9e06abe3:~$
11
Environment Setup (4/4)
$
./build.sh
$ ./join.sh
ma35d1_user
nuvoton@a24d9e06abe3:~$
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Build Image by Yocto
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
The Yocto Project is an open source collaboration project that helps developers create custom Linux-
based systems regardless of the hardware architecture
MA35D1 Yocto includes the following Metadata
Meta-ma35d1
Meta-qt5
Meta-virtualization
Meta-Pocky
13
MA35D1 Linux Development Tools Yocto
Bitbake
Linux
Image
Recipes
(.bb)
Classes
(.bbclass)
Configs
(.conf)
Layer (Metadata)
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Create a folder name yocto under /shared
The first time you use repo, you need to set up the GIT environment
Go to /share/yocto to setup repo path
Download the yocto project and update ma35d1 source code
14
Environment Setup
nuvoton@a24d9e06abe3
:~/share/yocto$ repo init -u
https://github.com/OpenNuvoton/MA35D1_Yocto
-v3.1.3.git -m meta-ma35d1/base/ma35d1.xml
nuvoton@a24d9e06abe3
:~/shared/yocto$ git config --global user.email "test@test.test.test"
nuvoton@a24d9e06abe3
:~/shared/yocto$ git config --global user.name "test“
nuvoton@a24d9e06abe3
:~/shared/yocto$ git config --global http.sslverify false
nuvoton@a24d9e06abe3:~/share/
yocto$ repo sync
nuvoton@a24d9e06abe3:~/share$
mkdir yocto
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
1. Setup building configuration. The DISTRO option we usually use nvt-ma35d1-directfb
After typing this command and if you want to change this setting, please modify /build/conf/local.conf
If you exit the docker container and join the docker container again, source the environment variables
Usage:
MACHINE=<machine> DISTRO=<distro> source sources/init-build-env <build-dir>
<machine> machine name <distro> distro name <build-dir> build directory
Choose which DISTRO configuration you want to build
nvt-ma35d1-directfb (sources/meta-nua3500/conf/distro/nvt-ma35d1-directfb.conf)
Choose which machine configuration you want to build
numaker-som-ma35d16a81 (sources/meta-ma35d1/conf/machine/ numaker-som-ma35d16a81)
numaker-iot-ma35d16f70 (sources/meta-ma35d1/conf/machine/ numaker-iot-ma35d16f70)
numaker-iot-ma35d16f90 (sources/meta-ma35d1/conf/machine/ numaker-iot-ma35d16f90)
15
Build Image by Yocto (1/3)
~/
yocto$ DISTRO=nvt-ma35d1-directfb MACHINE=numaker-som-ma35d16a81 source sources/init-build-env
build
~/
yocto$ source sources/init-build-env build/
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Choose what Image you want to build
Here we choose nvt-image-qt5 to build image
This step take about 3hrs first time (download and compile)
After compiling completed, you can see image at
16
Build Image by Yocto (2/3)
Image
name
Target
core
-image-minimal
A
small image that only allows a device to boot.
nvt
-image-qt5
Builds
ma35d1 image
-nua3500
$
bitbake nvt-image-qt5
~/
yocto/build/tmp-glibc/deploy/images/ma35d1-som-ma35d16a81/
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Update Yocto Project
Update Linux
Notice that, the command below will delete all Linux source code and download the newest source
code and compile.
Clean the old Image and build the newer Image
17
Build Image by Yocto (3/3)
nuvoton@a24d9e06abe3:~/share/
yocto/build$ bitbake linux-ma35d1 c cleanall && bitbake linux-
ma35d1
$
bitbake nvt-image-qt5 c cleanall && bitbake nvt-image-qt5
nuvoton@a24d9e06abe3:~/share/
yocto$ repo sync
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Programming and
System Boot
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Nuvoton provide two method to program Image to evaluation board
1. Program image to SD card
2. Program image to any storage in evaluation board with NuWriter
First way is a quick way to evaluate application because of programming time less than second way
The power on setting could be referred to MA35D1 user manual
19
Programming and System Boot
Image
Package
SD
Card
NuWriter
NuDeveloper Ecosystem Make the engineers’ job easier.NuDeveloper Ecosystem Make the engineers’ job easier.
Leave the Docker container or create a new command window
Format your SD card first and search the SD card number
Copy the image to SD card
After copying, insert the SD card to evaluation board, switch power setting to SD Booting, and boot
Login password: root
20
Programming and Boot from SD Card
$
nuvoton@a24d9e06abe3:~$ exit
$
sudo fdisk -l
$
sudo dd if=nvt-image-qt5-numaker-som-ma35d16a81.sdcard of=/dev/sdb
/