Yesterday, I saw an interview article in programmer. Meng Yan interviewed Chen Rong of the century of koteté on 3G mobile phone software. After reading this, I felt that Chen Rong had never done any mobile phone software. In fact, it doesn't matter if I don't know why. However, I am very disgusted with Chen Rong's pull of "Longhorn" and "metedata" and "the direction of software development is coming soon from Microsoft. I want to talk about the mobile phone software I know.
1. operating environment of Mobile Phone Software
1.1 Overview
Mobile phones can be seen as pocket computers. It has CPU, memory (flash, Ram), input and output devices (keyboard, display, USB, serial port ). It also has a more important I/O channel, that is, the air interface. The mobile phone can communicate with the base station through the air interface protocol (such as GSM, CDMA, and PHS), which can both transmit voice and data.
The CPU of a mobile phone is generally not an independent chip, but a unit of a baseband processing chip, called a CPU core. The baseband processing chip is the core of the mobile phone. It not only contains the CPU core and DSP core, but also contains the communication protocol processing unit. The communication protocol processing unit and mobile phone protocol software work together to complete the communication functions required by the air interface.
With the continuous development of chip technology, more and more peripheral circuits can be integrated into Baseband Processing Chips, such as BAP, or baseband analog processor. In this way, the smaller the mobile phone, the lower the cost.
1.2 single CPU and Dual CPU
Many mobile phones only have one CPU, that is, the CPU core in the baseband processing chip. On this CPU, you need to run the communication protocol and implement the user interface (UI ). DSP will share some heavy workload, such as speech codec and Security Layer algorithms.
Driven by the market, mobile phone functions are constantly evolving. Camera, MP3, and Bluetooth functions can rely on hardware, but the CPU pressure is not great, but Java virtual machine, embedded browser and other application software will have high requirements on CPU resources.
The first task of a single CPU is to complete the communication protocol. Communication protocol software has precise timing requirements. If the CPU needs to take into account a lot of application software, it will inevitably be difficult. As a result, dual-CPU mobile phones emerged.
As the name suggests, a dual-CPU mobile phone has two CPUs. One CPU is dedicated to the communication protocol, and the other CPU is responsible for UI, Java virtual machine, embedded browser, and other applications. The two CPUs can be either made in one chip or separated.
The actual situation on the market is that many cell phone design companies do not have the development capability of Baseband Processing Chips. they purchase mobile phone modules of foreign companies and add a CPU to them. The module runs the communication protocol, and the self-added CPU runs the UI and application software. The two communicate through a serial port. Of course, there are also many design houses that buy the development board-level solutions of foreign providers and make their own PCB. The software mainly changes the UI and peripheral drivers.
The smartphones on the market are basically dual-CPU solutions. Windows CE, smartphone, Windows Mobile, Symbian, and embedded Linux are all running on the second CPU. These commercial operating systems cannot be integrated with wireless communication protocol software into a single CPU. Dual-CPU mobile phones provide rich functions, but they are generally large in size, consume a lot of power, and have high costs. Most mobile phones on the market are still single-CPU.
Currently, most mobile phone applications, such as Java, brew, WAP, mail, camera, flash memory, MP3, and Bluetooth, can be implemented in a single CPU solution. I think no matter how 3G or 4G is developed, the small, practical, and low-cost single-CPU solution will always occupy a large market share. Microsoft has no foothold in the single-CPU mobile phone market. How can we get started?
This article mainly introduces a single-CPU mobile phone, most of which also applies to the Communication Section of the dual-CPU solution.
1.3 3G and 4G
3G and 4G refer to the third-generation and fourth-generation wireless communication technologies. for mobile phones, they improve the efficiency of air interfaces, and air interfaces can transmit data with greater bandwidth. Wireless Internet access through mobile phones is faster. This is not directly related to the voice service and mobile app.
Of course, the embedded data service of mobile phones will have more possibilities due to higher bandwidth. However, the realization of these possibilities is still subject to the slow input of mobile phones, small display and other conditions.
2. Composition of Mobile Phone Software
2.1 Overview
Mobile phone software and PC software start from the interrupt vector table, because it is relatively small, it looks clearer. The first jump command of the interrupt vector table is of course the jump to the reset processing program, followed by the jump command for Interrupt Processing and error processing. When the device is powered on, the phone jumps to the reset handler, checks the memory, initializes the C runtime environment, and creates the first task. This task creates and starts other tasks in order. The vast majority of Mobile Phone programs are multitasking, but some PHS protocol stacks are single-task and have no operating system. Their main programs call the processing programs of each software module in turn, simulate a multi-task environment.
Mobile phone software can be roughly divided into startup modules, operating systems, protocol stacks, data services, local storage, drivers, user interfaces, and other applications. The startup module has been mentioned earlier. The following describes other sections.
2.2 Operating System
The operating system accounts for only a small portion of mobile phone software. Its main function is to provide multi-task scheduling and communication mechanisms. Some operating systems provide dynamic memory allocation and timing functions, but these are not necessary. For example, a module that requires dynamic memory allocation can manage a memory pool by itself, making it easier to isolate modules and predict memory requirements.
Most mobile phone operating systems are very small kernels, such as Rex and hios. The source code of Qualcomm Rex can only contain more than one thousand lines of C code and assembly. After compilation, it is only 2 or 3 K of code. The complete mobile phone program usually has 3 or 4 hundred C files, with over 1 million lines of code.
2.3 protocol stack
Protocol Stack is the most complex part of mobile phone software. Its Complexity lies in its close relationship with the design of baseband processing chips. Only enterprises with chip design capabilities can develop protocol stacks. The protocol stack uses baseband to process all the resources of the chip, including the DSP core.
2.4 Data Services
There are two main types of data services: in the former, a mobile phone is equivalent to a modem. a pc accesses the Internet through a mobile phone, and the network protocol is all on the PC. A mobile phone provides a data link. The other is the embedded data service. The mobile phone contains TCP/IP, PPP, and other protocols. Sometimes, HTTP and embedded browsers are required, so you can access the Web or WAP network without a PC.
2.5 Local Storage
Mobile phones all have local storage functions, such as the phone book, short messages, and user settings. Generally, mobile phones have a flash-based file system. Early mobile phone storage was based on EEPROM.
2.6 driver
Hardware drivers generally refer to peripheral drivers, but some devices are integrated into the baseband processing chip. Drivers include: keyboard, power management module, LCD, Flash, RTC, serial port, USB, SIM card or uimcard, RF driver, etc.
2.7 user interface
A User Interface (UI) is also called a human-machine interface (MMI). It interacts with users and calls functions of other modules when necessary. In addition to the features required to process mobile phones, the user interface also contains some relatively independent applications, such as calendars and games. Artist design is also an important part of user interface design.
2.8 other applications
Other applications include Java virtual machine, WAP browser, and mail software. They are relatively large and relatively independent application modules.
Basically, the lecture is complete. You must have read it. What is the relationship between these programs and Microsoft's Longhorn and metedata? The vast majority of Mobile Phone programs are written in C language and there are very few compilations. Programmers who work as application software must have the ability to think in object-oriented and design patterns, and then use the C language to implement it :)
Qualcomm's brew uses the C language to imitate C ++, making many strange macros. Generally, application software development is not so rigid, but it is necessary to understand various software design methods.
3 core mobile phone technology
The core technologies of mobile phones are chips and protocol stacks, which are inseparable. The chip design requires protocol stack verification, and the protocol stack must make full use of the chip function. The CPU core and DSP core of the chip can be purchased as ready-made units, but the communication protocol must be designed by yourself. What is more difficult for mobile phones is power consumption and performance in harsh signal environments.
4. Third-party software
4.1 Introduction
The software mentioned above is all parts of a complete program. These parts are compiled together to generate a binary file and downloaded to the flash of the mobile phone through the JTAG port (serial port can be used during upgrade. When the phone is powered on, it starts to run from the specified address. The content of this address is the jump command to jump to the reset handler. Haha, let's go back.
Third-party software allows mobile phones to download executable files to the file system through data lines or networks. Then there is a loader that can load and execute these files. In this way, the third party can develop some applications and download them to the mobile phone to expand the mobile phone function.
These executable files are in two formats: Java program and brew program. Java programs must be loaded and run on the Java Virtual Machine. The Brew program is a strange thing. It is actually the target Code Compiled by the same compiler as the mobile phone program. These target codes must be relocated, that is, they cannot contain global or static variables.
The loader passes the execution permission of the program to the brew program. It sounds safer to call the entry function of the brew program. The position of this entry function is fixed in the brew program. The loader will input an address when calling the entry function of the brew program. Through this address, the brew program can find the addresses of various APIs provided by the system. It uses these APIs to access the display and communication functions of mobile phones.
Java programs are basically platform-independent. Java virtual machines designed for various platforms isolate most of the features of the platform, except for some OEM functions provided by manufacturers. The Brew program is obviously related to the platform. If you change the CPU, you do not know the original target code.
4.2 others
In addition to Java and brew, commercial operating systems such as Windows CE, smartphone, Windows Mobile, Symbian, and embedded Linux can certainly provide various methods to create third-party programs. Writing programs in these environments is very similar to writing programs on the PC platform. Basically, I cannot understand the characteristics of embedded programming, but the screen is smaller and the input is troublesome.
These third-party software are not required. Mobile phones only account for a small portion of the 3G market, and the network is the largest. Compared with mobile phones, third-party software accounts for a smaller share.
Programmer has a column on embedded mobile development. He is always talking about the development of these third-party mobile phone software. In fact, mobile phone software is only part of embedded software. What proportion does third-party software account for in embedded mobile development?
The above is my understanding of mobile phone software. The rest of my life is also late. I have limited knowledge. I hope you can give some advice.
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.