Ubuntu builds an embedded development environment. The embedded development environment includes two parts: the tool environment and the debugging environment. In the previous article "embedded development environment-cross compilation + tftp + minicom", we introduced the establishment of the tool environment. In this article, this section describes an embedded debugging environment built using these tool environments. Of course, I am not a guiding document for this continuation. I just want to explain my personal favorite debugging methods. Compared with vxworks, the linux driver development environment is still very primitive, whether it's a BSP, a driver, or RTP program, a workbench allows you to complete from coding to online debugging smoothly. Of course, the cost is a lot of dollar. If you have the money to enjoy the service, you can do it yourself. Embedded Development is nothing more than BSP development and driver development. Like all other development work, debugging takes up most of the development cycle, the modified kernel and driver can be easily debugged to greatly improve work efficiency. Think about our common development step, that is, modify and then download to the board for debugging, and view the debugging result through the serial port. Here we will introduce one of my favorite debugging modes: u-boot is first transplanted, debugged, and solidified into flash. It uses tftp to load the kernel online and mount an nfs file system. In this way, both the kernel and newly written drivers can be tested quickly without the need to erase flash. The Development Board is OK6410, And the u-boot version is 1.1.6. You can add and modify it to support the OK6410 DM9000 NIC Driver. 1. Download the kernel. After reading my previous article "embedded development environment-cross compilation + tftp + minicom", it is easy to enable the tftp server and serial port terminal. # Sudo service tftpd-hpa restart # If minicom succeeds, you can see the u-boot initialization and debugging information in the serial port terminal, quickly press any key to enter the u-boot command mode. # The command above tftp 0xc0008000 zImage tells u-boot to read the zImage file from the root directory of the tftp server to the memory 0xc0008000 location. (As you know, this step must be completed successfully. You must place an available kernel zImage file in the root directory of the tftp server.) After tftp reads the zImage file, run bootm 0xc0008000, if the kernel runs normally, you will see the familiar starting kernel. Normally, you will see the kernel panic because you do not have the root file system. Here you have two options: one is to burn the available root file system to the specified flash location; the other is to use nfs. If you decide to use nfs, continue to the next part. 2. To load nfs, first create a directory with the root directory of nfs. # Mkdir nfs/root # cp yaffs/nfs/root if you have never used nfs before, you must install some basic software before use. The main operations are as follows: # sudo apt-get install portmap # sudo apt-get install nfs-kernel-server after installing these two software, you need to configure the following nfs server. # Add/home/eric/Documents/nfs * (rw, sync, no_root_squash) to the end of sudo vi/etc/exports) (Here, configure/home/eric/Documents/nfs according to your actual situation. Note: Create a root directory under nfs; otherwise, the Service may fail to start) next, start the nfs service # sudo/etc/init. d/portmap restart # sudo/etc/init. d/nfs-kernel-server restart: Make sure that no fail is displayed. This indicates that the service is successfully started. Check the nfs service status # service portmap status portmap start/running, process 26038 # service nfs-kernel-server status nfsd running if everything above is normal, it indicates The nfs service is ready for use. Next, configure the u-boot environment variable to tell the kernel to mount nfs. Set the u-boot environment variable and change the startup parameters. my options are as follows: setenv bootargs "root =/dev/nfs nfsroot = 192.168.1.10: /home/eric/Documents/nfs/root/FileSystem-Yaffs2 ip = 192.168.1.20: 192.168.1.10: 192.168.1.1: 255.255.255.0: witech.com.cn: eth0: off console = ttySAC0, 115200 "saveenv note: 192.168.1.20 is the Board's IP address 192.168.1.10 is the host's IP address 192.168.1.1 is the gateway address 255.255.255.255.0 is the subnet mask. Then, our system can be started smoothly. Use tftp 0xc0008000 zImage to download the system and bootm 0xc0008000 to start the system. If it succeeds, you can see that the system is started normally and nfs on your host is mounted. You can easily start debugging your BSP and driver step by step. At least it is easy to run your modified code on the board, you can put your driver under nfs, so that when the board is started, you can test whether the driver is correct, and you can also test your application. Of course, if you think this file is not clear, you can mount a directory of the host to the target machine to share the two directories. 3. Configure the Mount directory to the network environment of the target machine and mount nfs. Create a directory on the target machine and execute the following command. # Mount-t nfs-o nolock 192.168.1.10:/mnt/tmp after the operation is completed, you can execute ls-l on the target machine to view all contents in the mnt directory of the host. Although these tools can help us quickly Debug Programs, It is not highly efficient to develop in IDE after all, we hope that there will be a free and open-source workbench Software under the linux platform, so more people will be involved in linux development.