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.
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Do all voltage rails need to use low quiescent current? Here's the answer!
- How Carrier Networks Will Achieve 5G 《Vintage Multi-Carrier Technology》
- Mentor Use
- Analysis of the working principles of seven triode collector DC circuits 2
- Circuit
- TMS320F28035 call jump instruction problem
- Sliding resistor for LM358 comparator
- TE pressure sensor: underwater robots from 0 to 1000, how to avoid mass production pitfalls
- OHM Graphical Introduction to Electronics
- Detailed explanation of the design of RFID-based smart hotel system