Ubuntu embedded development environment configuration, cross-compilation environment + tftp + minicom

Source: Internet
Author: User
Ubuntu embedded development environment configuration, cross-compilation environment + tftp + minicom to build an embedded development environment, mainly including these services need to be configured, cross-compilation environment, tftp service, serial port terminal. The following is a brief introduction. the cross-compilation environment is easy to understand and cannot compile programs without it... Ubuntu embedded development environment configuration, cross-compilation environment + tftp + minicom

To build an embedded development environment, you need to configure these services, cross-compilation environment, tftp service, and serial port terminal.
The following is a brief introduction. the cross-compiling environment is easy to understand. it is necessary to run the program on the board without it. the tftp service is very useful. if the kernel is compiled every time, they all need to be burned to flash, not only to greatly reduce the flash life (generally, flash can be erased for about 0.1 million times), but also very cost-effective, using the tftp service to load the program directly from the host to the board, it is very comfortable to run immediately. The serial port terminal is also a required service. without a serial port terminal, you do not know the current running status of the board, nor can you use command interaction. without it, you can hardly develop it.
The author's host is a Ubuntu 11.10 system. The following briefly describes how to set up the following development environment for later reference. If any readers think there is a problem, please leave a message to discuss it.

I. cross-compilation environment
The cross compiler can be compiled by yourself, but the best way is to use the forming cross compiler provided by the board sub-manufacturer, which is convenient and almost no problem; otherwise, you can compile it by yourself, the arm-gcc cross-compilation tool provided by the OK6410 Development Board is not compiled, but the configuration is different.
# Mkdir/usr/local/arm
# Cp arm-linux-gcc-4.3.2.tgz/usr/local/arm
# Tar-zxvf arm-linux-gcc-4.3.2.tgz-C/extract
After completing the above operations, there should be a 4.3.2 Directory under the usr/local/arm directory, which includes all the things required for cross-compilation, add the bin in this directory to the environment variable.
 
Echo $ PATH: check the current environment variable configuration. our goal is to add the/usr/local/arm/4.3.2/bin value to the $ PATH variable, which can be modified in many places, for example,/etc/environment ,~ /. Profile, etc. I personally recommend you ~ /. Profile. when sudo-s is used, cross-compiled environment variable settings cannot be found. readers familiar with the Ubuntu environment variable management process can easily understand why.
# Gedit. profile
Enter export PATH = $ PATH:/usr/local/arm/4.3.2/bin in the last line of the file, save the file, and use the source. profile command to make the configuration take effect.
# Echo $ PATH
#/Usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/arm/4.3.2/bin
# Arm-linux-gcc-v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured: /scratch/julian/lite-respin/linux/src/gcc-4.3/configure -- build = i686-pc-linux-gnu -- host = i686-pc-linux-gnu -- target = arm-none-linux-gnueabi -- enable-threads -- disable -libmudflap -- disable-libssp -- disable-libstdcxx-pch -- with-gnu-as -- with-gnu-ld -- enable-versions ages = c, c ++ -- enable-shared -- enable-symvers = gnu -- enable-_ cxa_atexit -- with-pkgversion = 'sourcery G ++ Lite 2008q3-72 '-- with-bugurl = https://support.codesourcery.com/GNUToolchain/ -- Disable-nls -- prefix =/opt/codesourcery -- with-sysroot =/opt/codesourcery/arm-none-linux-gnueabi/libc -- with-build-sysroot =/scratch/ julian/lite-respin/linux/install/arm-none-linux-gnueabi/libc -- with-gmp =/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr -- with-mpfr =/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr -- disable-libgomp -- enable-poison-system-directories -- with-build-time- tools =/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin -- with-build-time-tools =/scratch/julian/lite- respin/linux/install/arm-none-linux-gnueabi/bin
Thread model: posix
Gcc version 4.3.2 (Sourcery G ++ Lite 2008q3-72)
Environment variable configured successfully.

II. configure the tftp service
The tftp service mentioned here only refers to the tftp service of the debugging host, the U-BOOT on the development board to support the tftp service needs to involve the modification of the NIC driver, not the focus of our discussion, we will not discuss it here.
The procedure is as follows:
1. open the new package manager and search for tftp. if you have installed tftp and tftpd, delete them first. if you have installed tftp-pha and tftpd-hpa, they are also completely deleted with the new version.
2. install tftp-hpa and tftpd-pha with the new version.
3. set the tftp server. Create a tftp root directory, indicating the location where the tftp client will access
# Cd Document
# Mkdir tftproot
# Chmod 777 tftproot)
4. change the configuration file of the tftp server.
# Vi/etc/default/tftpd-hpa
Before the modification, it is as follows:
#/Etc/default/tftpd-hpa
TFTP_USERNAME = "tftp"
TFTP_DIRECTORY = "/tftpboot"
TFTP_ADDRESS = "0.0.0.0: 69"
TFTP_OPTIONS = "-l-c-s/tftpboot"
The modified configuration is as follows:
RUN_DAEMON = "yes"
OPTIONS = "-l-s-c/home/eric/Documents/tftproot" (modify according to your actual situation)
TFTP_USERNAME = "eric" (modify according to your actual situation)
TFTP_DIRECTORY = "/home/eric/Documents/tftproot" (modify according to your actual situation)
TFTP_ADDRESS = "0.0.0.0: 69"
TFTP_OPTIONS = "-- secure"
5. restart the tftp service.
# Sudo service tftpd-hpa restart
Tftpd-hpa start/running, process 2084
6. test whether the tftp service is normal.
Access any directory and obtain the test.txt file under tftproot( the reader can create a test file). after the operation is completed, check whether the test.txt file is read successfully.
# Tftp localhost
# Tftp> get test.txt (create a test small file in your tftproot directory and test and obtain it here)
# Tftp> quit
A tftp server is configured. you can use the tftp command in uboot of the Development Board to obtain the kernel and file system files on the host.

III. Serial port terminals
The role of the serial port terminal does not need to be said, almost when debugging BSP and the driver, it is used everywhere to deal with the board, the author uses minicom.
The procedure is as follows:
1. install minicom
# Sudo apt-get install minicom
2. configure minicom
Enter minicom in the terminal to start minicom;
Press Ctrl + a, open it, and then press o to display the configuration menu.
Select Serial port setup
 
The above is my configuration. if the Serial port is not used but is used directly, the Serial Device must be configured as/dev/ttyS0.
Configure the baud rate, data bit, and stop bit. type "E" and set the baud rate to 115200 8N1 (no parity check, 1 stop bit ), for hardware/software traffic control, type "F" and "G" and select "NO.
Press the Enter key to exit the current configuration, and select Save setup as dfl to Save as the default configuration. you can use it directly next time. (If the prompt says that the configuration cannot be saved as the default configuration, the permission is insufficient. Note that sudo is used when starting minicom)
Next, you can use the serial port terminal to debug the connection.

The basic environment for debugging BSP and driver has been set up. now you can start your work.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.