The difference and relationship between embedded Linux and embedded development of 51/430/STM32
[Copy link]
Summarize:
Microcontroller series: 8051, MSP 430, STM32 F0-3 (ARM Cortext M0 - M3 series)
Main features No memory management unit, can not run Linux and other operating systems with virtual memory, can only run bare metal programs or real-time operating systems such as ucOS. The main work is peripheral driver development (such as writing an encoder driver, LCD driver, USB driver) and driver-based application development, such as control and simple image processing functions.
Microprocessor series: ARM Cortex A series processors
have a memory management unit MMU, can run Linux programs, development is actually the same as writing programs on Windows PC, but because ARM compilation is slow, it is generally chosen to use a specific compiler for ARM on PC to compile the program and run it on ARM, which is cross-compilation. The driver development involved here is more complicated, and it is generally written in accordance with the rules defined by Linux.
Detailed explanation:
Development based on STM32 belongs to the field of microcontroller development. The main development tools are keil or IAR. This kind of development is more accurately called single-chip microcomputer development or hardware development. The embedded development mentioned in the recruitment is based on the Linux operating system. This kind of development is generally divided into several levels: driver development, operating system layer development, and application layer development. The knowledge required to develop the latter is not at the same level as the former.
If you have played with Arduino and Raspberry Pi, then this is easy to understand. STM32 development is at the same level as Arduino, at the microcontroller level; embedded Linux development is at the same level as Raspberry Pi, belonging to the microprocessor level.
In more detail, single-chip microcomputer development is mainly about controlling, detecting and transmitting data, such as controlling relay switches to control door locks, detecting temperature and humidity and uploading data to the gateway. In addition to doing single-chip microcomputer work, the processor can also handle tasks with large computational requirements such as audio and video. There is a file management system and more storage space, as well as the "out-of-the-box" tools provided by the platform (that is, you can use it directly after installation). For example, it is no problem to run a face detection system on the Raspberry Pi, and it is also very convenient to build a Web site on the Raspberry Pi.
The main control chip used in embedded Linux is more advanced than STM32. What is advanced? In addition to the characteristics of running speed, memory space, etc., from the development of the chip to the final development of a complete product prototype or solution, the process requires the use of many development tools, including the design of the hardware circuit board, the transplantation of the driver layer and the system layer code, and the writing of the application layer code. These require the cooperation of a team. Of course, experts can also complete them independently, but it requires a lot of energy, and the project cycle will be very, very long. Embedded Linux development is not like single-chip microcomputer development. After the hardware is designed, you only need to open the IDE to write the code, and then burn, test, and modify the code.
Here is a summary picture of the ARM chip core. Among them, the STM32 core belongs to the Cortex-M series, and the core used in embedded Linux may be the Cortex-A series. Some Cortex-Ms do not support the MMU memory management unit. As far as I know, they can only be used in the embedded system of the C/OS series at most, while Cortex-A supports MMU and can be used in Unix-like systems. Once on a Unix-like system, the underlying things can be encapsulated and only interfaces are provided to upper-level developers.
Here is a popular science. If you have learned object-oriented programming, it is easy to understand encapsulation and interface. Encapsulation is to hide the implementation details as much as possible and provide one or more public interfaces to the outside world. Developers only need to know how to call this interface, not how to implement it. This is very different from development based on single-chip microcomputers. The essence of single-chip microcomputer development is "register-oriented development". Embedded Linux development is "N-1 layer-oriented development", for example, the application layer is "operating system layer API development".
Of course, now STM32 has the development tool STM32Cube, which is like encapsulating STM32 development in one layer and providing an interface. But for me, Cube is just a "development framework" or "middleware". Cube makes it easier for developers to configure pins, and at the same time encapsulates a layer of registers, telling developers in a more friendly way that developers only need to call according to the interface provided by the interface document (unfortunately, Cube has too few documents, learning and development materials). If I don't use Cube, I can also develop STM32. Before Cube, developers directly developed by looking at the chip manual.
For embedded Linux development, you cannot leave the N-1 layer. If you don’t understand the underlying API, you don’t know what to do. For example, if you use TCP, you must at least know the Socket interface. For example, if you write a Web management page, you need at least a Web framework (such as Python’s Django) and a Web server (such as Apache). Of course, since embedded Linux is based on Unix-like development, many interfaces and their knowledge are universal. After mastering the underlying interface, you can pay more attention to business logic. In the development of single-chip microcomputers, if you change a chip, you need to read the chip manual again. Even if you want to implement the same function, you feel like you have to redevelop it, so the chip selection stage is also a top priority. Embedded Linux application layer development is not that troublesome. As long as the operating system is Unix-like, the underlying layer provides the same interface and the code can be reused.
|