Embedded Linux learning roadmap I am a university student at 1999, and my major is physics. When I was a freshman, the class was generally filled with anxiety about the future, and I didn't know what I could do after studying physics. Your present experience and present study will definitely affect your later life. After graduation, I also found my own job: going abroad for further study and switching to finance, staying in school to teach and do scientific research, designing chips, writing programs and starting a company. These are inseparable from the basic skills (mathematics, IT, electronic circuits) we learned at school and the self-study ability we honed.
So, you are confused students and programmers who want to change careers. There must be a place for you in the future. Whether it is good or bad depends on your efforts and accumulation now.
I can't predict what industry will be popular in a few years, and I can't guarantee that you will make a fortune by learning this article. I'm just a programmer with more than ten years' experience. If you are interested in programming, I'd like to give you some advice.
1. Three directions of programmers. Programmers can generally be divided into three categories: professional field, business field and operating system field. After getting to know them, choose according to your own interests.
I can't give advice on the professional field.
The business (i.e. the application) is not completely independent of the operating system:
(1) When developing physical products, people who write good applications sometimes need knowledge of the operating system, such as setting scheduling priorities, and knowing that certain functions may put the process to sleep.
(2) To be promoted as a system engineer, a person who writes an application program needs to know from top to bottom, and then needs to have knowledge in the field of operating system. How else can we design the whole system?
3 people who do applications need to understand the needs of the industry and understand the logic of the business. Therefore, people who are leaders are mostly applied. Once you enter an industry, it is difficult to change industries.
(4) In the field of operating system, this is killing all industries: he is only responsible for the underlying system, and what business he develops on it has nothing to do with him. Many people in this line are technical experts.
⑤ There is no boundary between operating system and business. Have experience in operating system, and then apply it. If you encounter problems, you will know the root of the system and have solutions. With business experience, you can learn the operating system again, and soon you can form a team to stand on your own feet. At least it is no problem to be a CTO.
1. 1 can be divided into the following two categories.
1. 1. 1 academic research
Such as voice, image processing, artificial intelligence, this kind of work requires you to have strong theoretical knowledge. I tend to think that such people are "scientists". They have studied for many years and often do academic research.
In the embedded field, some algorithm is needed to express their achievements and optimize some chips. This part of the work may be done by someone.
1. 1.2 engineering realization
Some people understand the concepts of these professional fields, but they have not delved into them. You can use all kinds of open source materials to achieve a certain goal and make products. For example, image processing, he knows how to use hundreds of complex functions in opencv to realize avatar recognition. Sometimes these functions can be optimized according to the specific chip.
"Professional field" is not my cup of tea. If you want to do this, I think the best way to get started is to study postgraduate and doctoral courses at school.
1.2 business areas, in other words, applications, can be divided into the following two categories.
1.2. 1 interface display
Of course, you need a good interface to make products, but it doesn't mean it's unimportant, it has no development potential.
The hot words now are Android APP and IOS APP development. Don't be confused by the words Android and IOS. They are the same as VC and VB before, but they are just a set of GUI controls.
I hope I didn't offend you. I have my reasons.
A program needs a GUI interface, but the internal logic of the program is the core. The development tools of Android and IOS simplify the development of GUI for us, provide the interaction mechanism of these controls, and encapsulate and provide some services (such as network transmission). But the business logic inside the program, the processing of video images and sounds, etc. , are the core. In addition, don't forget the background programs on the server side: how to save data more safely, protect customer privacy, how to handle millions of concurrent accesses, etc. These are also the core.
However, Android and IOS apps get started quickly! If you are a senior and are eager to find a job, it should be easy to find a job if you spend 1 or 2 months studying Android or IOS. After all, the demand for APP is always the biggest, and now these two technologies are still relatively hot. Around 20 1 1 and 20 12, the starting salary of Android programmers was quite high, and then it began to decline. The basic entry time of Android APP is only 1 month, so more and more people know it. 20 13, 20 14, the salary of IOS development is obviously higher than that of Android, so various IOS trainings are also exposed. There has always been a shortage of fast-paced talents in China. It is estimated that IOS engineers will also be the price of cabbage for some time.
Understanding Android and IOS is only a basic requirement. If you don't believe me, go to 5 1job to search for Android or IOS, and other requirements will be affirmed in the job requirements.
1.2.2 business logic
For a simple example, to make a punch card software, you need to consider these things:
(1) The normal process is to clock in at work.
② What if someone forgets? Record it as an exception and push it to the administrator.
(3) How to deal with leave?
4 how to deal with overtime?
Let's take another complicated example. In the video conference system, you can't figure out how to connect various modules and how to be compatible with various protocols without going deep into the industry.
Application development jobs are always the most, and the entry threshold is low. Basically, as long as you can speak C language and behave properly in the interview, the general company will give you a chance. Because:
After entering the company, you need to receive retraining: be familiar with their business logic.
What you have to do is basically a module, and the framework has been set for you. You can just fill in the code.
Tell me one thing that makes you happy: in software companies, leaders are basically writing applications (and of course marketing). People who write applications can study the market externally, receive customers, and manage programmers to complete development internally. Who can do it without him as the leader?
If your ambition is to write an application, then I suggest you practice the basic skills first: data structure and algorithm are necessary, and then choose database and network programming according to your own interests for in-depth study.
Finally, choose the industry you are interested in and plough deeply for 10 years. People who do application development choose a certain industry, and it is difficult to change industries in the future. Route selection is very important!
UCOS is too simple in the field of 1.3 operating system, VxWorks is too expensive and professional, Windows doesn't play embedded system, and IOS is not open source, so it can only play Linux in the field of operating system.
Linux is the only one in embedded field!
What about Android? Like QT, Android is a GUI system. It's just that Google's strength is too strong, and now Android is everywhere, so many times Linux+ Android has become standard. Note that what we care about here is the whole system and mechanism of Android, rather than learning several APIs and developing interface programs. The content contained in the field of operating system is simply to make a special "computer" with a good system, which can be divided into:
① Plan the hardware for the product:
According to the demand, performance and cost, the main chip is selected and matched with the peripheral equipment, which is designed by the hardware developer.
(2) Make and install the operating system and write the single board driver.
③ Customize system schemes such as maintenance and upgrade.
④ GUI systems such as Android can also be configured and installed:
⑤ Configure the development environment for application developers.
⑥ Solve problems from a system perspective.
This field is usually called "underlying system" or "driven development".
First, solve two common misunderstandings:
Is this job a write driver?
Looking at the six points listed above, it should be said that it includes driver development, but it is far more than driver development.
② Do we still need to write drivers? Is there no original factory? Or just need to change?
It is often said that the original chip works well, so just bring it and change it. If your hardware is exactly the same as the original board, the original source code is BUG-free, and you don't want to optimize performance, cut costs and make some distinctive products, then this statement is correct.
But is it possible in this age of innovation or death? ! There are two reasons:
(1) Even if only the code is modified, the premise of modification is understanding; The best way to understand this is to write a few drivers from scratch.
② In many cases, the system needs to be deeply customized.
In the past, MediaTek mobile phones could be shipped just by changing the interface, but now the cottage factories have fallen in batches. When everyone uses the original plan without modification, they can only fight for the cost in the end.
For example, there are two manufacturers of traffic cameras and surveillance cameras in Shenzhen, and they asked me to do four projects:
① Improve the driver performance of SD card provided by the manufacturer and use DMA.
② After changing the Flash model, the system often has problems and needs to modify the driver BUG.
③ The touch screen was clicked incorrectly, and the reason was found. It was later found that it was caused by bypass capacitance.
(4) Cost reduction: 4 DDR blocks are replaced by 2 DDR blocks, which requires bootloader to change the initialization of DDR.
These items are very urgent. If we can't deal with them, we can't deliver them. Why not find the original factory at this time? Unless you are a big customer like ZTE Huawei, who cares about you?
When I was working in ZTE, I actually spent very little time writing drivers, and I spent most of my time debugging: system tuning and helping APP engineers and hardware engineers find problems. Many of the source codes we get from manufacturers and online are standard, and of course they can also be used directly. But it may be better to optimize your product. For example, we can combine the camera driver and DMA driver, and send the camera data directly to DSP through DMA. We can act as a bridge between software and hardware. For physical products, there may be problems with software or hardware, and it is easier for general bottom-level system engineers to find problems.
When there are problems in software and hardware applications that they can't solve, give them advice and tools from the perspective of the underlying software. Another example is scheme selection: whether the chip performance can reach the standard, whether the available BSP is perfect, etc. This can only be considered by the person in charge of the whole scheme, who must know the bottom.
In the field of operating system, there are many requirements for knowledge:
(1) Understand the hardware knowledge and the circuit diagram.
(2) Good command of English to read the chip instructions.
③ Ability to write and transplant drivers.
(4) have a certain understanding of the operating system itself, can solve all kinds of difficult problems.
⑤ Understand the internal mechanism of Android.
⑥ Know assembly, C language, C++ and JAVA.
It is definitely a big pit. People who have no interest and perseverance should choose carefully.
It takes more than half a year to get started in this business, even if you study all day.
2 its status is definitely not as good as APP.
And you don't have 1 or 2 years experience. After you were hired by the company, you started to make apps.
The advantages are:
1 if you learn well, the industry will kill you. If you want to pack it, you can pack it; If you want to make your own products, make your own products.
Compared with the applicants, they will not be forced to work overtime every day by the ever-changing needs.
The threshold is high, and of course the salary is relatively high.
In the field of operating systems, I think it is suitable for these people:
(1) If a hardware engineer wants to switch to a software engineer, it will be better to start with the underlying software.
(2) MCU engineer, want to upgrade. People who know the bottom layer of Linux will certainly know the single chip microcomputer, but those who know the single chip microcomputer may not know Linux.
Students with plenty of time: If you are a sophomore or junior, it is good to spend the first half of the year learning the underlying embedded Linux.
4 people who want to master the whole system, for example, if you write an APP in the company, but want to be promoted to a system engineer, then you have to learn at the bottom.
⑤ Engineers who want to start their own businesses and make physical products don't need to learn any technology if you have money, but if you don't have money and want to make products, then the bottom of Linux has to learn.
6 people who do Linux APP, right, have to learn.
This part of people don't need to delve into it, just know about it: bootloader is used to start the kernel, the file system of Linux (what is the 1 program, what is the directory used for), the calling relationship between APP and driver, and the tool chain. These concepts are enough.
This paper discusses how to learn embedded Linux+Android system by default.
1.4 What does the embedded Linux+Android system contain? Don't worry, just give an example.
Who displayed those interfaces when the computer was turned on?
It's BIOS What does it do? Some self-check, and then read windows from the hard disk and start.
Similarly, this BIOS corresponds to the boot loader in embedded Linux. This bootloader will refresh to read the Linux kernel and start it.
② What is the purpose of starting windows?
Of course, it is to run an application to chat online.
Where are these online programs and chat programs?
On disk c and disk d.
Therefore, windows must first identify drive C and drive D. We call it the root file system under Linux.
(3) ③windows can recognize drive C and drive D, so it must be able to read and write hard disks.
This ability is called driving force. Of course, not only hard disk, but also network card, USB and other hardware. Embedded Linux can read and execute applications from Flash, and it must be driven by Flash, not just Flash.
Simply put, the embedded LINUX system consists of five blocks: bootloader, kernel, driver, root file system and application program. And applications, we can be divided into: C/C++, Android.
Therefore, the embedded Linux+Android system includes the following six parts:
① Boot loader
②Linux kernel
③ Driver
④ Application programs written in C/C++
⑤ Android system itself
6.⑥ Android application
There is such a great connection between Android and Linux, and its application is so extensive that there is no reason to stop learning Android after learning Linux. In most smart devices, Linux operating system is running; It either has Android installed or can be interconnected with Android phones. Now, Linux+Android has become a standard.
2. How to learn the embedded Linux operating system This paper assumes that you are zero-based and practical, so that you can get started in the fastest time; I will also attach some materials that I can refer to when I want to study in depth.
In practical work, we are developing around the "operating system", and we will not study and modify the operating system itself too deeply.
① The operating system has the functions of process management, storage management, file management, device management, etc. These core functions are very stable and reliable, and basically we don't need to modify the code. We just need to improve the driver for our own hardware.
② Learning drive will definitely involve other knowledge, such as warehouse management and process scheduling. When you deeply understand the driver, you will also deepen your understanding of other parts of the operating system.
③ Most of the codes in the Linux kernel are device drivers, and it can be considered that the Linux kernel is composed of various drivers.
However, to become a master in this field, we must deeply understand the Linux operating system itself and study its source code.
After busy work and leisure, you can read these books:
(1) Zhao Jiong linux kernel full notes, relatively thin, recommended. Later, a full analysis of Linux kernel was published, which was too thick. If you don't like it, forget the front.
(2) The Scene Analysis of LINUX Core Source Code by Mao and Hu, which is divided into two volumes, is extremely thick. Think of it as a dictionary: if you want to understand something deeply, just read a chapter.
There are many other good books, but I haven't read them very much and I don't have any more suggestions.
For the purpose of quick entry and introduction, you don't need to read the above books first, but learn according to this article first.
2. 1 Getting Started Roadmap Assuming that you are zero-based, we have planned the following getting started roadmap. The previous knowledge is the basis of the later knowledge, so it is suggested to study in order. Each part does not necessarily need to be thoroughly studied, which will be described in the following chapters.
2.2 Basic knowledge before learning drive 2.2. 1 C language
As long as they are in science and engineering, it seems that they all teach C language. I've met many people who got 90, 100 in the C language test, and they become stupid as soon as they get on the computer. I suspect that they have written programs on computers.
No matter how good the theory is, if you can't work without practice, why should the company hire you?
On the other hand, to learn C language from practice, we must practice, write and write!
When you master the basic grammar, you can practice some C language exercises on the computer.
When you have written several C programs, you can enter the next stage of bare-metal development.
(1) need not be too deep.
As a quick start, as long as you can write "Hello, world!" I can write bubble sorting and do some basic grammar operations, which is enough for the time being.
Pointer operation is the key point, practice more;
You don't need to learn too much knowledge of data structure, just master the linked list operation, and you don't need to learn anything else, such as queues and binary trees. You don't need to learn any function usage, such as file operation, multithreading programming, network programming, etc. This knowledge will be used when writing Linux applications, but it is not needed when the operating system drives learning!
Go forward forever, and we will come back to study when we encounter C language problems that we don't understand.
In the subsequent "bare-metal development", you will continue to practice C language, which will be more practical.
C language is extracted from writing code.
② You can study under Visual Studio or Linux. The latter needs to master some compilation commands. We don't offer C language courses for the time being. Find a book in C language, find a free C language video on the Internet (mainly to see how to build an environment), and you can teach yourself.
2.2.2 basic operation of PC Linux:
For PC Linux, we recommend Ubuntu, which is very easy to install software on.
Our working mode is usually like this: read and write code under Windows, and then upload the code to PC Linux for compilation. In fact, Ubuntu's desktop system is already very easy to use, and we can get started with all kinds of smart phones quickly. I believe Ubuntu's desktop system can also help you get started quickly. In order to improve work efficiency, we usually use the command line to operate Ubuntu.
Don't worry, you just need to master these orders in the early stage. They are very simple, and I simply list them:
①cd: change directory (change directory)
Cd directory name? //Enter the directory cd..// cd "Two Points": Return to the previous directory cd-// cd "Short Horizontal": Return to the previous directory.
②pwd: print the working directory (print the current directory and display the absolute path of the current working directory).
③mkdir: make a directory (create a directory)
Mkdir abc // Create folder abcmkdir -p a/b/c // Create folder A, then create folder B under A, and then create folder C under B.
④rm: Remove (delete directory or file)
rm? File//delete file rm -rf dir named file? //Delete the directory named dir.
⑤ls: List (list the contents of the directory)
⑥ Installation: Installation
mount -t nfs -o nolock,vers = 2 192. 168. 1. 123:/work/NFS _ root/mnt mount-t yaffs/dev/MTD block 3/mnt
⑦chown: Change the owner (change the owner of the file, that is, the owner).
chown book:book /work -R? //For the /work directory and all its contents, the owner is changed to book user, and the group is changed to book.
⑧chmod: Change the mode. The following example is very simple and rude.
chmod 777 /work -R? //For the /work directory and all its contents, the permissions are changed to readable, writable and executable.
The most commonly used editing command under Linux is slightly complicated to use. Please search for usage yourself.
To practice these commands, you can enter the Ubuntu desktop system, open the terminal and enter those commands; Or practice after logging in to Ubuntu remotely with tools such as SecureCRT and putty.
Hardware knowledge
The purpose of learning hardware knowledge is to understand schematic diagram, communication protocol and chip manual. I don't want to design a schematic diagram, let alone a circuit board.
For the orthodox method, you should learn like this:
(1) Learn the principle of microcomputer, and understand the composition of a computer and the interaction principle of various components.
② Learn digital circuits, understand the principles and uses of various gate circuits, and master some logical operations (AND, OR, etc.). ).
(3) Analog circuit? I don't need to learn this. At least I don't need it at work. Now I forgot all about it.
In my personal experience, these courses are useful, but:
The principle is useful, but it is not practical.
For example, the principle of microcomputer is based on x86 system, which is quite different from ARM board, and of course the principle is the same.
I didn't understand these courses until I came into contact with embedded programming.
(2) Every book is so thick and contains a lot of content, and the study time is too long, so it is difficult to learn by yourself.
In view of the shortcomings of these campus textbooks, combined with the knowledge points to be used in the actual development process, we have launched a series of videos entitled "How to read the schematic diagram before school":
Preschool 1 Paragraph 1 What do you think of the gate circuit of GPIO and schematic diagram? Wild mumps virus
Preschool 1 Section 2. 1 _ What do you think of schematic protocol interface UART.wmv?
Preschool 1 Section 2.2 _ Schematic Protocol Interface I2C.wmv What do you think?
Preschool 1 Section 2.3 _ Schematic Protocol Interface SPI.wmv What do you think?
Preschool 1 Section 2.4 _ What do you think of the schematic protocol interface NAND Flash.wmv?
Preschool 1 Section 2.5 _ Schematic Protocol Interface LCD.wmv What do you think?
What do you think of the memory interface such as preschool 1 section 3 _ _ schematic diagram? Wild mumps virus
Pre-school 1 Section 4. 1 What do you think of the schematic diagram analysis S3C24 10 development board? Wild mumps virus
Preschool 1 Section 4.2 _ How to read the schematic diagram and analyze S3C2440 development board? Wild mumps virus
Pre-school 1 Section 4.3 _ How to read the schematic diagram analysis S3C64 10 development board? Wild mumps virus
Even if you only have circuit knowledge in junior high school physics class, I hope you can learn about schematic diagrams and some common communication protocols through these videos. If you want to master more hardware knowledge, these videos can also be used as an index to let you know what knowledge you lack.
The hardware knowledge mentioned in these videos will be used in the "bare board development" series of videos, and then everyone can look at each other and get to know each other better.
2.2.4 Want to learn the development of single chip microcomputer under Windows?
Many schools have set up single-chip microcomputer courses. Many people started with 5 1 single chip microcomputer and AVR single chip microcomputer. At present, the relatively new STM32 single chip microcomputer has begun to contact the embedded field, using development software under Windows, such as keil and MDK.
The question is coming, do you want to learn the development of single chip microcomputer under Windows?
If this is a required course for your major, go and learn it.
If your major is closely related to single-chip microcomputer, such as mechanical control, then study it.
(3) If you just want to get started with MCU and then learn more embedded Linux, then give up learning MCU under Windows!
The reason for this is the following:
① The study of single chip microcomputer under ①Windows is not deep enough.
There are very good graphical interface MCU development software under Windows, such as keil and MDK.
They encapsulate many technical details, such as:
You can only write the code of the main function, but you don't know how the 1 code is executed after power-on;
You can write an interrupt handler, but you don't know how it is called.
You don't know how the program is read into memory from Flash;
I don't know how the memory is divided and used. I don't know where the stack is and where the pile is.
When you want to cut programs to reduce the use of Flash and memory, you have no way to start;
When you create a new file, it is automatically added to the project, but you have no idea of the mechanism.
Wait, wait, wait.
② Bare-metal learning based on ARM+Linux can make you learn more deeply, which is more suitable for subsequent Linux learning. In fact, it is the single-chip learning under Linux, but everything is primitive: all the codes need to be written by themselves; Which documents are added to the project need to be managed by yourself.
At work, of course, we tend to use more convenient tools under Windows, but in the learning stage, we should learn the essence of the program.
We can learn more by writing and managing the code from scratch:
You need to know the power-on and start-up process of the chip and how the 1 code works.
You need to know how to read programs from flash memory into memory;
Need to know how memory is planned and used, such as where the stack is and where the heap is;
Need to know about code relocation;
Need to know how to protect the scene, jump to the interrupt entrance, call the interrupt program, and restore the scene after the interrupt occurs;
You will know that the main function is not the 1 th function we wrote;
You will know how the program is executed from the time the chip is powered on.
You will know how the parameters are passed during the function call;
You will know that when an interrupt occurs, the value of each register should be treated with care;
Wait, wait, wait.
You have mastered the bare-metal development of ARM+Linux, and then go back to the single-chip development under Windows, and you will exclaim: How simple! And you will fully understand the technical details that these tools don't show you.
Driver =Linux driver software framework+hardware operation of +ARM development board. We can start with simple bare-metal development and master the hardware operation first, or we can:
① Master how to compile programs under PC Linux and burn them to the board to run.
② Lay the foundation for learning bootloader: After mastering various hardware operations, the latter combination is bootloader.
2.2.5 why choose the ARM9 S3C2440 development board instead of other development boards with better performance?
There is a wrong concept: S3C2440 is out of date and ARM9 is out of date.
This is not right. If you are a software engineer, it makes no difference to us whether it is ARM9, ARM 1 1, A8 or A9.
A chip with CPU on it, and many devices (such as UART, USB, LCD controller) on the chip. When we write programs, we don't involve CPU, but only operate those on-chip devices.
So: the difference lies in the on-chip device, not in the CPU core; The difference lies in the different register operations.
Because our write driver does not involve the core of CPU, it only operates devices other than CPU and only reads and writes the registers of these devices.
S3C2440 is recommended, because it has the most abundant learning materials on Linux, with supporting videos of 1 and No.2. ..
2.2.6 How to learn the bare-metal development of ARM+Linux?
Learning bare metal development has two purposes:
① Master the bare-metal program structure to prepare for the subsequent u-boot.
② Practice hardware knowledge, that is, how to read schematic diagrams and chip specifications, and how to write codes to operate hardware.
The latter u-boot can be regarded as a collection of bare-metal programs. We can master all the components one by one in bare-metal development, and then assemble them to get a u-boot.
Subsequent driver development also involves hardware operation. Bare metal development can learn hardware knowledge.
Note: If you don't care about the program structure of bare metal and the implementation of bootloader, you can skip this part first. In the following driver video, we will also re-explain the hardware knowledge involved.
Two books are recommended: ARM Architecture and Programming by Du Chunlei, and Embedded Linux Application Development Complete Manual by Wei Dongshan. The latter may be a 1 book on ARM bare-metal programs developed in domestic PC Linux environment. If I am wrong, please forgive me for reading less.
For bare-metal development, we provide two videos:
① Environmental construction
Lesson 0 Section 1 _ The interface wiring just hit the development board. Wild mumps virus
Lesson 0, Section 2 _ Writing Bare Board Programs for Newly Developed Boards. Wild mumps virus
Lesson 0 Section 3 _ Reburning the whole system immediately after touching the development board. Wild mumps virus
Lesson 0, Section 4 _ Using the new vmwae and ubuntu.wmv added by the development board.
Lesson 0, Section 5 _ Patching, compiling and using u-boot, which is new to the development board, to build the sourceinsight project. Wild mumps virus
Lesson 0 Section 6 _ Patching, compiling and using u-boot, just touching the kernel of the development board, building the sourceinsight project. Wild mumps virus
Lesson 0, Section 7 _ Making the root file system and boot driver of the development board. Wild mumps virus
Lesson 0 Section 8 _ Building a Video System on TQ2440 and MINI 2440. Wild mumps virus
Lesson 0, Section 9 _win7 cannot use the alternative method of dnw burning. Wild mumps virus
.................
Original link: Web page link