There are shortcuts to porting embedded systems with Wince BSP

Source: Internet
Author: User

[It168]Recently, the company asked me to take charge of a development project for Embedded consumption products. The original operating system of this product is wince 5.0. In response to market requirements, we need to not only add more powerful hardware, but also upgrade the operating system to wince 6.0. After taking over the project, I immediately started the customized development of the operating system, but the results were not satisfactory.

Later, when I reflected on the multiple factors of time and cost, I found that I had made a fatal mistake to bring products to the market faster, during the development process, the operating system should be transplanted rather than customized. Based on my experience and summary in this project, This article first analyzes the importance and impact of BSP Transplantation on wince, then, we will discuss the porting process of BSP through transplantation of bootloader, oal and driver.

What is a port transplant to the Windows Server (wince) operating system?

(1) Why port the operating system?
At present, embedded systems have become more and more widely used. embedded products are filled with many fields, such as mobile phones, MP4, and PDAs, which are typical embedded systems. With the changes in technology and consumer demand, even the same type of embedded products will also have changes in the hardware platform, or there will be upgrades of the software platform. Therefore, in order to quickly adapt to market needs, the actual development process is more inclined to transplant the operating system rather than re-develop the operating system. This not only saves time, but also greatly improves development efficiency.

Because the embedded system is closely integrated with hardware and software, operating system transplantation involves two layers of work: one layer is the CPU level, and the other layer is the board level. Since the wince operating system is almost completely written in C language, it can be transplanted to many 32-bit microprocessor. These include arm, x86, MIPS, and shx, and CPU-level porting is usually done by Microsoft or chip manufacturers, this greatly reduces the workload of Porting operating systems during the development of 0em vendors, but board-level porting still needs to be done by OEMs.

Generally, a wince system consists of four layers: application, WinCE kernel image, board-level support package (BSP), and hardware platform. The basic software platform consists of the kernel image of the wince System and the card support package (BSP. Because the wince system is closely integrated with hardware and software, even if the CPU processor is the same, but if the peripheral hardware on the Development Board is different, you still need to modify the BSP to complete a new BSP. In other words, the porting process of Wince is mainly to rewrite BSP.

(2) What is board-level BSP port?
Generally, it takes a long time to develop and customize the wince BSP from scratch. The BSP custom development accounts for a large proportion of the entire embedded product development time. Therefore, rapid BSP transplantation is a shortcut to adapt to the fierce competition in the market environment. BSP (board support packet-board support package) is an underlying software development kit between underlying hardware and upper-layer software. Its main function is to provide a unified interface for the upper layer, at the same time, various underlying hardware differences are shielded and the drivers and hardware drivers of the operating system are provided. In short, BSP contains all the hardware-related code and provides hardware platform independence for the operating system. Therefore, the BSP system can be used to connect the CPU Hardware System with the Windows CE software system.

We can see from the wince development documentation that BSP is a Startup Program bootloader, OEM Adaptation Layer Program (oal), Standard Development Board (SDB) and related hardware device drivers and configuration files. Bootloader is a program that runs after power-on. It can initialize hardware, establish memory space ing of the system, and prepare for the final call of the system kernel. It is mainly used to download and start the image NK. Bin. OAL logically resides in the Code layer between the Windows CE kernel and the target device. OEMs use the code to adapt wince to their own hardware; physically, oal is connected to the kernel library to generate kernel executable files. OAL simplifies the communication between the operating system and the target code. oal code is used to handle interruptions, memory, power management, and general I/O control. Finally, the device driver is the local driver and the stream interface driver. Volume loading, such as NIC, sound card, USB, etc.

Procedures and steps for porting wince BSP

From the previous analysis, we can see that the focus of porting the wince system is the migration of BSP. BSP transplantation mainly includes the boot program bootloader, the OEM Adaptation Layer Program oal, the standard Development Board (SDB) Local driver, and some file configuration modifications. The following are the main content and procedures for porting wince BSP:

(1) Procedures for Bootloader migration
Modifying bootloader is the first step and the key step for porting the Win CE system. The transplantation of Wince BSP can be further completed only when a stable Startup Program is obtained. Bootloader is mainly used to manage the Startup Process of the target platform. It is a separate program code, through this applet, You can initialize hardware devices, create a memory space ing diagram, and download the image files of the operating system, so as to bring the system's hardware and software environment to a suitable state, it is generally stored in non-Easy loss storage media of the target platform, such as Rom or flash.

In general, the functions of bootloader vary greatly in different scenarios. For example, on a desktop Windows PC hardware platform, because the hardware is not started through bootloader (but through BIOS), bootloader does not need to perform any work on the initialization after CPU power-on; on the embedded wince platform, bootloader is the first program to be executed, so it must include the power-on initialization program. At the same time, bootloader usually must include the function of downloading the wince image document. Because bootloader involves basic hardware operations, such as the CPU Structure and commands, it also involves the Ethernet download protocol and image document format. Therefore, it takes a long process to implement from scratch. The common practice is to use a bootloader routine of a standard R & D board provided by Microsoft for each type of CPU.

Based on my experience in Porting this project, the main steps for porting bootloader are: ① modifying the corresponding Dir and source files; ② modifying makefile. INC; ③ modify boot. bib so that it does not match config. memory Allocation in bib results in conflicts. ④ it is to improve eboot because eboot burns NK. the binfs partition will be searched during bin, and the downloaded image will be burned to the binfs partition.

(2) Migration steps of oal
The full name of oal is the OEM adaption layer, that is, the adaptation layer of the original device manufacturer. It is a code layer between the Windows CE kernel and the target hardware platform. oal is mainly responsible for communication between Windows CE and hardware, it is related to core devices such as CPU, interrupt, memory, clock, and debugging port. It is also the Code of each oal module after being compiled (. link to other kernel libraries to form the Windows CE kernel executable document NK. the key of exe. To put it simply, oal is used to block the details of the CPU platform and abstract hardware functions, so as to realize the portability of the operating system kernel.

In terms of logic structure, oal is located between the kernel and hardware of the wince operating system and is the hub connecting the wince system and hardware. In terms of functions, oal is similar to the BIOS on the desktop PC, device initialization, operating system boot, and abstract hardware functions. However, unlike B10s, 0al is affiliated with the operating system and is part of the operating system.

From my experience in this project, the subdirectory of the Windows CE installation directory contains some source code of OAL. The oal porting implementation should be in the fwxsc1.s, Main. C, Flash. C, edeviceinit. C and other files, and the corresponding code can be modified as needed. During the oal porting process, we mainly modify these functions: Modify the startup. s function, modify the serial port debugging function, modify the oeminit function, modify the system clock function, and modify the interrupt processing function. In fact, in most cases, developers only need to modify the oal, and even do not need to modify it.
(3) driver porting and development
Device drivers is a piece of software module that can manage virtual or physical devices, protocols, services, etc. The operating system directly deals with hardware through drivers. The device driver can provide device control functions for wince, including LCD/led/VGA/svga display devices, mouse, keyboard, and touch screen. Based on my experience in Porting this project, we recommend that you use platform builder to create a new platform, and then insert and remove drivers based on the requirements of the hardware platform. In general, the files to be modified include platform. bib, platform. Reg, and driver source code.

(4) Modification of platform file configuration
The Platform configuration file includes the source code configuration file and the operating system image configuration file. The source code configuration file mainly refers to the paths required by the build tool, including the dirs file, sources file, and makefile files. Operating System Image configuration files are mainly used to generate operating system images for makeimag tools, including. bib,. Reg,. dat,. dB, and other files. Therefore, when porting BSP, you also need to modify and change the configuration files of these platforms.

(5) Notes for transplantation
Many embedded development practices prove that BSP porting is a complicated and cumbersome process. Because the organizational structure of BSP packages in different versions of Wince is different, many linked libraries cannot be found or these libraries have been replaced or deleted, the only method is to patiently locate and modify according to the error prompt.

For example, the memory address is involved in the process of downloading, burning, and starting the image during bootloader transplantation. Therefore, when processing various entry addresses, you should avoid errors or memory exceeding the range, be especially careful when handling address conflicts. Also, when porting oal, startup. S and oeminitdebugserial functions need special attention, because they are mainly used to initialize the hardware and serial port, the basis for system running and driver debugging. If the hardware configuration and debugging serial port are changed, you need to modify it as needed.

 

 

Source Address: http://tech.it168.com/a2009/0617/591/000000591093.shtml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.