Why do you want to learn SCM without a future?
Because it's a good entrance.
Learning MCU can let us put aside the complex software structure and master the hardware operation first, such as looking at the schematic diagram, chip manual, writing program operation register, etc. In the last video, I just belittled the single chip microcomputer to nothing, saying that the single chip microcomputer has no future. In this video, I want to tell you that if there is no future, you should also learn the single chip microcomputer. Why?
First of all, I don't need to learn MCU, which means don't use the old learning methods to learn MCU. What is the old way?
Â·Hardware: do not use C51, STM32 these special MCU development boards. If you don't plan to engage in MCU development in the future, why do you use these chips? After studying for two or three months, you can use these registers clearly, and you can't use them. It's unnecessary.
Â·Software: do not use KEIL, MDK and other highly integrated software. If you use these software, you can write main (), and then call various libraries for fool operation. These easy-to-use tools encapsulate many technical details, making it impossible for us to understand the essence of bare metal and single chip microcomputer.
In the future, we will use a new set of methods to develop MCU. A new set of methods will be introduced later.
The reason why we have to learn MCU is that its knowledge is still useful for us to learn Linux. Let's first look at what a Linux system is all about. Software composition of an embedded Linux system: MCU bootloader â > linux driver â > linux app â > linux GUI (Android / Qt). When our PC is powered on, the BIOS will be displayed on the black screen. The purpose of this BIOS is to start the windows kernel. The windows kernel then mounts Disk C (system disk) and disk D (application disk), and finally starts applications, such as QQ and online games. Similarly, our Android phones or industrial control devices also have BIOS, but the embedded Linux system is not called BIOS, but bootloader. Its purpose is to start the Linux kernel. It first identifies the storage device where the application is located, mounts the root file system (Disk C and disk D in Windows system, called root file system in Linux), and finally starts the application.
Carefully analyze the bootloader. It starts the kernel. Where does it start the kernel? Obviously, it reads the kernel somewhere. For example, BIOS reads the windows kernel from disk C, and our bootloader reads the kernel from flash or SD card. Therefore, bootloader should have the ability to read flash or SD card. Some bootloaders also display logo, so it also has the ability to operate LC D. bootloader also needs to set the environment of the development board, such as initializing the clock, initializing the memory, and setting the network card. So many things are implemented in bootloader, which is too complex. It is very difficult to analyze the whole bootloader when you come.
So how do we learn? Take it apart and write a separate program, such as LED lighting, clock, network card and flash. These are single-chip microcomputer programs. Therefore, bootloader is a complete collection of single-chip microcomputer programs. In order to better learn bootloader, we should practice the hardware one by one in advance. When we are familiar with each hardware , and then combined, it's a bootloader.
Let's take another look at bootloader. After bootloader starts the kernel, the kernel mounts the root file system, which means that the kernel also has the ability to operate the hardware, which is the driver. First, let's take a look at a simple driver. First, our application calls open(), read(), write() These standard interfaces are used to access the hardware. Then enter the driver, which has the corresponding drive_open(), drive_read(), drive_write(). Finally, configure the hardware in the driver. For example, for an LED lighting driver, drive_open() should set the GPIO as the output pin, drive_read(), return the GPIO status, and driver_write() Write GPIO and let the pin output high level or low level.
For our LED driver, you need to provide drive_open(), drive_read(), drive_write(). This is its framework. The specific operation of hardware is hardware operation. Therefore, we are familiar with and master the hardware operation in the single chip microcomputer in advance. That is, the composition of the driver:
Driver = software framework hardware operation
You need to learn to see the schematic diagram, how to connect the hardware, read the chip manual, and know how to read and write registers. All these can be learned and mastered in the single chip microcomputer. When learning linux driver in the future, focus on the software framework.
We can learn single chip microcomputer in advance. The learning of single chip microcomputer allows us to put aside the complex software structure and master the hardware operation first, such as looking at the schematic diagram, chip manual, writing program operation register, etc. This is why single chip microcomputer has no future, and we also need to learn. It is because the hardware operation involved in it is very useful for our subsequent learning.
Now we know that we learn MCU not to master the development skills of MCU, but to master bootloader and hardware operation.
Original post transferred from: http://bbs.elecfans.com/jishu_1544437_1_1.html