Nuvoton EN MA35D1 Buildroot User manual

Type
User manual

Nuvoton EN MA35D1 Buildroot is a versatile development tool that empowers users to effortlessly build tailored images for their MA35D1 series boards. With its comprehensive feature set, this toolchain streamlines the creation of customized embedded systems, unlocking a vast array of possibilities:

  • Leverage Linux, U-Boot, arm-trusted-firmware, OP-TEE OS, and other essential components to craft a robust foundation for your embedded projects.
  • Harness the power of NuWriter, Eclipse, and Python to streamline development and debugging processes, accelerating your time-to-market.
  • Tap into the extensive capabilities of the MA35D1 series, including multimedia, connectivity, and security features, to bring your innovative ideas to life.

Nuvoton EN MA35D1 Buildroot is a versatile development tool that empowers users to effortlessly build tailored images for their MA35D1 series boards. With its comprehensive feature set, this toolchain streamlines the creation of customized embedded systems, unlocking a vast array of possibilities:

  • Leverage Linux, U-Boot, arm-trusted-firmware, OP-TEE OS, and other essential components to craft a robust foundation for your embedded projects.
  • Harness the power of NuWriter, Eclipse, and Python to streamline development and debugging processes, accelerating your time-to-market.
  • Tap into the extensive capabilities of the MA35D1 series, including multimedia, connectivity, and security features, to bring your innovative ideas to life.
MA35D1
Nov. 13, 2022 Page 1 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
NuMicro® Family
Arm® Cortex®-A35-based Microprocessor
NuMicro® Family
MA35D1 Buildroot Project
User Manual
The information described in this document is the exclusive intellectual property of
Nuvoton Technology Corporation and shall not be reproduced without permission from Nuvoton.
Nuvoton is providing this document only for reference purposes of NuMicro®
microcontroller and
microprocessor based system design. Nuvoton assumes no responsibility for errors or omissions.
All data and specifications are subject to change without notice.
For additional information or questions, please contact: Nuvoton Technology Corporation.
www.nuvoton.com
MA35D1
Nov. 13, 2022 Page 2 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
Table of Contents
1 OVERVIEW ...................................................................................................... 3
1.1 Feature List ..................................................................................................................... 3
2 DEVELOPMENT ENVIRONMENT SETUP ...................................................... 4
2.1 Docker ............................................................................................................................. 4
2.2 Linux ................................................................................................................................ 5
3 BUILD IMAGE .................................................................................................. 7
3.1 Build Configurations ...................................................................................................... 7
3.2 Build Image ..................................................................................................................... 7
3.3 Deploy Image ................................................................................................................. 8
4 BUILDROOT PROJECT CUSTOMIZATION.................................................. 10
4.1 Toolchain ....................................................................................................................... 10
4.2 U-Boot ........................................................................................................................... 10
4.3 Linux Kernel ................................................................................................................. 10
4.4 Trusted firmware-A (TF-A) ......................................................................................... 10
4.4.1 Secure boot ..................................................................................................................... 10
4.4.2 Run RTP-M4 form TF-A ................................................................................................ 11
4.5 Others ............................................................................................................................ 12
5 REVISION HISTORY ..................................................................................... 13
MA35D1
Nov. 13, 2022 Page 3 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
1 OVERVIEW
Buildroot project is a specific development tool for MA35D1 series. Users can use the Buildroot project
to build an image for MA35D1 series board by using Buildroot project building environment. The
Buildroot is a tool that simplifies and automates the process of building a complete Linux system for an
embedded system, using cross-compilation. The Buildroot official website https://buildroot.org/ has
some documents with Buildroot basic concepts.
1.1 Feature List
The MA35D1 Buildroot has the following functions:
Linux
uboot
arm-trusted-firmware
optee-os
RTP-BSP
nu-eclipse
python3-nuwriter
MA35D1
Nov. 13, 2022 Page 4 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
2 DEVELOPMENT ENVIRONMENT SETUP
The following is required to develop projects in the Buildroot Project environment. A host system with a
minimum of 20 Gbytes of free disk space that is running a supported Linux distribution (i.e. recent
releases of Fedora, CentOS, Debian, or Ubuntu), and appropriate packages installed on the system you
are using for building.
Nuvoton provides two environments for building images, Docker and Linux. Docker is a virtual machine
based on host Linux OS, so the setting in the Docker will not affect the host OS and the Docker can
create an environment only for building images. Linux distribution will be updated and may result in
building image error, so Docker provided by Nuvoton is a better way than Linux.
2.1 Docker
Docker is an open-source project based on Linux contains, which is similar to virtual machines, but
containers are more portable, more resource-friendly, and more dependent on the host operating
system. Docker provides a quick and easy way to get up and running with buildroot. Install docker,
Example for Ubuntu 20.04:
First, update your existing list of packages:
$ sudo apt-get update
Next, install a few prerequisite packages which let apt use packages over HTTPS:
$sudo apt install apt-transport-https ca-certificates curl software-properties-
common
Then add Docker’s official GPG key for the official Docker repository to your system:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Use the following command to set up the stable repository, add the Docker repository to APT sources:
$sudo add-apt-repository "deb [arch=amd64]
https://download.docker.com/linux/ubuntu focal stable"
Next, update the package database with the Docker packages from the newly added repo:
$ sudo apt-get update
Finally, install Docker:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Then use the Dockerfile to generate the Docker image environment. after completion, use the repo utility
to download the Buildroot project after enter the Docker image.
Dockefile source at (https://github.com/OpenNuvoton/MA35D1_Docker_Script.git)
You can use the Docker script provided.
build.sh Dockerfile join.sh README.md
Set up docker image.
$./build.sh
Docker share folder will mount /home/$USER/shared
Enter docker image, you will see [user name]&[container id]:$”
$./join.sh
ma35d1_test
test@575f27a6d251:~$
MA35D1
Nov. 13, 2022 Page 5 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
Create a shared/buildroot folder and enter
test@575f27a6d251:~$ mkdir shared/buildroot
test@575f27a6d251:~$ cd shared/buildroot
The first time you use repo, you need to set up the GIT environment.
test@575f27a6d251:~$ git config --global user.email "test@test.test.test"
test@575f27a6d251:~$ git config --global user.name "test"
Use git to download Buildroot project
test@575f27a6d251:~$ git clone https://github.com/OpenNuvoton/MA35D1_Buildroot.git
You can check Docker documentation:
https://docker-curriculum.com/
https://docs.docker.com/get-started/
https://github.com/OpenNuvoton/MA35D1_Docker_Script
2.2 Linux
The necessary packages must be installed before using Buildroot project. In Linux system, use the
command below to install essential Buildroot Project host packages.
Mandatory packages
which
sed
make (version 3.81 or any later)
binutils build-essential (only for Debian based systems)
gcc (version 4.8 or any later)
g++ (version 4.8 or any later)
bash
patch
gzip
bzip2
perl (version 5.8.7 or any later)
tar
cpio
unzip
rsync
file (must be in /usr/bin/file)
bc
Optional packages
python (version 2.7 or any later)
ncurses5
MA35D1
Nov. 13, 2022 Page 6 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
qt5
MA35D1
Nov. 13, 2022 Page 7 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
3 BUILD IMAGE
This section provides the detailed information along with the process for building an image.
3.1 Build Configurations
Please visit the OpenNuvoton website(https://github.com/OpenNuvoton) to download the Buildroot
project(https://github.com/OpenNuvoton/MA35D1_Buildroot). The Buildroot project provided default
configuration for ma35d1 series. Before modifying any Buildroot configuration , it is recommended to
load the default configure of Buildroot first. User can type “make
numaker_som_ma35d16a81_defconfig” command. Sometimes if system cannot boot up, user can load
the default configuration to recovery Buildroot to safe status. The following are MA35D1 configuration
files that can be selected. In default configure, if the string with security” in the name, it contains optee-
os,
numaker_iot_ma35d16f70_defconfig
numaker_iot_ma35d16f90_defconfig
numaker_som_ma35d16a81_defconfig
The command is shown below:
$ make numaker_som_ma35d16a81_defconfig (make <DEFCONFIG>)
DEFCONFIG=<default configuration name> is the configuration name which points to the configuration
file in buildroot/configs/.
Sometimes fine-tune Buildroot configuration, for example to enable some features that are not enabled
by default. The Buildroot provides an interface to enter configuration menu by typing make menuconfig”
command.
$ make menuconfig
This is a multi-layer menu in configuration system. In the current page, user can press arrow keys to
control the layer of configuration system. Select kernel function by pressing up” or “down” key and
select menu function in the bottom of page by pressing “left” or “right” key. To enter the next layer of
configuration page, user can press “enter” key.
There are five functions at the bottom of menu page. User can disable or enable kernel function by
pressing space key when cursor stays at “Select”. The symbol in front of the selection function “[ ]”
stands for this function is disabled, “[*]” stands for this function is enabled and can be loaded
dynamically.
Menu page can be returned to upper layer by pressing space key when cursor stays at “Exit” at the
bottom of menu page. If it’s at the top layer of configuration system, system will inform user if wants to
save the configuration and exit.
The help screen will show when cursor is at “Help” by pressing space key. To save current configuration
or load old configuration, use can press space key when cursor is at “Save” or “Load” at the bottom of
menu page.
The buildroot configuration file will be named “.config” and be saved in the buildroot source tree
directory.
3.2 Build Image
Use the “make” command to build an image. The following command is an example of how to build an
image:
$ make
Update the MA35D1 source code by delete the following files in the dl folder.
$ cd dl
MA35D1
Nov. 13, 2022 Page 8 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
$ rm rf arm-trusted-firmware uboot linux optee-os
You need to change through “make menuconfig” to get the corresponding pack image.
SD card image provides the full system to boot with TFA, U-Boot, Linux Kernel and file
system; do the following:
$ make menuconfig
(Modify 'Bootloaders ---> Board defconfig' to 'ma35d1_sdcard0' or 'ma35d1_sdcard1'
and Save)
$ make arm-trusted-firmware-dirclean uboot-dirclean linux-dirclean optee-os-
dirclean
$ make
(Wait while it compiles and
find pack-core-image-buildroot-ma35d1-som-256m-sdcard.bin and
core-image-buildroot-ma35d1-som-256m.rootfs.sdcard in output/images)
SPINAND image provides the full system to boot with TFA, U-Boot, Linux Kernel and file
system; do the following:
$ make menuconfig
(Modify 'Bootloaders ---> Board defconfig' to 'ma35d1_spinand' and Save)
$ make arm-trusted-firmware-dirclean uboot-dirclean linux-dirclean optee-os-
dirclean
$ make
(Wait while it compiles and
find pack-core-image-buildroot-ma35d1-som-256m-spinand.bin in output/images)
NAND image provides the full system to boot with TFA, U-Boot, Linux Kernel and file system;
do the following:
$ make menuconfig
(Modify 'Bootloaders ---> Board defconfig' to 'ma35d1_nand' and Save)
$ make arm-trusted-firmware-dirclean uboot-dirclean linux-dirclean optee-os-
dirclean
$ make
(Wait while it compiles and
find pack-core-image-buildroot-ma35d1-som-256m-nand.bin in output/images)
Note: pack-core-image-buildroot-#####.bin can be used by the MA35D1 Nu-Writer tool.
3.3 Deploy Image
After building image, you can find image in <build directory>/output/images. Each image can create a
u-boot, trusted firmware-A, OPTEE-OS, Linux kernel, file system, Nu-Writer tool, m4 project demo code
and pack image. A pack image will be provided that includes TF-A, u-boot, Linux kernel, and file system
for SPINAND, NAND or SDCARD storages. Use the command to write the pack image into MA35D1
demo board after computer is connected to the MA35D1 demo board. You can use “lsusb” command to
check whether the connection board is working. Using nuwriter or dd command does not work
properly in Docker environment.
$ sudo lsusb
MA35D1
Nov. 13, 2022 Page 9 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
/buildroot/output/images$ ls
pack-core-image-buildroot-ma35d1-som-256m-nand.bin
pack-core-image-buildroot-ma35d1-som-256m-spinand.bin
pack-core-image-buildroot-ma35d1-som-256m-sdcard.bin
Burn pack-core-image-buildroot-ma35d1-som-256m-sdcard.bin image to SD
/buildroot/output/images$ nuwriter.py w sd pack-core-image-buildroot-ma35d1-som-
256m-sdcard.bin
Burn pack-core-image-buildroot-ma35d1-som-256m-nand.bin image to NAND flash
/buildroot/output/images$ nuwriter.py e nand all /* Erase NAND flash */
/buildroot/output/images$ nuwriter.py w nand pack-core-image-buildroot-ma35d1-
som-256m-nand.bin
Burn pack-core-image-buildroot-ma35d1-som-256m-spinand.bin image to SPINAND.
/buildroot/output/images$ nuwriter.py e spinand all /* Erase SPINAND flash */
/buildroot/output/images$ nuwriter.py w spinand pack-core-image-buildroot-ma35d1-
som-256m-spinand.bin
An SD card image provides the full system to boot with TFA, u-Boot, Kernel and file system, run the
following command to write SD card image. Change sdx below to match the one used by the SD
card.
/buildroot/output/images$ ls
core-image-buildroot-ma35d1-som-256m.rootfs.sdcard
$ sudo dd if=core-image-buildroot-ma35d1-som-256m.rootfs.sdcard of=/dev/sdx
conv=fsync
MA35D1
Nov. 13, 2022 Page 10 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
4 BUILDROOT PROJECT CUSTOMIZATION
4.1 Toolchain
Add toolchain to environment variables:
/buildroot$ source output/host/environment-setup
Create the source code file for this example: helloworld.c:
#include <stdio.h>
int main() {
// printf() displays the string inside console
printf(“Hello, World!\n”);
return 0;
}
And compile it.
$ $CC helloworld.c -o helloworld
$ ls
Helloword.c helloworld
4.2 U-Boot
If you just want to configure u-boot, you can use make command to configure u-boot.
Configure u-boot:
$ make uboot-menuconfig
(Modify and Save)
$ make uboot-rebuild
4.3 Linux Kernel
If you just want to configure Linux, you can use make command to configure Linux.
Configure Linux:
$ make linux-menuconfig
(Modify and Save)
$ make linux-rebuild
4.4 Trusted firmware-A (TF-A)
4.4.1 Secure boot
This section introduces how to enable secure boot. If the developer already has private key, please
write the key into config file through “make menuconfig” command.
Bootloaders --->
[*] MA35D1 Secure Boot
(0A0BC81E5AFBF836C5E0CFBEA12C1E269A2EBC3B0B6EC39EEE1C7142F760EBC4) AES Key
(8F1571E9975006A545DF854264F7B18934B5CB2EE619E66DBC0FBEA52C71C919) ECDSA Key
AES_KEY and ECDSA_KEY can be changed according to actual environment. Also, rebuild image.
MA35D1
Nov. 13, 2022 Page 11 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
$ make
After building image, you can find image in <buildroot directory>/output/images, and opt_key.json in
<build directory>/tmp-glibc/deploy/images/<machine>/nuwriter. The opt_key.join needs to be
programmed to the key store of MA35D1 through Nu-Writer tools. For more details, please refer to
MA35D1 Secure Boot Application Note.
Program Key and Image
Send the following command to program the key in deployed directory. For more details, please refer to
NuMicro® Family MA35D1 NuWriter User Manual.
$ nuwriter.py -w otp nuwriter/key.json
opt_key.json will automatically generate publicx key, publicy keys and aes key according to AES_KEY
and ECDSA_KEY.
{
"publicx": "72F84F681092E3A05C1437E3E40534962A5C70556025D348FF9DB97D6AF83EB5",
"publicy": "8D32DAC7AB6F90332E8E0060E159E0B31502BB4FB2D78369F02D1F5B0C335AD3",
"aeskey" : "0A0BC81E5AFBF836C5E0CFBEA12C1E269A2EBC3B0B6EC39EEE1C7142F760EBC4"
}
Program otp_key.json and core-image-minimal-numaker-som-ma35d16a81-enc-nand.pack image to
NAND Flash. In /buildroot/output/images folder.
$ nuwriter.py a enc_ddr3_winbond_256mb.bin
$ nuwriter.py -w otp nuwriter/otp_key.json
$ nuwriter.py e nand all /* Erase NAND flash */
$ nuwriter.py w nand pack-core-image-buildroot-ma35d1-som-256m-enc-nand.bin
Program otp_key.json and pack-core-image-buildroot-ma35d1-som-256m-enc-sdcard.bin image to SD.
In /buildroot/output/images folder.
$ nuwriter.py a enc_ddr3_winbond_256mb.bin
$ nuwriter.py -w otp nuwriter/otp_key.json
$ nuwriter.py w sd pack-core-image-buildroot-ma35d1-som-256m-enc-sdcard.bin
Program otp_key.json and core-image-minimal-numaker-som-ma35d16a81-enc-spinand.pack image to
SPINAND. In /buildroot/output/images folder.
$ nuwriter/nuwriter a enc_ddr3_winbond_256mb.bin
$ nuwriter/nuwriter -w otp nuwriter/otp_key.json
$ nuwriter/nuwriter e spinand all /* Erase SPINAND flash */
$ nuwriter/nuwriter w spinand pack-core-image-buildroot-ma35d1-som-256m-enc-
spinand.bin
4.4.2 Run RTP-M4 form TF-A
This section introduces how to run RTP-M4 from arm-trusted-firmware, enable Add RTP M4 into FIP
image” and select binary file in “make menuconfig” command.
/yocto/sources/meta-ma35d1/conf/machine/numaker-som-ma35d16a81.conf:
Bootloaders --->
[*] Add RTP M4 into FIP image
MA35D1
Nov. 13, 2022 Page 12 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
(RTP-BSP/Template.bin) RTP M4 binary file names
Also rebuild image.
$ make
Load the image and run, you will see “hello world” from UART16. This massage is printed by RTP-M4.
4.5 Others
If you modify the source code and rebuild the source code, you can find the source code in
buildroot/output/build. The arm-trusted-firmware-custom modification example is as follows:
(Modify buildroot/output/build/arm-trusted-firmware-custom/FILES and Save)
$ make arm-trusted-firmware-rebuild
MA35D1
Nov. 13, 2022 Page 13 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
5 REVISION HISTORY
Date
Revision
Description
2022.01.19
1.00
Initial version.
2022.05.30
1.01
Renamed project name for mass production version
2022.11.13
1.02
Fixed grammar and spelling errors
Fixed some hyper link errors
MA35D1
Nov. 13, 2022 Page 14 of 14 Rev 1.02
MA35D1 NUWRITER USER MANUAL
Important Notice
Nuvoton Products are neither intended nor warranted for usage in systems or equipment, any
malfunction or failure of which may cause loss of human life, bodily injury or severe property
damage. Such applications are deemed, “Insecure Usage”.
Insecure usage includes, but is not limited to: equipment for surgical implementation, atomic
energy control instruments, airplane or spaceship instruments, the control or operation of
dynamic, brake or safety systems designed for vehicular use, traffic signal instruments, all types
of safety devices, and other applications intended to support or sustain life.
All Insecure Usage shall be made at customer’s risk, and in the event that third parties lay claims
to Nuvoton as a result of customer’s Insecure Usage, customer shall indemnify the damages
and liabilities thus incurred by Nuvoton.
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14

Nuvoton EN MA35D1 Buildroot User manual

Type
User manual

Nuvoton EN MA35D1 Buildroot is a versatile development tool that empowers users to effortlessly build tailored images for their MA35D1 series boards. With its comprehensive feature set, this toolchain streamlines the creation of customized embedded systems, unlocking a vast array of possibilities:

  • Leverage Linux, U-Boot, arm-trusted-firmware, OP-TEE OS, and other essential components to craft a robust foundation for your embedded projects.
  • Harness the power of NuWriter, Eclipse, and Python to streamline development and debugging processes, accelerating your time-to-market.
  • Tap into the extensive capabilities of the MA35D1 series, including multimedia, connectivity, and security features, to bring your innovative ideas to life.

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI