반도체 AI 인더스트리 4.0 SDV 스마트 IoT 컴퓨터 통신 특수 가스 소재 및 장비 e4ds plus

[Serial] ST Yuji Kawano Engineer ⑩ - Choosing the best MCU software, understanding the software layer is a must

기사입력2021.12.13 14:42

Choosing the Best MCU Software, Understanding Software Layers is a Must

A significant number of developers develop software using device drivers.
All software architectures require application software.

[Editor's Note] Generally, when we think of semiconductors, we tend to think of semiconductors that are familiar to the general public, such as the CPU and memory of computers. On the other hand, MCUs (Micro Controller Units), which are used as core semiconductors for operating electronic products, are semiconductors that are still unfamiliar to the general public, even though they are commonly used in all electronic products that we easily come across. These MCUs have recently been in the media due to the semiconductor shortage, and have begun to attract the attention of the general public. Accordingly, our magazine has prepared a place to learn about MCUs through a series of articles by Yuji Kawano, Manager of ST Microelectronics, a company specializing in MCU semiconductors.

■ Select software that suits your needs and environment

Now that you understand the development environment required to develop a system using an MCU (microcontroller), let's take a quick look at the software used to drive the MCU. This will help you understand the types and functions of software required for MCU development, as well as select software that suits your needs and environment.

■ Software, MCU operation required

Software is essential to operate an MCU and comes in many different types. Common types of software used for MCU development include:

○ Device Driver

Device drivers define the API (application programming interface) that is used to control specific peripherals. For example, the 32-bit MCU series STM32 produced by STMicroelectronics (hereinafter referred to as ST) provides device drivers as a standard peripheral library, so that all peripherals can be evaluated for each product. With this support, even users who are new to 32-bit MCUs can easily start developing MCUs.

○ Operating System

An operating system (OS) is the basic software that abstracts hardware so that application software and middleware can be used well regardless of the device. Well-known OSs for PCs include Windows and Linux, and for smartphones, there are Android and iOS. RTOS (Real Time OS) is widely used in MCUs, but since the memory capacity of MCUs is limited, the software size can be seen as relatively small.

○ Middleware

Software located in the layer between the OS and application software (middle layer) is collectively called middleware. For example, middleware includes protocol stacks for USB and Ethernet communications, file systems, codecs, and graphics libraries.

○ Application software

The software at the top layer is collectively called application software and is only used to run applications. Application software is essential for realizing detailed application specifications.


▲Figure 1: Layered software architecture



To help you understand the software concept, let's look at a simple, common example of a layered software architecture. Figure 1 shows a layered software architecture that includes the types of software just described. The hardware layer (physical layer) is at the bottom, and the application layer is at the top. The middle is conveniently called the middle layer.

First, let's look at the bottom layer. Here, the hardware layer represents the MCU. The MCU generally uses registers to coordinate its operations, and binary data is written to these registers, each of which is designated to achieve a specific purpose of the MCU operation. However, since most 32-bit MCUs have to deal with a huge number of registers, it is impractical to check all the register addresses before setting the designated bits of the registers every time an operation is performed. Therefore, we try to reduce the burden of performing these tasks as much as possible by using device drivers, which are the layer just above the physical layer.

Device drivers are very useful software. They define APIs according to the peripheral settings of the MCU. For example, to initialize SPI (serial peripheral interface), you can simply call the SPI initialization function and write initialization code without worrying about registers.


▲Figure 2: Software architecture example



A significant number of developers are developing application software using device drivers. As shown in Figure 2-1, these developers use a simple software structure consisting of three layers: hardware, device drivers, and application software.

Some apply an OS to their products, which is to reuse the application software data that runs on the OS of all new products. In this case, the same OS is installed on all new products, so that the MCU can use existing assets and change or add functions. As shown in Figure 2-2, in this case, a software structure consisting of four layers: hardware, device driver, OS, and application software is used.

OS is typically used in products that require relatively complex communication capabilities such as Ethernet, USB, and file systems. In such cases, middleware such as protocol stacks and file systems are added to form a five-layer software structure including hardware, device drivers, OS, middleware, and application software, as shown in Figure 2-3.

Finally, application software is installed to complete the MCU software stack (all software architectures require application software).

In summary, there are many different types of software used in MCUs and they can be divided into several layers. By understanding these software layers, you can understand the role that these types of software play in your application and choose the most efficient and best software.

From a practical application development perspective, when choosing the form of a software architecture, the functionality to be realized (i.e. the required specifications) is the top priority criterion, but factors such as the reusability (or legacy support) of assets, development time, and budget are also of almost equal importance. Since individual developers work under different requirements, they may face the following dilemma: using third-party software can ensure that the required specifications are met in a short period of time, but the cost will exceed the budget; developing in-house software can save costs, but doing so will require more time than the allowed development period. We hope that the information provided in this document will help you choose the best software for your environment.