Before learning embedded Linux, you must have a C language foundation. It doesn't matter whether there is an assembly basis or not (just a few assembly instructions can be used at a glance).
To what extent should C language be learned? Of course, the more familiar, the better. If you are not familiar with it, you should also have basic skills. For example, write an array to sort, sum the input numbers and so on.
The only way to learn C language is to write more programs and practice more. It doesn't matter if there is a compilation error, you can solve it yourself. It doesn't matter if the execution is wrong, analyze it yourself. I used to use it.
In order to practice C language, VC often tries to write some C language contest topics. They are all topics of pure C, pure mathematics and pure logic, and there is no such thing as interface.
Perfect for honing your programming skills.
Back to the topic, first of all, we need to understand what your purpose is. Generally speaking, the so-called embedded Linux can be divided into two parts: the underlying system and application development.
If you want to do application development, then you should learn C language, data structure and JAVA well. Embedded application development and PC
There is nothing special to pay attention to in application development. Maybe you said you need to do some optimization on the embedded system. Yes, you need to optimize the program, but there is no optimization.
It is no different from the program development on PC. In addition, when you have the ability to optimize, you don't have to ask this question. For a specific example,
For example, to develop the interface, we use VC on the PC; Maybe we use QT or Android in embedded Linux. At this time you will learn QT.
Programming of Android. But the foundation is still C or JAVA, and you should be familiar with their interfaces on this basis. If you have studied VC, it takes time to understand it.
These classes and controls.
If your purpose is to learn the underlying system, this is my specialty, but you can say a little.
Before answering this question, I will answer: Many people ask me, is it learning-driven or learning application?
I can only say that I am interested, and the driver and application are not completely separated.
1. The driver we are talking about is not limited to the operation of hardware, but also includes the principles of operating system, sleep wake-up scheduling of processes and other concepts.
If you want to write a good application and solve the problems encountered in the application, you must understand this knowledge.
2. The application threshold is low, especially the current Android, pure JAVA. Personally, the development path of application is business proficiency.
For example, communication industry, IPTV industry, mobile phone industry, you know the needs of the industry. Therefore, people who are leaders are mostly applied.
3. Being a driver, in fact, I don't want to be called "being a driver", I want to be called "being a bottom system". If it does, it will kill all industries. I worked for several years,
I have done mobile phones, IPTV and conference TV, but these products make no difference to me, because I only do the bottom layer. Their business has nothing to do with me.
When there is a problem in the application and they can't solve it, I will give them advice and provide them with tools from the perspective of the kernel.
To be the development direction of the bottom, I personally think I am a technical expert.
4. In fact, there is no boundary between doing the bottom layer and doing the application. If you have the basic experience and then do the application, you will feel very practical.
With business experience, you can find out again and form a team soon.
Back to the question of how to study. What does the embedded Linux underlying system contain? Don't worry, just give an example.
1. 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.
2. What is the purpose of starting windows? Chatting online or something, of course. Where are these internet and chat tools?
Therefore, windows must first identify drive C and drive D. Under Linux, we call it the root file system.
3.windows can recognize drive C and drive D, so it must be able to read and write hard disk. This involves something called a driver. Of course, not only hard disk, but also network card, USB and so on.
Embedded Linux can read and execute applications from Flash, and it must be driven by Flash, not just Flash.
Let's stop here. Embedded LINUX includes four modules: boot program, kernel, driver and root file system.
First, bootloader:
This is a slightly complicated bare board program. But it is not easy to understand and write this bare board program well. Easy-to-use tools under Windows weaken our programming ability.
Many people use ADS and KEIL as soon as they play embedded. Can you answer these questions?
1.Where does the CPU get instruction execution when it is turned on?
A: Generally speaking, instructions are given from Flash.
2. But Flash can only be read but not written directly. If I use global variables, where are they?
A: Global variables should be in memory.
3. So who puts global variables in memory?
A: friends who have used ADS and KEIL for a long time, can you answer them? This requires "repositioning". In ADS or KEIL, the relocation code is written for you by the company that makes these tools.
Have you read it?
4. With such a large memory, how do you know where to read the "content originally stored in Flash" into the memory?
A: This address is determined by the "link script". There are scatter files in ADS and similar files in KEIL. But have you studied it?
5. You said that relocation means copying the program from Flash to memory, so that the program can read Flash?
A: Yes, you must be able to operate Flash. Of course, not only that, but also setting the clock to make the system run faster and so on.
Ask yourself first and answer here. Bootloader, a bare board program, actually has three main points:
1. Hardware operation
2. Understand the ARM architecture processor
3. Basic concepts of the program: relocation, stack, code segment, data segment, BSS segment and so on.
Hardware operation depends on the schematic diagram and chip instructions. This requires some hardware knowledge, not asking you to design hardware, but at least you can understand it; You don't need to understand analog circuits,
But you must be able to read digital circuits. This ability was learned at school, and two books (the title of which has been forgotten) are enough: Principles of Microcomputer and Digital Circuits. But I doubt whether you have patience.
I finished reading these two books. I wonder if there are any faster books now. To be quick, let go of this piece first. Ask Google if you don't understand, and post it.
In addition, the chip instructions must be read, not in Chinese, but only in English. It was painful at first, but later you will find that once you are familiar with the grammar and vocabulary,
It is easy to read any chip manual.
Look at Du Chunlei's: OK, there are assembly instructions, exception modes, MMU and so on. You only need to know three things.
The basic concept of the program, Wang Dao, of course, depends on the compilation principle. It's a pity that this kind of book is absolutely a gobbledygook. I advise you not to watch it unless you are a super genius. Look at what I wrote
& lt Complete Manual of Embedded Linux Application Development >: There is also 1 video, so don't worry, it doesn't cost money. According to the video, hardware-related experiments have been done, and these concepts are clear. I haven't
I found a second set of books or videos about these concepts, allowing me to brag once.
For bootloader, I read:, and then write my own program to do various hardware experiments, such as GPIO, clock,
SDRAM, UART, NAND. Make them clear, and it is easy to understand u-boot when they are combined.
To sum up, to understand the hardware schematic diagram and chip instructions, you need to find the information yourself. For the rest, just press: and video 1
Chapter catalogue. Go and study.
Second, the kernel:
People who want to be faster should learn how to write drivers directly and go beyond kernel learning.
To be a master, the kernel must have a deep understanding. Note that I am talking about understanding. I don't expect to write a kernel.
Need to understand the scheduling mechanism, memory management mechanism, file management mechanism and so on.
Recommend two books:
1. Read through; Look at the thin one (floating society emphasizes speed, hmm),
2. Selected readings: Want to know which section to study?
Third, the driving force:
The driver consists of two parts: the operation of the hardware itself and the framework of the driver.
Hardware is still the same sentence, you still have to understand the schematic diagram, read the chip instructions and practice more.
Speaking of driving framework, there are several books that can be introduced. LDD3, that is; A book written by a foreigner introduces many concepts and is worth reading. However, its role
It is limited to introducing concepts. It's basically used to familiarize yourself with concepts before getting started, but it's thrown away after getting started.
A comprehensive introduction of drivers should be from Song Baohua: Well, to be honest, I have only read the catalogue, and many people say it is good, so I recommend it here.
If you want to know a piece better, it's definitely recommended by over 5 stars. You can't expect to finish it. It has more than 1800 pages, including two volumes. I'm not sure about a work.
Go and have a look. Any part of this book can be 200 to 300 pages, which is very detailed. And you need to analyze the kernel source code with a certain goal. It takes linux 2.4 as an example.
But the principle is the same, and it also applies to other versions of linux.
Any other introductions? Hehe, Wei Dongshan Linux Video Phase II, of course. < Complete Manual of Embedded Linux Application Development >: There is not much discussion on drivers in the book, and it is not deep enough.
So I recorded this video. Not only teach you how to write and change drivers, but also teach you why to write and change drivers like this.
Each driver is written on site:
1. Drawing with the sketchpad is equivalent to the teacher drawing on the blackboard in school, which is very intuitive.
Definitely not for PPT.
2. Like every class, start from line 1 and write a program on the spot with source insight. I talked about more than 20 drivers and wrote more than 20 programs.
3. Compile and test after writing.
4. Very comprehensive, including three categories: character device driver, block device and network card driver, hardware introduction, driver framework analysis and testing.
The content taught by training institutions is far less abundant than this video. I have taught in many training institutions, and I have never seen any teacher dare to explain every class and write code on the spot.
Test on the spot, except me! I haven't seen any training institutions finish these contents-it will take at least one month because of lack of time, but this part is basically only two weeks' teaching time.
Try to write a driver for all the hardware in the development board. If you have a problem, you should learn from it first. In the process of thinking, you will put a lot of irrelevant knowledge.
Connect in series and finally.
Fourth, the root file system:
Have you ever thought about these two questions:
1.Linux products are used for monitoring, mobile phones and tablets. So after the kernel starts and mounts the root file system, which application should be started?
A: The kernel doesn't know or care which user program should be started. It only starts the application init, which corresponds to /sbin/init.
Obviously, this application will read the configuration file and start user programs (monitoring, manual interface, tablet interface, etc. ) According to the configuration file.
This question reminds us that the content of the file system has some conventions, such as /sbin/init and configuration file.
2. Have you ever wondered who realized the printf used in your hello world program?
A: You didn't implement this function, but the library function did. When it runs, you must find the library.
This question reminds us that there are libraries in the file system.
Simply ask yourself and answer here. If you want to know more, you can look at the init.c of busybox and know what the init process is doing.
Of course, you can also watch the chapter: Building a Root File System.
Tell me about my study experience.
1. I majored in physics and electronics at school. In fact, the course did not teach how to design circuits, but only taught some knowledge of electronic circuits. printed circuit board layout
I teach myself in the laboratory. I only designed two layers of boards, and now I almost forgot. But it retains the ability to read schematic diagrams and chip manuals.
2. I took the software major and was interested in software design, but I only learned C language and database. I did a lot of competition questions with great interest. Have no ability to go
Take part in the competition, but practice C language very solidly.
3. In the lab, in the 1 company, we just designed some simple PCI cards and wrote the driver of windows.
4. The second company used 5 1 single chip microcomputer to make car phone, and started the road of pure software.
5. I began to feel the shortage of single chip microcomputer, resigned for half a year and studied Linux behind closed doors, starting with how to operate Red Hat. The step is to view:
Then write your own bare board program to operate the hardware, and then analyze u-boot. Watch at the same time; , know something about the LINUX framework.
When writing bare board, I suggest you strengthen your understanding of interruption. The kernel uses interrupts to complete various functions.
6. After analyzing u-boot, start simple driver programming. At this time, the ability is still very weak.
7. I started working in ZTE for 2 years, and my ability was honed by writing various drivers and solving various problems (driving problems and helping to locate application problems).
To sum up:
1. Hardware books: microcomputer principles, digital circuits, college textbooks. I graduated for many years and forgot my name.
2. Books about Linux:
< arm architecture and programming >:
& lt Complete Manual of Embedded Linux Application Development & gt;;
< Linux device driver >; The one written by foreigners.
< Detailed description of Linux device driver development >;
< Linux kernel complete note >;
< scene analysis of Linux kernel >;
3. Video:
Wei Dongshan Linux videoNo.1(based on S3C2440 recording): ARM experiment, u-boot, file system, primary driver.
Wei Dongshan Linux VideoNo.1(based on S3C64 10 recording): Bare board program.
Wei Dongshan Linux Video Phase 2: Advanced Driver