
What is a MicrocontrollerFirst, let’s clarify the concept of a microcontroller. A microcontroller is an integrated circuit chip that uses very large scale integration (VLSI) technology to integrate a central processing unit (CPU) with data processing capabilities, random access memory (RAM), read-only memory (ROM), various I/O ports, an interrupt system, timers/counters, and other functions (which may also include display driver circuits, pulse width modulation circuits, analog multiplexers, A/D converters, etc.) into a single silicon chip, forming a small and complete microcomputer system widely used in industrial control.Since the 1980s, microcontrollers have evolved from 4-bit and 8-bit microcontrollers to today’s high-speed microcontrollers operating at 300M. For example, the classic 51 series microcontroller appears as a rectangular chip about the size of a thumb, with 40 pins, containing a logic operation unit. In fact, it is essentially a CPU.When I first encountered microcontrollers, I had a question: why are microcontrollers black and not other colors? Later, I learned that it is due to the material limitations of the microcontroller.For a microcontroller, the chip itself is everything; other components, such as the minimum system for the microcontroller, are added to ensure its normal operation, such as crystal oscillators, 5V power supplies, inductors, and resistors. Of course, the minimum system can only guarantee the normal operation of the microcontroller and cannot achieve any application based on the microcontroller.To enable applications using microcontrollers, additional peripherals must be added, such as buttons, LED lights, LED screens, buzzers, and various sensors. This is why many companies on the market are developing microcontroller development boards.In summary, a microcontroller is a single module that performs functions such as computation, logic control, and communication. It is indeed a ‘single’ entity. DSP chips can also be considered microcontrollers. Although they have powerful performance, their functions remain singular, primarily focused on data processing and logic.What is Embedded SystemsSo, what is embedded systems? Generally, embedded systems refer to embedded systems, defined by the IEEE (Institute of Electrical and Electronics Engineers) as “devices used to control, monitor, or assist in the operation of machines and equipment.”An embedded system is a dedicated computer system that is part of a device or equipment. Typically, an embedded system is a control program stored in ROM on an embedded processor control board.Embedded systems integrate application programs, operating systems, and computer hardware into a system that is application-centered and based on computer technology, with customizable software and hardware. They are specialized computer systems designed to meet specific requirements for functionality, reliability, cost, size, power consumption, and operating environment.In fact, all devices with digital interfaces, such as watches, microwaves, VCRs, and cars, use embedded systems. Some embedded systems also include operating systems, but most embedded systems implement the entire control logic with a single program. This is because embedded systems are generally used for industrial control, meaning that control over peripherals is hard-coded and does not require human intervention, ensuring system stability and reliability.We often hear job requirements for embedded software engineers or embedded hardware engineers, indicating that embedded systems include both software and hardware. Upon reflection, it is clear that since systems are running, there must be both software and BSP hardware.In other words, embedded systems are a combination of software and hardware. The commonly accepted definition of embedded systems in China is: application-centered, based on computer technology, with customizable software and hardware, designed to meet strict requirements for functionality, reliability, cost, size, power consumption, and other factors.Hardware Layer of Embedded SystemsThe hardware layer includes embedded microprocessors, memory (SDRAM, ROM, Flash, etc.), general device interfaces, and I/O interfaces (A/D, D/A, I/O, etc.). By adding power circuits, clock circuits, and memory circuits to an embedded processor, an embedded core control module is formed. Both the operating system and application programs can be embedded in ROM.The core component is the microprocessor. Embedded processors differ from general computer CPUs; embedded microprocessors typically operate in specifically designed systems. For example, companies like TI or Atmel have many processors with different specifications. Atmel’s SAM series is specifically designed for the Internet of Things, while AVR is widely used in industrial applications due to its outstanding performance.Embedded microprocessors come in various architectures, and even within the same architecture, they may have different clock frequencies and data bus widths or integrate different peripherals and interfaces. According to incomplete statistics, there are over 1,000 types of embedded microprocessors worldwide, with more than 30 architecture families, including mainstream architectures like ARM, MIPS, PowerPC, X86, and SH.However, unlike the global PC market, no single embedded microprocessor dominates the market. Just among 32-bit products, there are over 100 types of embedded microprocessors. The choice of embedded microprocessor is determined by specific applications.In the embedded field, ARM architecture processors occupy a significant market share, and ARM has become a well-known technology company, despite not manufacturing any processors but merely providing IP, indicating that leading companies set standards. Other commonly used architectures include SPARC, PowerPC, etc.For example, ARM offers various processor architectures, with the classic Cortex series belonging to the ARMv7 architecture, which was the latest instruction set architecture from ARM until 2010. The ARMv7 architecture defines three clearly defined series: the “A” series for cutting-edge virtual memory-based operating systems and user applications; the “R” series for real-time systems; and the “M” series for microcontrollers.Embedded systems require certain forms of general device interfaces for interaction with the outside world, such as A/D, D/A, and I/O. Peripherals achieve the input/output functions of the microprocessor through connections with external devices or sensors. Each peripheral typically has a single function and can be either external to the chip or built into the chip. There are many types of peripherals, ranging from simple serial communication devices to very complex 802.11 wireless devices.Commonly used general device interfaces in embedded systems include A/D (analog-to-digital conversion interface), D/A (digital-to-analog conversion interface), and I/O interfaces such as RS-232 (serial communication interface), Ethernet (network interface), USB (universal serial bus interface), audio interfaces, VGA video output interfaces, I2C (field bus), SPI (serial peripheral interface), and IrDA (infrared interface). This is quite similar to microcontrollers.Software Layer of Embedded SystemsThis refers to the operating system, including the kernel and file system, as well as the higher-level application programs. Embedded operating systems are generally Linux or other Unix-like systems, along with some real-time operating systems (RTOS) such as VxWorks, RTEMS, ucOS, etc.Linux also includes different distributions, such as Ubuntu, Redhat, Debian, CentOS, etc. They all use the Linux kernel, but differ in the software and tools above it. Fortunately, there is no need to worry too much about standard issues, as the software chosen for these Linux distributions is generally quite universal, such as the Apache web server, Postfix, Sendmail for email servers, and Samba for file servers. Additionally, there are standards like the Linux Standard Base to regulate developers. Unix-like systems mainly include FreeBSD and Solaris.In the embedded field, real-time operating systems are still the most commonly used. The core of real-time operating systems is real-time performance, which essentially refers to the predictability of task processing time, meaning tasks must be completed within specified time limits. The IEEE defines real-time systems as “systems where correctness depends not only on the logical result of the computation but also on the time taken to produce the result.”Real-time operating systems can be classified into hard real-time and soft real-time. Hard real-time systems must complete operations within specified time limits, which is guaranteed during the operating system design; soft real-time systems aim to complete operations as quickly as possible according to task priority. Generally, operating systems we use can be modified to become real-time operating systems.Here are some differences between real-time operating systems and time-sharing operating systems like Linux:(1) Multiplexing. Real-time information processing systems, like time-sharing systems, have multiplexing capabilities. The system serves multiple terminal users based on time-sharing principles; in contrast, real-time control systems primarily focus on frequently collecting multiple field information and controlling multiple objects or actuators.(2) Independence. Real-time information processing systems, like time-sharing systems, have independence. Each terminal user operates independently when requesting services from the time-sharing system, without interference; in real-time control systems, information collection and object control also do not interfere with each other.(3) Timeliness. The timeliness requirements for real-time information systems are similar to those of time-sharing systems, determined by acceptable waiting times; however, the timeliness of real-time control systems is determined by the required start and completion deadlines for control objects, generally in seconds, hundred milliseconds, or even milliseconds, with some requiring less than 100 microseconds.(4) Interactivity. Real-time information processing systems have interactivity, but the interaction between humans and the system is limited to accessing specific dedicated service programs within the system. Unlike time-sharing systems, they do not provide data processing services or resource sharing to terminal users.(5) Reliability. Time-sharing systems require system reliability, while real-time systems demand high reliability. Any error can lead to significant economic losses or unpredictable catastrophic consequences. Therefore, real-time systems implement multi-level fault tolerance measures to ensure system and data safety.Due to their greater reliability and timeliness, embedded real-time operating systems are more widely used in industrial control, aerospace, military, and other fields. For example, NASA’s Mars rovers launched in recent years have all used the RTEMS real-time operating system.Middleware Layer of Embedded SystemsThe middleware layer refers to the interface layer between the software layer and the hardware layer, which strictly speaking also belongs to the software layer. Developers generally refer to this layer as BSP (Board Support Package). This layer is primarily responsible for providing hardware drivers and hardware configuration operations to the lower layer, while providing standard APIs to software developers for upper-layer development. Developers working on middleware development are usually called embedded driver engineers.This illustrates that embedded design cannot be separated from both software and hardware; one must understand the characteristics of the underlying hardware and how to drive it, as well as have knowledge of the operating system to write corresponding functional applications.Therefore, to determine whether an operating system supports a specific chip or development board, one only needs to check whether the source code contains the corresponding board support package for that chip or development board.What Kind of Hardware Should Embedded Systems Run OnWhen it comes to embedded hardware or development boards, many people’s first impression is the Raspberry Pi, a microcomputer the size of a credit card. Despite its small appearance, it is quite powerful, capable of handling video, audio, and more, making it a true example of “small but mighty.” After the launch of the Raspberry Pi, many manufacturers rushed to release similar products, such as the Banana Pi.There is also TI’s BeagleBone Black board, which is similar in size to the Raspberry Pi and includes peripherals such as USB host and USB mini, as well as a network interface. The back also has an SD card slot and HDMI interface. The BBB’s processor uses the currently most popular ARMv7 instruction set in embedded systems. Using a processor with a widely used instruction set allows for broader software support. For example, some operating systems no longer support running on the ARMv6 instruction set; for instance, Ubuntu dropped support for ARMv6 in April 2012.ARMv7 has another advantage over ARMv6 in that processors using ARMv7 have significantly stronger actual performance. There are many advantages of ARMv7 over ARMv6, including notable improvements: it implements superscalar architecture, includes SIMD operation instructions, and improves branch prediction algorithms, greatly enhancing certain performance metrics.ConclusionThe above outlines the performance parameters of a basic embedded core board. Compared to the performance parameters of microcontrollers mentioned earlier, microcontrollers generally have lower processing capabilities, with clock frequencies mostly in the tens of MHz range, while embedded systems can reach hundreds or thousands of MHz, showing a significant difference. Additionally, microcontrollers lack the capability to handle graphical interfaces, meaning the absence of a GPU makes it nearly impossible for microcontrollers to drive graphical interfaces.The storage space of microcontrollers is also not on the same level as embedded processors. Microcontrollers typically have only a few kilobytes of internal memory, and due to peripheral limitations, it is unlikely to significantly increase external eMMC storage. In contrast, embedded processors usually have hundreds of megabytes of RAM. This vast difference makes it nearly impossible for microcontrollers to run operating systems, and they cannot even run TCP/IP protocol stacks or USB protocol stacks. Some high-end microcontrollers, such as ST’s STM32 series, may be able to run lightweight operating systems and embedded network protocol stacks, such as the lwIP protocol stack.The rich and powerful performance of embedded processors allows them to accomplish many applications that microcontrollers cannot, such as network communication and video transmission processing. When peripheral storage increases, embedded processors can easily run various Linux systems and graphical GUI interfaces.In terms of development methods, there are also significant differences between microcontrollers and embedded systems, particularly in the compilation process. Microcontroller development primarily occurs under graphical interfaces like Windows, with many mature IDE tools available, such as Keil, IAR, and TI’s CCS. These tools integrate compilation, assembly, linking, and simulation, and since development occurs in Windows, they offer a user-friendly interface. Developers only need to write C code and click the compile and link button; if errors occur, they can debug or simulate, making it very quick to get started.In contrast, embedded development generally occurs under Linux, requiring developers to compile C code on their host machine and then burn the compiled files onto the development board via system images or U-Boot. Since the host processor is x86 architecture while the written code is intended to run on ARM or SPARC architecture processors, there is a need to install a cross-compilation toolchain. Additionally, Linux does not have IDEs like Windows, meaning that compilation and linking of source code must be completed by the developer. Typically, GNU Make scripts are used to write Makefiles and configure files to complete this process. The Makefile specifies how to compile C or H files, including compilation rules and dependency files. All of this must be done by the developer, and the entire process occurs in the Linux terminal, adding to the complexity of embedded development.


Screenshots of Some Electronic Books

【Complete Set of Hardware Learning Materials Collection】
