Develop arm Program (ok6410 Development Board) with only serial port and bare metal Network)

Source: Internet
Author: User
Tags file transfer protocol

Recently, I want to learn about the arm Development Board and develop bare metal programs as per the single-chip microcomputer routine. Baidu, most bare-metal programs are developed using rvds or ads, and written to SDRAM using jlink or JTAG for execution. Because I am used to it in Ubuntu and want to break away from the integrated development environment, I will use arm-Linux-GCC and other tools for development in Linux. The first problem I encountered was how to install the developed binary file on the board to run it?

Most of the methods provided by Baidu are written through uboot and written using the dnw of uboot. However, my environment is win7 64bit, and the USB drive of dnw cannot be installed, I am too lazy to borrow an OTG line from someone else, so this approach is not taken into consideration. Continue to Google and find a way to write the binary file to the specified memory on the Development Board through the TFTP function of uboot. This method only requires network connection and serial port connection, which is more convenient. Therefore, we decided to choose this method.

First, build a TFTP server on Ubuntu (my development environment is: Ubuntu 13.04 for development, win7 remote login to Ubuntu 13.04, serial port connection to win7 and development board, network connection to Ubuntu and Development Board ). Specific Method reference: http://www.2cto.com/ OS /201203/122887.html

1.1 setting up the TFTP server TFTP (Trivial File Transfer Protocol, simple File Transfer Protocol) is a UDP-based protocol for simple file transfer between the client and the server, suitable for application scenarios with low overhead and no complexity. The tftp protocol is designed for small file transfer. files can only be obtained from the server or written to the server. directories cannot be listed or authenticated. In Embedded Linux development, the TFTP protocol is used in many occasions and is even indispensable, especially in the kernel debugging stage, it is convenient and fast to load and run the kernel from the server through the TFTP protocol in U-boot. By default, the TFTP service and TFTP server are not installed in general releases. The tftp service depends on the network daemon service program. You can choose to install inetd or the upgraded Xinetd, install TFTP and TFTP-server, and then modify or create/etc/xinetd. d/TFTP configuration file, and then restart xinetd to start the TFTP service. Regardless of the release version, the installation of the TFTP server is like this, but the installation commands for different releases are different. The following uses Ubuntu as an example to describe. Install xinetd: KY @ Ubuntu :~ $ Sudo apt-Get install xinetd install TFTP and tftpd: KY @ Ubuntu :~ $ Sudo apt-Get install tftp tftpd or install TFTP enhanced version TFTP-HPA: KY @ Ubuntu :~ $ Sudo apt-Get install TFTP-HPA tftpd-HPA create a configuration file. Create/etc/xinetd. d/TFTP file: service tftp {socket_type = dgram protocol = udp wait = Yes user = root server =/usr/sbin/in. tftpd server_args =-S/var/tftpboot/disable = No per_source = 11 CPS = 100 2 flags = IPv4} Where the/var/tftpboot directory set by server_args is the directory of the TFTP server, set its access permission to 777: KY @ Ubuntu :~ $ Sudo mkdir-PV/var/tftpboot/KY @ Ubuntu :~ $ Sudo chmod 777/var/tftpboot/start or restart the xinetd service: KY @ Ubuntu :~ $ Sudo/etc/init. d/xinetd start or restart local test. Create a KY file in the/tftpboot directory, start another terminal, and enter: KY @ Ubuntu :~ $ TFTP 127.0.0.1tftp> Get Ky # obtain the KY file TFTP> q # exit TFTP and enter the LS command on the terminal. You can see the KY file obtained by FTP in the current directory. Use the Development Board to verify whether the TFTP server is available. Start the Development Board, enter the U-boot command line, and use the TFTP Command to load files from the TFTP server, such as: U-boot $ TFTP 80008000 zimageenet: auto-negotiation completeenet: Link Status upenet: full duplexenet: 100 mbasemac: 00: 61: 62: 69: 6e: 67 TFTP from server 192.168.1.3; our IP address is 192.168.1.5filename 'zimage '. load address: 0x80008000loading: ################################ donebytes transferred = 479927 (752b7 hex) (1) Use the Development Board to communicate with the customer system installed on the virtual machine through TFTP. You must set the virtual network card to bridge. D mode, and static IP addresses are recommended. (2) If the above settings are correct but TFTP still fails, check whether the firewall of the host is disabled.

TFTP Construction Method

After setting up: the Development Board is powered on, and the serial port terminal stays in uboot state by pressing any key to enter the uboot command mode:

Set and save the uboot IP address and gateway. You can use the TFTP Command to download binary files to the Development Board.

To set uboot IP and other parameters, refer to: http://www.linuxidc.com/Linux/2013-05/84302p4.htm

Download the mini2440 bare metal program uboot [Date:] Source: Linux community Author: dream890527 [Font: large medium small] 6.1 enter uboot command line 6.2 use TFTP to download. binfile 6.2.1 set the development board printenv setenv ipaddr192.168.1.100 // The Development Board IP setenv serverip192.168.1.101 // windows IP setenv gatewayip192.168.1.1 // The Gateway saveenv 6.2.2 puts the uimage under the tftpboot directory and automatically loads the burned xx. bin to NAND Flash to XX. copy bin to/tftpboot/input smdk2440a> TFTP 0x30000000 XX in sequence in securecrt. bin smdk2440a> NAND erase0x0000 0x40000 smdk2440a> NAND write0x30000000 0x00000 0x400000 6.3 restart Development Board U-boot source code http://www.linuxidc.com/Linux/2011-07/38897.htm

Uboot network parameter settings

 

For example, TFTP 0x50000000 led_on_c.bin

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.