1. Embedded Systems
Components of Embedded Systems:Generally, embedded systems consist of embedded processors, supporting hardware, embedded operating systems, supporting software, and application software.
Embedded systems should have the following characteristics:
◆Strong specificity.Embedded systems are designed for specific application needs, integrating many tasks usually performed by general-purpose CPUs into the chip, which is conducive to miniaturization.
◆Technological integration.Embedded systems combine advanced computing, communication, semiconductor, and electronic technologies with specific applications in various industries, making it a technology-intensive, capital-intensive, highly decentralized, and continuously innovative knowledge integration system.
◆Software-centric integration of hardware and software.Software is the main component of embedded systems, with IP cores. Both the hardware and software of embedded systems can be designed efficiently, tailored to remove redundancy, achieving higher performance on the same silicon area.
◆Less resource than general-purpose computers.Since embedded systems usually perform only a few tasks, they are designed with economy in mind and do not use general-purpose CPUs, which means they manage fewer resources, have lower costs, and simpler structures.
◆Program code is fixed in non-volatile memory.To improve execution speed and system reliability, the software in embedded systems is generally fixed in memory chips or microcontrollers, rather than stored on disks.
◆Need for specialized development tools and environment.Embedded systems themselves do not have development capabilities. Even after design completion, users typically cannot modify the program functions without a set of development tools and environment.
◆Small size, low cost, advanced technology, high performance-to-price ratio, low system configuration requirements, and strong real-time performance.
◆High requirements for safety and reliability.
Classification of Embedded Systems
According to different purposes, embedded systems can be divided intoembedded real-time systems andembedded non-real-time systems. Real-time systems can further be divided into hard real-time systems and soft real-time systems. From the perspective of safety requirements, embedded systems can also be classified assafety-critical systems andnon-safety-critical systems.
Embedded systems consist of five layers: hardware layer, abstraction layer, operating system layer, middleware layer, and application layer.
◆Hardware Layer.The hardware layer mainly provides the hardware environment for the operation of embedded systems, with the core being microprocessors, memory (ROM, SDRAM, Hash, etc.), I/O interfaces (A/D, D/A, I/O, etc.), general devices, as well as buses, power supplies, clocks, etc.
◆Abstraction Layer.The abstraction layer exists between the hardware layer and software layer, mainly realizing abstraction of hardware for the upper application (operating system) to provide virtual hardware resources: Board Support Package (BSP) is a type of hardware driver software that drives hardware chips or circuits in the hardware layer, providing support for hardware management to the upper layer operating system.
◆Operating System Layer.The operating system layer mainly consists of embedded operating systems, file systems, graphical user interfaces, network systems, and general components that can be configured.
◆Middleware Layer.The middleware layer generally sits above the operating system, managing computer resources and network communication, serving as a bridge connecting two independent applications.
◆Application Layer.The application layer refers to the specific applications of embedded systems, mainly including various application software.
Embedded Database System (EDBMS)
Characteristics of the usage environment:
◆Device mobility at all times.Embedded databases are mainly used in mobile information devices, where the device’s location often changes along with the user.
◆Frequent network disconnections.During the use of mobile devices or terminals, their locations frequently change, influenced by usage patterns, power sources, wireless communication, and network conditions. Therefore, they generally do not maintain a continuous network connection but frequently connect and disconnect intermittently.
◆Diverse network conditions.Due to the frequent changes in the locations of mobile information devices, they may connect to database servers through different network systems at different times, which may vary in bandwidth, communication costs, network latency, and QoS.
◆Asymmetric communication capabilities.Due to limitations in mobile device resources, the network communication capabilities between mobile devices and servers are asymmetric. The sending capabilities of mobile devices are very limited, resulting in a significant difference in the downlink communication bandwidth from the database server to the mobile device and the uplink bandwidth from the mobile device to the database server.
System Composition:
A complete EDBMS consists of several subsystems, including the main database, synchronization server, embedded database, and connection network:
Embedded mobile databases must address key issues such as data consistency (replicability), efficient transaction processing, and data security in practical applications.
Embedded Operating System (EOS)
Compared to general-purpose operating systems, EOS has the following characteristics:
◆Miniaturization.The operating platform of EOS is not a general-purpose computer but an embedded system. Such systems generally do not have large memory and almost no external storage; therefore, EOS must be compact to occupy as few system resources as possible.
◆High code quality.In most embedded applications, storage space remains a precious resource, which requires high-quality program code that is as concise as possible.
◆Specialization.The hardware platforms for embedded systems vary widely, and processors are updated rapidly, with each processor being specially designed for different application fields. Therefore, EOS must have good adaptability and portability, and support multiple development platforms.
◆Strong real-time performance.Embedded systems are widely used in process control, data acquisition, communication, multimedia information processing, and other scenarios requiring real-time responses, making real-time performance another characteristic of EOS.
◆Scalable and configurable.The diversity of applications requires EOS to have strong adaptability, able to be flexibly configured and reasonably scaled according to application characteristics and specific requirements to meet miniaturization and specialization needs.
Embedded Real-Time Operating System
An embedded real-time system is a dedicated computer system designed for specific applications, completely embedded within controlled devices. In embedded real-time systems, it is required thatthe system has determinacy and predictability before it is put into operation.
Predictability means that the systemhas predictable functions, response characteristics, and execution results before running;
Determinacy means that the systemprovides definite results within a specified time under given initial states and input conditions.
Characteristics of Real-Time Operating Systems (RTOS)
◆When external events or data occur,it can accept and process them quickly enough, and the processing results can control production processes or respond quickly to processing systems within specified timeframes, ensuring that all real-time tasks operate in coordination. Therefore, providingtimely responses and high reliability is its main characteristic.
◆Real-time operating systems can be classified ashard real-time and soft real-time; hard real-time requires operations to be completed within specified timeframes, which is guaranteed during the design of the operating system; soft real-time only requires operations to be completed as quickly as possible according to task priorities.
Real-Time Operating System Features
High-precision timing system
Timing precision is an important factor affecting real-time performance. In real-time application systems, precise timing is often needed to operate a device or perform a task or accurately calculate a time function. This relies not only on the clock precision provided by some hardware but also on the high-precision timing functions implemented by the real-time operating system.
Multi-level interrupt mechanism
A real-time application system usually needs to handle various external information or events, but the urgency of processing may vary. Some must respond immediately, while others can be delayed. Therefore, a multi-level interrupt nesting mechanism is needed to ensure timely responses and processing of higher-urgency real-time events.
Real-Time Scheduling Mechanism
Real-time operating systems must not only respond to real-time event interrupts promptly but also schedule real-time tasks in a timely manner. However, processor scheduling cannot be arbitrary, as it involves switching between two processes, which can only occur at points ensuring “safe switching.” The real-time scheduling mechanism includes two aspects: one is to ensure priority scheduling of real-time tasks in scheduling strategies and algorithms; the other is to establish more “safe switching” time points to ensure timely scheduling of real-time tasks.
Embedded Software Design
A typical cross-platform development environment consists of three highly integrated parts:
◆Powerful cross-development tools and utilities running on the host machine.
◆High-performance, configurable real-time operating systems running on the target machine.
◆Various communication methods that connect the host and target machines, such as Ethernet, USB, serial ports, etc.
Cross-compilation: The compilation used in embedded software development is cross-compilation. Cross-compilation generates code that can be executed on another platform while running on one platform. The primary task of compilation is to convert the program into machine code that the CPU running the program can recognize. Different architectures have different instruction sets; thus, different CPUs require corresponding compilers, and cross-compilation is similar to translation, converting the same program code into executable binary files corresponding to different CPUs.
The development of embedded systems requires the use of a host machine (general-purpose computer) to compile executable code for the target machine.
Cross-debugging: After embedded software is compiled and linked, it enters the debugging phase, which is an essential part of the software development process. Cross-debugging in embedded software development differs significantly from debugging in general software development processes.
In embedded software development, debugging is performed incross-debugging between the host machine and the target machine; the debugger still runs on the host machine’s general-purpose operating system, but the process being debugged runs on an embedded operating system based on a specific hardware platform. The debugger and the process being debugged communicate through serial ports or networks, allowing the debugger to control, access the current state of the process, and change the running state of the process.
Software Development Tools
The development of embedded software can be divided into several stages: coding, cross-compilation, cross-debugging.
Editor: Used for writing embedded source code programs; theoretically, any text editor can be used to write source code. Various integrated development environments provide powerful editors, such as VS series, Eclipse, Keil, CSS, etc. Common standalone editors include UE, Source Insight, Vim, etc.
Compiler gcc: The work of the compilation phase involves using cross-compilation tools to process source code and generate executable target files. In embedded systems, since the host and target machine systems differ, cross-compilation is required. GNU C/C++ (gcc) is a commonly used cross-compiler that supports many host/target machine combinations.
Debugger gdb
Cross-debugging is an essential step in embedded software development. Features of embedded software debugging: the debugger runs on the host machine, while the debugged program runs on the target machine.
The debugger establishes a connection with the target machine through some communication method, such as serial ports, parallel ports, networks, JTAG, etc. A type of agent for the debugger is usually present on the target machine, which can assist the debugger in completing the debugging of the program running on the target machine, which can be software or hardware supporting debugging.
gdb is a powerful program debugging tool released by the GNU open-source organization.
If this article is helpful, please like, share, and forward!
Thank you for your support!(*^_^*)
Leave a Comment
Your email address will not be published. Required fields are marked *