I recently bought a NanoPi M1 board from FriendlyArm, and applied for a NanoPi NEO board online. Both are Crotex-A7 quad-core ARM development boards based on the Allwinner H3 chip. The two boards can share a development environment. This article takes NanoPi NEO as an example to briefly describe the construction of the ARM development environment based on the Allwinner H3 chip.
1. Install cross-compilation tools
1.1 Obtaining cross-compilation tools
In Baidu Netdisk, the cross-compilation tool for Nanopi NEO is provided:
Notice:
The first gcc-linaro-arm.tar.xz is compiled using the script provided by Friendly Arm to generate the firmware;
If you need a cross-compilation tool to compile applications or kernels, you need to use the second arm-cortexa9-linux-gnueabihf-4.9.3-20160512.tar.xz tool.
1.2 Install cross-compilation tools
Unzip: arm-cortexa9-linux-gnueabihf-4.9.3-20160512.tar.xz, get the 4.9.3 directory, and copy the directory to /usr/local/arm/ in the same way as building a cross-compilation environment for other platforms.
Set the environment variables and add the following to the end of ~/.bashrc:
# vim ~/.bashrc
PATH=$PATH:/usr/local/arm/4.9.3/bin/
export PATH
Restart or log out and log in again to use the cross-compilation tool.
1.3 Verify that the installation is successful
Verify that the cross-compilation tool is installed successfully:
$ arm-cortexa9-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-cortexa9-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/local/arm/4.9.3/bin/../libexec/gcc/arm-cortexa9-linux-gnueabihf/4.9.3/lto-wrapper
Target: arm-cortexa9-linux-gnueabihf
Configured with: /work/toolchain/build/src/gcc-4.9.3/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-cortexa9-linux-gnueabihf --prefix=/opt/FriendlyARM/toolchain/4.9.3 --with-sysroot=/opt/FriendlyARM/toolchain/4.9.3/arm-cortexa9-linux-gnueabihf/sys-root --enable-languages=c,c++ --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3 --with-float=hard --with-pkgversion=ctng-1.21.0-229g-FA --with-bugurl=http://www.friendlyarm.com/ --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --with-gmp=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-mpfr=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-mpc=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-isl=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-cloog=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --with-libelf=/work/toolchain/build/arm-cortexa9-linux-gnueabihf/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-gold --disable-multilib --with-local-prefix=/opt/FriendlyARM/toolchain/4.9.3/arm-cortexa9-linux-gnueabihf/sys-root --enable-long-long
Thread model: posix
gcc version 4.9.3 (ctng-1.21.0-229g-FA)
1.4 Verify that the cross-compilation tool can compile normally
Verify that the program compiled by the installed cross-compilation tool can run on the Nanopi NEO board:
1) First, write a simple verification program, which is the Hello world!
$ cat hello.c
#include int main(void) { printf("Hello world!n"); return 0; } 2) Cross-compile the program into a program that can be run on the board: $ arm-cortexa9-linux-gnueabihf-gcc hello.c -o hello 3) After the compilation is complete, the generated hello program can be viewed in the following file properties: $ file hello hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.0.8, BuildID[sha1]=e471478037c7cf740dadac9ec82136aad38f0c4e, not stripped 2. Copy the program to the development board through the NFS file system 2.1 Connect the board to the Internet first 1) Make sure the board is connected to the Internet: # ifconfig eth0 Link encap:Ethernet HWaddr **:**:**:**:**:** inet addr:***.***.*.*** Bcast:***.***.*.255 Mask:255.255.255.0 inet6 addr: ****::****:****:****:****/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:820 errors:0 dropped:0 overruns:0 frame:0 TX packets:637 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:513171 (501.1 KiB) TX bytes:49921 (48.7 KiB) Interrupt:114 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:33 errors:0 dropped:0 overruns:0 frame:0 TX packets:33 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3304 (3.2 KiB) TX bytes:3304 (3.2 KiB) 2) Ping the external network to check whether it can communicate with the external network: # ping www.baidu.com PING www.baidu.com (163.177.151.110) 56(84) bytes of data. 64 bytes from www.baidu.com (163.177.151.110): icmp_seq=1 ttl=53 time=11.1 ms 64 bytes from www.baidu.com (163.177.151.110): icmp_seq=2 ttl=53 time=10.3 ms 64 bytes from www.baidu.com (163.177.151.110): icmp_seq=3 ttl=53 time=10.6 ms ^C --- www.baidu.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 10.356/10.740/11.183/0.350 ms 2.2 Install NFS server and configure NFS directory 1) Install NFS Server # sudo apt-get install nfs-kernel-server 2) Create NFS directory: # vim /etc/exports Add to: /mnt *(rw,sync,no_root_squash,no_subtree_check) 3) Restart the NFS server: # systemctl restart nfs-kernel-server 4) Check whether nfs is started: # ps -aux | grep nfs root 39 0.0 0.0 0 0 ? S< 14:53 0:00 [nfsiod] root 29118 0.0 0.0 0 0 ? S 15:55 0:00 [nfsd] root 29119 0.0 0.0 0 0 ? S 15:55 0:00 [nfsd] root 29120 0.0 0.0 0 0 ? S 15:55 0:00 [nfsd] root 29121 0.0 0.0 0 0 ? S 15:55 0:00 [nfsd] root 29122 0.0 0.0 0 0 ? S 15:55 0:00 [nfsd] root 29123 0.0 0.0 0 0 ? S 15:55 0:00 [nfsd] root 29124 0.0 0.0 0 0 ? S 15:55 0:00 [nfsd] root 29125 0.0 0.0 0 0 ? S 15:55 0:00 [nfsd] root 29142 0.0 0.1 4136 748 ttyS0 S+ 15:56 0:00 grep nfs 2.3 Transferring files via NFS network server Mount the file to the board via the NFS network server: 1) Install the NFS client on the PC virtual machine: $ sudo apt-get install nfs-common 2) Mount the board's /mnt/nfs directory to the PC virtual machine's /mnt directory: $ sudo mount -t nfs -o intr,nolock 192.168.4.113:/mnt/nfs /mnt 3) Copy the compiled program on the PC virtual machine to the board: $ sudo cp hello /mnt You can see the copied program in the /mnt/nfs directory on the board: # ls /mnt hello Run the program on the development board to verify whether the program can run on the board: # ./hello Hello world! The verification is successful, and the program compiled by the cross-compilation tool can run normally on the board. At this point, the development environment based on the Allwinner H3 chip has been built and development work can be carried out.
Previous article:ARM bus architecture (S3C2440)
Next article:Qemu builds ARM vexpress development environment (Part 3) ---- NFS network root file system
Recommended ReadingLatest update time:2024-11-16 21:40
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- There seems to be a lot of confusion about what Thread is, what Matter is, and how HomeKit will integrate with them.
- What does Matter do?
- [ST NUCLEO-U575ZI-Q Review] Serial port transceiver test
- How Matter works
- [ST NUCLEO-U575ZI-Q Review] Serial port receiving driver based on ring buffer
- There are several topological structures of inverter circuits. Isn't half-bridge a kind of push-pull? Who can popularize the principles of half-bridge and push-pull?
- Matter: Why is it needed?
- [ST NUCLEO-U575ZI-Q Review] Two implementations of standard input and output
- Extending HomeKit with Matter
- What are the charge pump chip solutions for boosting voltage to 12V?