当前位置:网站首页>Xintang nuc980 usage record: basic description of development environment preparation and compilation configuration

Xintang nuc980 usage record: basic description of development environment preparation and compilation configuration

2022-06-22 19:35:00 Naisu Xu

Purpose

The corresponding development environment should be prepared before the microprocessor is developed and used , It mainly involves source code acquisition 、 Cross compile toolchain configuration 、 Preparation of burning tools, etc . This article will be based on the new Tang Dynasty NUC980 Make a description of the relevant contents of .

Development environment preparation

Debug the burning environment

If you want to burn to Flash It is recommended to use the official burning tools of the new Tang Dynasty in Windows In the middle of , need Install related drivers , as well as Download burning tool .

On the official website of Xintang NUC980 Page resources > Software Find the development package software development package in and download it :
https://www.nuvoton.com.cn/products/microprocessors/arm9-mpus/nuc980-industrial-control-iot-series/
 Insert picture description here Download it NUC980_Linux-4.4_BSP_v1.03.000.zip Compressed package , The extracted folder contains BSP、Documents、Tools.
Documents It contains detailed Chinese and English documents of relevant contents , These documents are very helpful for getting started .
Tools in WinUSB4NuVCOM.exe It's from Xintang equipment USB-ISP drive ,NuWriter It's a burning tool .

After the drive is installed , If the development board PG[1:0] = 00 ,USB0 and UART0 All connected to the computer , After pressing the reset button to reset the development board, you can see the information and devices in the serial port terminal and the device manager respectively :
 Insert picture description here

If you use the official development board of Xintang, you need to download USB-CDC Serial driver NuvotonCDC_V1.00.001_Setup :
https://www.nuvoton.com/resource-download.jsp?tp_GUID=SW1020160914071736

Development and compilation environment

Download and install Ubuntu Desktop( The version used here is 20.04.4):
https://ubuntu.com/download/desktop

After installation, install and set the basic environment :

sudo apt update
sudo apt install -y build-essential

sudo apt install -y git-all
# git You may need to set the user name and mailbox 
# git config --global user.name "naisu"
# git config --global user.email [email protected]

sudo apt install -y libc6:i386
sudo apt install -y lib32stdc++6
sudo apt install -y lib32z1

sudo apt install -y libusb-1.0-0-dev
sudo apt install -y libncurses5-dev
sudo apt install -y u-boot-tools

The following are installed as required :

#  install SSH service 
sudo apt install -y openssh-server

#  Install editor  VS Code
sudo snap install code --classic
# VS Code Can be installed in Embedded Linux Kernel Dev Expand , Easy to develop 

If you use a virtual machine, you can open the shared pasteboard for convenience 、 Share directories and bridge networks .

Compile toolchain

The compilation tool chain is also on the top BSP In bag , I'm here through Ubuntu Download from your own browser , Got NUC980_Linux-4.4_BSP_v1.03.000.zip The file is located in ~/Downloads/ Under the table of contents .

#  Create and enter the working directory 
mkdir ~/nuc980-sdk
cd ~/nuc980-sdk/ 

#  decompression BSP package 
mv ~/Downloads/NUC980_Linux-4.4_BSP_v1.03.000.zip ./
unzip NUC980_Linux-4.4_BSP_v1.03.000.zip

tar xzvf NUC980_Linux-4.4_BSP_v1.03.000/BSP/nuc980bsp.tar.gz 
#  Decompression is obtained. nuc980bsp The folder contains  arm_linux_4.8.tar.gz image.tar.gz install.sh rootfs.tar.gz
#  Namely   Compile toolchain   Precompiled system files   set up script   Pre prepared root file system 

have access to install.sh Script to install , It will install the compilation tool chain to /usr/local Under the table of contents , Set the environment variable , Then unzip the rest image.tar.gz and rootfs.tar.gz To the specified working directory nuc980bsp Directory :( I personally don't like this way. Just look at it )

cd ~/nuc980-sdk/ 
cd nuc980bsp/
sudo ./install.sh 
#  Enter the working directory as prompted during installation , For example, here I am /home/nx/nuc980-sdk
#  After installation, restart the system to make the environment variables take effect 

The official tool installs the compilation tool chain to a non working directory , I personally don't like the operation of logging in and setting environment variables , So I usually use the following methods :( If you use the official way to install the following content, you can do without viewing )

cd ~/nuc980-sdk/ 
tar xzf nuc980bsp/arm_linux_4.8.tar.gz
tar zxf nuc980bsp/image.tar.gz
sudo tar zxf nuc980bsp/rootfs.tar.gz

#  In this way, you can use the following command to temporarily set the compilation tool chain path to the environment variable 
#  Pay attention to using your own path , Each time the terminal is opened, it needs to be reset :
export PATH=$PATH:/home/nx/nuc980-sdk/arm_linux_4.8/bin

#  Delete useless things 
# rm -rf nuc980bsp/
# rm -rf NUC980_Linux-4.4_BSP_v1.03.000/
# rm -rf NUC980_Linux-4.4_BSP_v1.03.000.zip
#  The current working directory contains  arm_linux_4.8 image rootfs  Several folders 

What needs special attention is that I have Ubuntu yes 64 Bit , The compilation tool chain is 32 Bit , Related to the preparation of the previous development and compilation environment 32 The bit library must be completely installed , Otherwise, the tool chain may not work properly .

uboot and linux

uboot and linux The project needs to be downloaded from the Internet , The download address can be found in BSP You can get it by decompressing it Documents In folder 《NUC980 Linux 4.4 BSP User Manual》 Found in document . The official provided github、gitee and gitlab Three kinds of links , Select the appropriate to download :

cd ~/nuc980-sdk/ 

git clone --depth=1 https://github.com/OpenNuvoton/NUC970_U-Boot_v2016.11.git
#  Got NUC970_U-Boot_v2016.11 The folder is uboot Project , This is NUC970 and NUC980 Shared 
#  The current version consists of ychuang3 stay 2022-01-17 10:38:53 +0800 Finally submit ,hash by ca47203

git clone --depth=1 https://github.com/OpenNuvoton/NUC980-linux-4.4.y.git
#  Got NUC980-linux-4.4.y The folder is linux Project 
#  The current version consists of mjchen stay 2022-03-21 14:09:54 +0800 Finally submit ,hash by b488a698

buildroot

buildroot It's an embedded Linux Building tools , It is used here to build the root file system , Usually choose to download the latest long-term support version :

cd ~/nuc980-sdk/ 

#  Download and unzip 
wget https://buildroot.org/downloads/buildroot-2022.02.3.tar.xz
tar -xJf buildroot-2022.02.3.tar.xz
# rm buildroot-2022.02.3.tar.xz

Application examples

Xintang officially provides application examples , Just like the above, it can also be downloaded from the Internet :

cd ~/nuc980-sdk/ 

git clone --depth=1 https://github.com/OpenNuvoton/NUC980_Linux_Applications.git
#  Got NUC980_Linux_Applications Folders are examples and tools 

NUC980 NuWriter Linux command line tool

As mentioned earlier NuWriter This Windows Version of the burning tool , This tool also has Linux Command line version , The command-line version of the tool is useful in certain situations , This is also installed here :

cd ~/nuc980-sdk/ 

git clone --depth=1 https://github.com/OpenNuvoton/NUC980_NuWriter_CMD.git
#  Download it NUC980_NuWriter_CMD Catalog 

cd NUC980_NuWriter_CMD/
#  To configure 、 compile 、 install 
./configure --prefix=$PWD/install
make
make install

After the installation, it will be in NUC980_NuWriter_CMD Get the program under the directory nuwriter, The program receives a configuration file , Burn the program according to the content configured in the configuration file , For example, the following methods :

./nuwriter run.ini

By default, there will be a in the same directory of the tool after the tool is installed run.ini file , You can refer to the instructions in this file to write your own configuration file .

Basic description of compilation configuration

Development and compilation working directory

After the above installation nuc980-sdk The directory should contain the following contents :

Catalog explain notes
arm_linux_4.8 Cross compile toolchain Add to the environment variable temporarily in the following way , Pay attention to using your own path :
export PATH=$PATH:/home/nx/nuc980-sdk/arm_linux_4.8/bin
NUC970_U-Boot_v2016.11U-Boot Source code
NUC980-linux-4.4.y Kernel source code
buildroot-2022.02.3 Building tools It is used here to build file systems
image Preset system image The content is useless , The directory itself is useful ;
Under the default configuration, the results will be output to the same level of the kernel source directory when compiling the kernel image Directory ;
rootfs Preset file system For testing purposes only ;
Under the default configuration, the kernel source code directory of the same level will be compiled rootfs Package into the kernel ;
NUC980_Linux_Applications Application examples
NUC980_NuWriter_CMD Command line burning tool

Special attention should be paid to the official of the new Tang Dynasty Linux Kernel project is configured with the its peers by default image、rootfs The directory will have interaction .

U-Boot

Official of the new Tang Dynasty U-Boot In the project and NUC980 Some related directories or files are as follows :
 Insert picture description here
The main thing to pay attention to is configs/ Contents and include/configs/ A file in a directory , The contents of the two directories are related to each other , Mainly the configuration information of each official development board .

Linux Kernel

Official of the new Tang Dynasty Linux Kernel In the project and NUC980 Some related directories or files are as follows :
 Insert picture description here
The main thing to pay attention to is arch/arm/configs/ A file in a directory , Mainly the configuration information of each official development board .

summary

Up to Xintang NUC980 The preparation of the development and use foundation , Mainly download, decompress, install, etc . about NUC980 Some contents of the chip itself can be referred to 《 New Tang NUC980 Use records : Basic description and data index 》 .

原网站

版权声明
本文为[Naisu Xu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221755390322.html