USB boot technology for embedded real-time system

Publisher:WanderlustGlowLatest update time:2012-03-29 Source: 61icKeywords:USB Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:USB Reference address:USB boot technology for embedded real-time system

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

Design of underground micro-water detection system based on DSP
The micro-water test method is a method of instantaneously injecting or extracting a certain amount of water into a well, and obtaining the permeability coefficient of the aquifer near the well by observing the change of the well water level. For aquifers with high permeability, after instantaneously extracting or i
[Embedded]
【Arduino】Some notes on using USB-ISP to burn into bootloader
Preface: Since the working range of my first 3D printer was too small and it was a Delta structure, I was too lazy to modify it, so I simply redesigned a new machine with UM2 structure. Then when I downloaded the marlin2.X firmware, the mega2560 bootloader had problems, so I had to start studying how to burn the Ardui
[Microcontroller]
【Arduino】Some notes on using USB-ISP to burn into bootloader
[MCU][AT32][Filling the pit diary] [USB card package] Fast packet transmission during USB power-on causes card package to get stuck
Phenomenon: During the PC restart process, key data is continuously sent, causing the PC to fail to respond, resulting in the lower computer data being stuck. MCU sends 'B', PC displays 'C', MCU sends 'E', PC displays 'B' The reasons are as follows: The priority of the serial port peripheral is higher than the U
[Microcontroller]
[MCU][AT32][Filling the pit diary] [USB card package] Fast packet transmission during USB power-on causes card package to get stuck
Design of LPT-USB printer driver based on CH375
1 Introduction   This topic comes from Beijing Puji General Company. Since the company's existing stand-alone spectroscopic instruments (such as 1810 and T6, etc.) use parallel port printing technology, and with the gradual popularization of USB printer technology, there are fewer and fewer parallel port printers. So
[Microcontroller]
USB to serial communication in stm32f4USART
Beginner learning STM32, first contact with USART serial communication. A personal summary of the USART communication hardware principle. The TTL level from the MCU (Micro Controller Unit, also known as the ST chip) is converted to the USB level through a level conversion chip, thereby achieving communication with the
[Microcontroller]
Design Considerations for USB 3.0 Interface Applications
USB 3.0 is gradually becoming one of the most promising data transmission interfaces. Compared with USB 2.0, USB 3.0 is 10 times faster, up to 5.0Gbps; provides an asynchronous mechanism to send and receive data synchronously; and provides a power output of up to 900mA. New applications such as 3D cameras across lapto
[Power Management]
Design Considerations for USB 3.0 Interface Applications
S3C2440 USB bus driver analysis (XVIII)
As shown in the figure below, taking Windows as an example, if we plug in a USB without a USB device driver, you will be prompted to install the driver 1 Why does a prompt message appear as soon as the device is plugged in? This is because Windows comes with a USB bus driver. 2 The USB bus driver is responsible
[Microcontroller]
S3C2440 USB bus driver analysis (XVIII)
Audio system design based on intelligent interface
0 Introduction With the development of modern electronic technology, the development of interface technology is also becoming more and more rapid, and the USB interface has developed and grown in such a background. In the traditional hardware architecture, the interface is regarded as a part of the correspo
[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号