Design of embedded U-BOOT gigabit network function based on S3C2440A

Publisher:CW13236066525Latest update time:2012-07-31 Source: 21ic Keywords:S3C2440A  U-BOOT Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

U-BOOT supports network functions. When downloading operating system kernels and large file systems, it is faster and more convenient than other boot loaders that do not support the network. At present, U-BOOT only supports 10M/100M network functions. With the development of science and technology, gigabit network functions will be widely used in embedded systems. This article introduces a method to make U-BOOT support gigabit network functions, which can make U-BOOT more powerful and more convenient to use. Introduction to

U-BOOT

The full name of U-BOOT is Universal Boot Loader. It is an open source project that follows the terms of the GPL. It supports a variety of processors, such as ARM, PowerPC, MIPS, etc. It also supports embedded operating systems such as Linux, VxWorks, QNX, RTEMS, ARTOS, LynxOS, etc.

U-BOOT includes two different working modes: boot loading mode and download mode. Boot loading mode is also called autonomous mode, that is, U-BOOT loads the operating system from a solid-state storage device on the target machine into RAM for operation. This mode is the normal working mode of U-BOOT. Download mode means that during the development or production process, U-BOOT downloads the operating system kernel and file system from the host to the RAM of the target machine through network connection and other communication means, and then writes them to the FLASH solid-state storage device on the target machine. U-BOOT allows users to switch between these two working modes. When the system starts, it will wait for a period of time. If the user does not press a key at this time, U-BOOT will enter the boot loading mode by default.

U-BOOT code adopts a highly modular programming method, which can be easily transplanted on different hardware platforms. U-BOOT contains multiple directories, as shown in Figure 1. Among them, the BOARD directory stores all the subdirectories of the target boards it supports, such as BOARD/SMDK2440/, which is the target board to be used in this article; the COMMON directory is a file that is independent of the architecture and implements C files of various commands; the CPU directory stores the CPU types it supports, such as arm920t, mips, mpc8260 and nios, etc. Each specific subdirectory includes cpu.c and interrupt.c, start.c, etc. s; the DRIVERS directory stores drivers for various peripheral interfaces, including the Gigabit network driver used in this article; the FS directory stores some file systems, and U-BOOT now supports cramfs, fat, fdos, jffs2, and registerfs; the net directory stores network-related codes, the implementation of the BOOTP protocol, TFTP protocol, RARP protocol, and NFS file system, and the INCLUDE directory stores some related header files, as well as assembly files supporting various hardware platforms, system configuration files, and files supporting file systems. Hardware platform



The

hardware platform used in this article is a development board based on S3C2440A and an embedded network card based on the non-PCI Gigabit Ethernet control chip AX88180, as shown in Figure 2. S3C2440A is a 16/32-bit RISC embedded microprocessor based on ARM920T core, with a running frequency of up to 500MHz. The development board has 64M NAND flash memory and 64M SDRAM. The network card is composed of MAC chip AX88180, PHY chip 88E1111, RJ45 and other circuits. The S3C2440A target board and the network card are connected by the target board 32-bit expansion bus. These two parts can also be designed on the same board during product design.




Driver

To embed the gigabit network function in U-BOOT, it is necessary to design a gigabit network card driver, and transplant it in U-BOOT, and realize functions such as downloading through the gigabit network port on the corresponding hardware platform. The network card driver mainly consists of the initialization program eth_init(bd_t*bd), the network device shutdown program eth_halt(void), the data packet sending program eth_send(volatilevoid*packet, intlength), and the data packet receiving program inteth_rx(void). The work of the initialization program is mainly to configure and initialize the hardware. In the initialization program, the configuration of the network control chip AX88180 and the PHY chip can be completed, such as setting the interface to 1000Mbps, full-duplex mode, etc. Data transmission is to put the data packaged by the upper layer protocol in the sending data buffer, and then the network card sends it to the network; data reception is to take the data out of the buffer and hand it over to the upper layer protocol program for unpacking after the network card receives the data packet from the network and generates an interrupt. The interrupt service program handles the interrupts generated after the network card sends and receives the data packet, as well as the interrupts generated by the PHY.

The network card initialization procedure is as follows:

int eth_init(bd_t*bd)
{
memset(&axlocal, 0, sizeof(AX88180_PRIVATE));
RESET_MAC;
DISABLE_INTERRUPT;
WRITE_MACREG(CMD, WAKEMOD);
tmp16= bd->bi_enetaddr
; macid0_val=(tmp16<<8) │ bd>bi_enetaddr[0]; tmp16=bd- >bi_enetaddr; macid1_val=(tmp16<<8)│ bd>bi_enetaddr; tmp16=bd->bi_enetaddr; macid2_val=(tmpl6<<8)│ bd>bi_enetaddr; WRITE_ MACREG(MACID0, macid0_val); WRITE_MACREG(MACID1, macid1_val); WRITE_MACREG(MACID2, macid2_val); [page]






ax88180_PHY_initial();
ax88180_meida_config();
WRITE_MACREG(RXFILTER,DEFAULT_RXFILTER);
INT TXRX VARIABLES;
READ_MACREG(ISR,tmp_regval);
PRINTK(INIT_MSG,”ax88180;The interrupt status="0x"%081x\n”.tmp_regval);
if(tmp_regval)
WRITE_MACREG(ISR,tmp_regval);
WRITE_MACREO(CMD,RXEN │ TXEN │ WAKEMOD);
return0;}

Driver transplantation

Driver transplantation is to add driver code and related configuration in U-BooT based on S3C2440A hardware platform, as follows:

1. Add network port device drivers ax88180. c and ax88180. h in drivers/directory.

2. Add the following code to the corresponding position in lib_arm/board.c (refer to CS8900):

#ifdef CONFIG_DRIVER_AX88180
extern Void ax88180_get_enetaddr(uchar*addr);
#endif
#ifdef CONFIG_DRIVER_AX88180
ax88180_get_enetaddr(gd一>bd>bi_enetaddr);
#endif

3. Add the following code to the corresponding position in include/configs/smdk2440.h (refer to CS8900):

#define CONFIG_DRIVER_AX88180 1 #define AX88180_BASE
Ox08000000

4. Finally, add ax88180.o to drivers/Makefile and recompile to generate U-BooT.

Conclusion

U-BOOT is widely used in embedded systems. The method described in this article can make U-BOOT more powerful and more convenient to use. The hardware platform introduced in this article provides some guidance for the design of gigabit network functions in embedded systems. Although this design is based on the S3C2440A platform, it can also serve as a good reference for other similar systems. The method introduced in this article has been applied in products with good results.

Keywords:S3C2440A  U-BOOT Reference address:Design of embedded U-BOOT gigabit network function based on S3C2440A

Previous article:Reprogramming PLDs using embedded processors
Next article:S3C2440 camera interface features and driver under WinCE

Recommended ReadingLatest update time:2024-11-16 15:48

A brief discussion on how to pass parameters from U-boot to Kernel under ARM
We may all know that U-boot will pass many parameters to the Linux Kernel, such as serial port baud rate, RAM Size, videofb, MAC Address, etc., and the Linux kernel will also read and process these parameters. The parameters are passed between the two through struct tag. U-boot saves the things to be passed to the k
[Microcontroller]
u-boot-2009.08 transplantation on mini2440 (Part 2) --- Adding NOR flash function
Migration environment 1. Host environment: CentOS 5.5 under VMare, 1G memory. 2. Integrated development environment: Eclipse IDE 3. Compilation environment: arm-linux-gcc v4.4.3, arm-none-eabi-gcc v4.5.1. 4. Development board: mini2440, 2M nor flash, 128M nand flash. 5.u-boot version: u-boot-2009.08 6. References: ht
[Microcontroller]
u-boot-2009.08 transplantation on mini2440 (Part 2) --- Adding NOR flash function
Based on the transplantation of Ok6410 development board u-boot
Prerequisite environment: Win7+VirsualBox+ok6410+u-boot-2010.03 1. Download u-boot-2010.03 source code ftp://ftp.denx.de/pub/u-boot Unzip, I changed the permissions of all files to avoid trouble tar jxvf u-boot-2010.03.tar.bz2 sudo chmod -R 777 u-boot-2010.03/*
[Microcontroller]
[Linux transplant] ——2. Transplanting u-boot-2012.04.01 refers to analyzing the boot process
1. Transplanting u-boot-2012.04.01 refers to analyzing the boot process a. Get the source code: Download u-boot-2012.04.01.tar.bz2 from ftp://ftp.denx.de/pub/u-boot/ and download the cross-compilation chain arm-linux-gcc-4.3.2.tar.bz2. b. Unzip u-boot-2012.04.01.tar.bz2 to your PC and create a Source Insight
[Microcontroller]
Transplantation of u-boot-2015.04 on tq2440 (use spl to boot u-boot)
The difference between this transplant and the previous one is that spl is used to guide u-boot. Please refer to the blog http://blog.csdn.net/fulinus/article/details/42738641 Download link: http://pan.baidu.com/s/1bnlRKgn   Instructions: 1. Compile   make tq2440_defconfig   make 2. Then u-boot.bin will be generated
[Microcontroller]
U-BOOT transplant experience
After running bare metal recently, I started to run the system, but I thought that there is a Bootloader between bare metal and system. Anyway, I didn't study it in depth before, so I decided to spend one to two weeks to play with U-BOOT. I referred to the two great experts fzb and Zhao Chunjiang, and also studied th
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号