A method for embedding gigabit network function in U-BOOT

Publisher:EtherealBeautyLatest update time:2013-04-06 Source: dzscKeywords:U-BOOT Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

       Introduction  U-BOOT is a boot loader

       developed by the German DENX team for a variety of embedded microprocessors. It is the first program code that runs after the system is powered on. It is used to initialize the target board hardware, provide the target board hardware configuration information for the embedded operating system, and load, boot and run the embedded operating system. 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 inevitably be widely used in embedded systems. This article introduces a method to enable U-BOOT to support gigabit network functions, which can make U-BOOT more powerful and easier to use.

       Introduction to U-BOOT

       The full name of U-BOOT is Universal Boot Loader. It is an open source project that complies with 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, and LynxOS.

       U-BOOT includes two different working modes: boot loading mode and download mode. Boot loading mode is also called autonomous mode, which means that 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 communication means such as network connection, 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. The system will wait for a while when it starts. If the user does not press a button 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. The BOARD directory stores all the target board subdirectories 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 for 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, interrupt.c, start.c, and so on. 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, 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, 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.

UBoot Directory


       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 the ARM920T core, with an operating 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, and these two parts can also be designed on the same board during product design. [page]

Hardware platform structure diagram


       The driver

       needs to design a gigabit network card driver to embed the gigabit network function in U-BOOT, and then transplant it in U-BOOT to 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 out the data from 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 program 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[1];
       macid0_val=(tmp16<<8) │ bd>bi_enetaddr[0];
       tmp16=bd->bi_enetaddr[3];
       macid1_val=(tmp16<<8 )│ bd>bi_enetaddr[2];
       tmp16=bd->bi_enetaddr[5];
       macid2_val=(tmpl6<<8)│ bd>bi_enetaddr[4];
       WRITE_MACREG(MACID0, macid0_val);
       WRITE_MACREG(MACID1, macid1_val);
       WRITE_MACREG (MACID2, macid2_val);
       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 the network port device drivers ax88180.c and ax88180.h in the 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)
    ;

bsp; #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 also has a good reference for other similar systems. The method introduced in this article has been applied in products with good results.

Keywords:U-BOOT Reference address:A method for embedding gigabit network function in U-BOOT

Previous article:Development of embedded applications based on μClinux
Next article:Research and System Design of VoIP Dual-mode Gateway

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

u-boot-2016.03 nandflash reading and writing in mini2440 transplantation
In the article "NorFlash Boot", we copied the drivers/mtd/nand/s3c2410_nand.c file to s3c2440_nand.c file, and changed all the "2410" in the file to "2440". This modification only allows the system to compile successfully, but does not really realize the reading and writing of NandFlash. Here, we will introduce how to
[Microcontroller]
u-boot-2016.03 nandflash reading and writing in mini2440 transplantation
EasyARM-iMX257_U-Boot source code transplantation analysis
I-mx257 u-boot-2009.08/cpu/arm926ejs u-boot-2009.08/board/freescale u-boot-2009.08/board/freescale/mx25_3stack (1) Analyze Makefile First, we analyze the Makefile and easily find that in lines 3210-3214, the following is newly added: mx25_3stack_config    :    unconf
[Microcontroller]
EasyARM-iMX257_U-Boot source code transplantation analysis
Samsung S3C2440A processor initialization file - with CPSR register related function bits turned on
;========================================== ; NAME: 2440INIT.S ; DESC: C start up codes ; Configure memory, ISR, stacks ; Initialize C-variables ; HISTORY: ; 2002.02.25:kwtark: ver 0.0 ; 2002.03.20:purnnamu: Add some functions for testing STOP,Sleep mode ; 2003.03.14:DonGo: Modified for 2440. ;========================
[Microcontroller]
[Embedded] Porting U-boot to mini2440 from scratch (Part 1) - U-boot compilation
U-boot version: 2020/5/2 Compilation environment: Ubuntu 16.04 arm-none-eabi-gcc version 4.9.3 20150529 (prerelease) (15:4.9.3+svn231177-1) Operating environment: mini2440 (s3c2440, arm920t) Code repository: git@github.com:JingyeLi/u-boot_2440.git commit hash:45516b370859b022b9bf2c9fb87318b1fa2d34a3 Download the lat
[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号