Introduction
At present, embedded real-time systems designed based on VxWorks are widely used. There are many ways to start embedded real-time systems. The reference BSP (Board support Package) package provided by WindRiver provides several startup methods. In addition, in reference [2], the author also proposed several startup methods for embedded systems based on VxWorks. These methods can be appropriately selected according to specific application requirements. The author has also implemented these methods when developing CableModem. The common problem of these methods is that although the image file in the onboard program memory can be updated, the storage space of the program memory cannot be expanded once it is designed; in actual applications, due to the enhancement of embedded system functions, the size of the system image file will continue to increase, and there will be a problem of exceeding the program storage space of the target board, so that the new image file cannot be burned into the target board.
With the development of USB technology, USB flash drives have been widely used in PC systems, basically replacing floppy disks, and PC systems can be started from USB flash drives. Because USB flash drives have stable performance, small size, and fast access speed, they are also very suitable as storage devices for embedded real-time systems. This provides a new idea for the startup of embedded real-time systems, that is, startup from a USB flash drive. This method does not require much program storage space on the embedded real-time system board. It only needs to store the Bootrom program of the embedded real-time system in Flash, put the system image file on the USB flash drive, and load the real-time operating system from the USB flash drive. This paper gives the embedded host hardware structure, software protocol stack, and main program flow for realizing the startup of the embedded real-time system from a USB flash drive, and discusses the feasibility of realizing the startup of the embedded real-time system from a USB flash drive.
1 Hardware structure and driver of embedded USB host controller
Embedded system is a system with close integration of software and hardware. To realize booting from USB flash drive, a USBHOST host controller must be added to the periphery of embedded microprocessor in hardware; host controller driver (HCD), USB driver, USB Client driver and application program must be designed in software.
1.1 Hardware structure of embedded USB host
The hardware structure of embedded USB host is relatively simple, which only needs to add USB host control chip to the outside of embedded microprocessor. In this project, the embedded microprocessor is Motorola's MPC860T, and the USB host control chip is SL811HS chip. SL811HS chip is a USB control chip produced by Cypress that supports full-speed data transmission. The chip contains USB master and master/slave controllers, supports full-speed/low-speed data transmission, and can automatically identify full-speed or low-speed devices. The interface provided by SL811HS complies with USB1.1 standard. For more detailed usage of SL811HS, please refer to reference [3]. The system hardware structure using SL811HS as the embedded USB host controller is shown in Figure 1.
1.2 Software Structure on Embedded USB Host
From reference [4], we know that in order for an embedded host to operate its USB peripherals, it must have three software structure levels as shown in Figure 2: USB host controller driver (HCD), USB host driver (USBD), and USB device driver.
At the bottom of the protocol stack is the USB host controller USB HC (USBHost Controller), which is the hardware part that controls each USB device in the host system. There are two main types of USB host controllers: one is the universal host controller interface UHCI (Universal Host Controller Interface), and the other is the open host controller interface OHCI (Open Host Controller Interface). Hardware manufacturers generally design USB host controllers according to these two specifications. For each type of host controller, there is a USB host controller driver HCD (Host Controller Driver) that is independent of the hardware. WindRiver provides two types of drivers: usbHedUhciLib (UHCl host controller library) and usbHcdOhciLib (OHCI host controller library).
The interface between the USB host driver USBD (USB host Driver) and HCD allows one or more than one underlying host controller, and WindRiver's USBD can connect to multiple USB HCDs at the same time. This design feature allows developers to build complex USB systems. USBD is a hardware-independent module above HCD. USBD manages each USBD device connected to the host and provides a path for higher levels to communicate with USBD devices. It is also responsible for automatically handling USBD power management and USBD bandwidth management; moreover, USBD also manages USBHub. Whether the Hub can work correctly is one of the criteria for evaluating USBD, so WindRiver's USBD designers want USBD to transparently implement the Huh function. This means that USBD can also handle the dynamic plugging and unplugging of USBHub and devices.
The USB client module is at the top of the USBD main driver protocol stack. The USB class driver is a typical example of a Client module. The USBD class driver is responsible for managing different types of devices connected to the USBD, and they rely on the USBD to provide a communication path with each device. Other examples of USBClient modules are applications that use USBD to communicate with USB devices. [page]
2 Design of USB boot software for embedded real-time system
To realize the operation of USB flash drive, in the embedded real-time system designed based on VxWorks, the programs that need to be designed include: USB host controller driver, USBD host driver, USB block storage device driver, file system installation, and application program for reading and writing USB flash drive device through file system, as shown in Figure 3. Therefore, to realize booting from USB flash drive, 4 functions need to be added to the usrRoot function in the bootConfig.c file.
(1) Function to initialize USB host controller
Initialize HCD (USB Host Controller Driver) function, that is, initialize SL81lHS and connect it to the specified bus: LOCAL int fn-cAttach(pHRB_ATTACH pHrb).
This function word uses SL811Init() to initialize SL811 control chip. Execute the function taskSpawn("tSl81lint", 0, 0, 0x4000, (FUNCPTR) intThread, (int) pHost, 0, 0, 0, 0, 0, 0. 0, 0, O), create intThread task to handle the interrupt.
Here, intTbaead calls OSS_SEM_TAKE(pHost-> in-tPending, interval) to block and synchronize with the interrupt service program intHandle.
Call the function processSl811hInterrupt() to handle the hardware interrupt and read the interrupt status register to determine the interrupt type.
Call UHC_INT_CONNECT(pHost, intHandler, pHost, &s) function to connect SL811 main controller chip interrupt. UHC_INT_CONNECT is a macro definition.
Function intHandler completes the processing of the interrupt, calls function OSS_SEM_GIVE(pHost->imPending), and releases the binary semaphore used for synchronization between interrupts and tasks.
(2) Function to initialize USBD Function
usbdInitialize() initializes the internal USBD data structure and calls the entry points of other USB driver stack modules in sequence.
Function usbdlnitialize() calls usbdHcdAttach(execFunc, &s1811IOCfg, pToken) to connect HCD to USBD. Here execFunc is function usbHcdSl811hExee().
Function usbdInitialize() calls USBEnumerate(USBD_CLIENT_HANDLE clientHandle, FILE*fout) to enumerate all USB host controllers, Hubs, and USB devices connected to the system.
(3) Function to initialize USB storage devices Function
usbBulkDevInit() completes the initialization of the USB disk and installs the DOS file system.
Function usbBulkDevlnit calls function usbdClientRegister("BULK_CLASS", &usbdHandle) and function usbdDynamicAttachRegister(usbdHandle, USB_CLASS_MASS_STORAGE, USB_SUBCLASS_SCSLCOMMAND_SET, USB_INTERFACE_PROTOCOL_BULK_ONLY, usbBulkDc- vAttachCallback) to establish a connection with USB and register a callback routine.
Function usbBulkDevlnit calls function OSS_THREAI)_CREATE(bulkClientThread, (pVOID) fout, OSS_PRIORITYINTERRUPT, "tBulkClnt", &bulkTaskId) to create a task to manage the insertion and removal of the USB drive.
The bulkCliemThread routine calls pBulkBlkDev=(BLK_DEV*)usbBulkBlkDevCreate (bulkNodeld, NULL, NULL, USB_SCSI_FLAG_READ_WRITEl0); installs the USB device.
Calls pBulkDosVol=dosFsDevInit("/ud0/", pButkBlkDev, NULL); installs the DOS file system. [page]
(4) Function to load image files from USB flash drive
Design USBDLoad() to implement VxWorks image file loading from USB flash drive. The USBDLoad() function mainly includes the following statements:
Modify the bootLoad function in the bootConfig.c file to add support for booting from a USB flash drive. Mainly add the following statements:
Recompile and link to generate a new bootrom.hex, burn it into the Flash on the board, copy the VxWorks image file to the USB flash drive, and insert the USB flash drive into the USB interface of the embedded host. During the startup process, the system will automatically load the VxWorks system image file on the USB flash drive to realize the USB flash drive startup of the embedded real-time system based on VxWorks.
copy"unixHost:/usr/wind/target/config/bspname/ vxWorks", "/ud0/vxWorks"
3 Summary
The embedded real-time system can be started from a USB flash drive on an embedded experimental board designed based on MPC860 and VxWorks. The significant advantages of starting an embedded real-time system from a USB flash drive are: convenient updating of system image files (replace the image file in the USB flash drive without re-burning); fast startup (fast USB interface transmission speed), applicable to a variety of real-time operating systems (the image file saved in the USB flash drive can also be developed and generated using other embedded real-time operating systems, such as PSOS, Nuclues, etc.); small requirements for the system's Flash storage capacity (the Flash mainly stores the Bootrom program, and the system image file is saved in the USB flash drive). Of course, in actual applications, the data collected by the embedded real-time system can also be saved to a USB flash drive, which can easily realize the sharing of embedded device and PC device resources.
Previous article:New Concept of Integration in Digital Video System
Next article:SOC platform construction and testing based on LEON open source soft core
Recommended ReadingLatest update time:2024-11-16 22:21
- Popular Resources
- Popular amplifiers
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- usb_host_device_code
- Image acquisition and processing system for panoramic map applications
- Design of permanent magnet synchronous motor control system based on VxWorks_Zhang Guilin
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
- Recruiting chip design director/engineer/intern
- [Popular Science] The difference between microwave radar sensing and human infrared sensing
- What is the difference between NFC and Bluetooth?
- A brief talk about RISC-V GCC: Linker script learning notes (Part 2)
- Dad’s logic: Buying a car is like finding a partner~~
- RF Energy Harvesting Technology
- PCB Design Issues
- if(struct2==&struct1){...} where struct1 and struct2 are two structures of the same type. What does this statement do? What function does it achieve?
- [Xingkong Board Python Programming Learning Main Control Board] Review 1. Unboxing and Experience
- 5050RGB lamp beads, 6 in parallel and 10 in series, how to draw the PCB board