1.1 Introduction to ARM
1.1.1 Overview of ARM
ARM stands for Advanced RISC Machines, a well-known company in the microprocessor industry that designs a large number of high-performance, low-cost, and energy-efficient RISC (Reduced Instruction Set) processors. The company specializes in chip design and does not manufacture them. It licenses technology to many well-known semiconductor, software, and OEM manufacturers worldwide and provides services.
ARM has three meanings:
1. The name of a company;
2. A general term for a class of microprocessors;
3. The name of a technology.
Characteristics of ARM Microprocessors:
1. Small size, low power consumption, low cost, high performance;
2. Supports both Thumb (16-bit) and ARM (32-bit) dual instruction sets, compatible with 8-bit/16-bit devices;
3. Extensive use of registers, faster instruction execution;
4. Most data operations are performed in registers;
5. Flexible and simple addressing modes, high execution efficiency;
6. Fixed instruction length.
1.1.2 ARM Microprocessor Series
The ARM processor product series is extensive, including ARM7, ARM9, ARM9E, ARM10E, ARM11, and Cortex, among others. Additionally, other manufacturers produce processors based on the ARM architecture. Each series provides a specific set of performance characteristics to meet the designers’ requirements for power consumption, performance, and size.
ARM Inc. offers nine different architectures: ARMv1, ARMv2, ARMv3, ARMv4, ARMv5, ARMv6, ARMv7, ARMv8, and ARMv9, with ARMv1 and ARMv2 having little practical use. Commercial use began with ARMv3.
Starting from the ARMv3 architecture, ARM introduced corresponding ARM6 and ARM7 processor types (series). Currently, common ARM processor types (series) include ARM7, ARM9, ARM10, ARM11, and Cortex. Each series contains various types; for example, the ARM9 series includes ARM9E-S, ARM966E-S, etc.
Architecture |
Specific Processor Types (Series) |
ARMv1 |
ARM1 |
ARMv2 |
ARM2, ARM3 |
ARMv3 |
ARM6, ARM7 |
ARMv4 |
StrongARM, ARM7TDMI, ARM9TDMI, ARM940T, ARM920T, ARM720T |
ARMv5 |
ARM9E-S, ARM966E-S, ARM1020E, ARM 1022E, XScale, ARM9EJ-S, ARM926EJ-S, ARM7EJ-S, ARM1026EJ-S, ARM10 |
ARMv6 |
ARM11 series (ARM1136J(F)-S, ARM1156T2(F)-S, ARM1176JZ(F)-S, and ARM11 MPCore), ARM Cortex-M |
ARMv7 |
Cortex-A, Cortex-M, Cortex-R |
ARMv8 |
Cortex-A35, Cortex-A53, Cortex-A57, Cortex-A72, Cortex-A73 |
ARMv9 |
Cortex-A510, Cortex-A710, Cortex-X2, Neoverse N2 |
Based on the ARMv7 version, the ARM Cortex series products consist of three series: A, R, and M, continuing the long-standing ARM design approach focused on specific applications.
A Application Processor series
Cortex-A processors include Cortex-A5, Cortex-A7, Cortex-A8, Cortex-A9, Cortex-A12, and Cortex-A15, totaling six sub-series, used in applications with high computational requirements, running rich operating systems and providing interactive media and graphics experiences, such as smartphones, tablets, automotive entertainment systems, digital TVs, etc.
All Cortex-A series processors are suitable for various performance application fields, sharing the ARMv7-A architecture and feature set, becoming the best solution for open platform design and providing compatibility and portability for software across different designs. They support ARM, Thumb-2, Thumb, Jazelle, DSP instruction set, TrustZone security extensions, advanced single and double precision floating-point support, NEON media processing engines, and support for all distributions of Linux (Android, Chrome, Ubuntu, Debian), third-party Linux (MontaVista, QNX, Wind River, Symbian, Windows CE), and other operating systems requiring memory management units.
R Real-Time Control series
Cortex-R series processors include Cortex-R4, Cortex-R5, and Cortex-R7, balancing the demands for low power consumption, good interrupt behavior, excellent performance, and high compatibility with existing platforms, featuring high performance, real-time capabilities, safety, and cost-effectiveness, aimed at deep embedded real-time applications such as automotive braking systems, power transmission solutions, and high-capacity storage controllers. For instance, hard disk controllers (or solid-state drive controllers), network devices and printers in enterprises, consumer electronics (such as Blu-ray players and media players), and automotive applications (such as airbags, braking systems, and engine management).
Cortex-R series processors utilize deeply pipelined microarchitecture and performance enhancement techniques such as instruction pre-fetching, branch prediction, and superscalar execution, providing hardware division, floating-point unit (FPU) options, and hardware SIMD DSP, employing ARMv7-R architecture with Thumb-2 instructions that allow for high-density code without sacrificing performance, and Harvard architecture with instruction and data cache controllers, featuring tightly coupled memory (TCM) for fast response code and data processing and high-performance AMBA3 AXI bus interfaces.
M Microcontroller series
Cortex-M series processors include Cortex-M0, Cortex-M0+, Cortex-M1, Cortex-M3, and Cortex-M4, totaling five sub-series, primarily aimed at cost and power-sensitive applications such as smart measurements, human-machine interface devices, automotive and industrial control systems, home appliances, consumer products, and medical devices.
The Cortex-M processor family focuses more on the low-performance end, but these processors are still powerful compared to the traditional processors used in many microcontrollers. For example, Cortex-M4 and Cortex-M7 processors are applied in many high-performance microcontroller products, with maximum clock frequencies reaching 400Mhz.
1.2 Why Learn Cortex-M
The mainstream chips on the market today are basically from the Cortex series, as shown in the figure below.
As can be seen from the above figure, Cortex-M is widely used in various fields, especially in embedded systems, where Cortex-M series chips sit between low-end and high-end. They offer more on-chip peripherals and more advanced core architectures compared to ordinary 8/16-bit machines, capable of running real-time operating systems like RT-Thread; compared to high-end CPUs that can run Linux operating systems, they are low-cost and have strong real-time capabilities. This positioning allows Cortex-M to dominate a significant portion of the mid-range controller market and serves as an excellent transitional platform for developers to enhance their skills, laying a solid foundation for future learning.
Cortex-M series processors focus on industrial control, providing lower power consumption and longer battery life, resulting in less code and higher performance, and offering compatible code, unified tools, and operating system support with the following advantages:
-
Great advantage in applications with stringent memory size requirements;
-
Can be programmed using C language, accompanied by various advanced debugging features to help locate issues in software, and many application examples are available online for reference;
-
Offers significant energy efficiency advantages, especially for products requiring connections like USB, Bluetooth, WiFi, and complex analog sensors like accelerometers and touch screens, with decreasing costs;
-
Utilizes 8-bit and 16-bit data transmission, allowing efficient use of data memory, and developers can use the same data types in applications targeting 8/16-bit systems;
-
Although using 32-bit instructions, it employs ARM Thumb-2 technology that provides excellent code density and supports 16-bit Thumb instructions, with corresponding C compilers using 16-bit versions of instructions for more efficient computation.
Having discussed the many advantages of Cortex-M, I believe many friends will develop a strong interest in it, and there are abundant learning resources for the Cortex-M series, making it very suitable for beginners.
To truly understand why one should learn Cortex-M, it is necessary to grasp the knowledge structure of embedded systems, allowing readers to gain a comprehensive understanding of embedded engineers and guiding them in planning their career paths based on this understanding.
1.2.1 Knowledge Structure of Embedded Technology
Embedded technology is a specialized computer system technology that focuses on applications, based on computer technology, where both hardware and software can be tailored, suitable for systems with strict requirements for functionality, stability, and power consumption. Developers of embedded technology need to understand the entire computer system (from low-level hardware to software operating systems), and within this system, each part can be subdivided into smaller areas, thus requiring high technical expertise.
This diagram only roughly summarizes the knowledge structure of embedded technology, but it already indicates the wide range of knowledge it involves, which explains why many students and even technical personnel often feel “lost.” Many embedded technology personnel with an electronics background mainly engage in developing hardware abstraction layers (middle layers), which serve as a bridge between the hardware layer of embedded systems and the software operating system. Thus, their main work involves developing drivers, board-level application support, and coordinating software and hardware development, necessitating a deep understanding of both hardware and software.
1.2.2 Career Path for Embedded Engineers
1. From Student to Engineer
If you wish to engage in developing hardware abstraction layers, how should you learn this knowledge to transition from student to engineer? Those wishing to become embedded technology personnel in other directions can also refer to this. As shown in the diagram, the deeper you go into the upper layers, the closer you get to pure software development, but this does not mean that embedded technology personnel do not need to understand hardware; on the contrary, knowledge of the upper layers is based on the lower layers. Many people say, “To do embedded software development, one must at least understand circuit diagrams,” which is the reason behind this.
2. Career Planning
In companies within the embedded technology field, there are many career positions besides engineers. Generally, there are positions in the R&D departments of companies.
Generally, it takes about 3 to 5 years to transition to the next level position. In small companies, project managers often also serve as department managers. Department managers do not necessarily need to understand technology and are not required to be promoted from project managers. Directly related positions include development engineers and system architects. Development engineers will have different distinctions based on the various fields of embedded technology. In small companies, engineers familiar with both software and hardware are highly sought after, while large companies have clear divisions of labor and place more emphasis on development engineers who have researched deeply in a specific field. As for system architects, they need to be familiar with the entire embedded field and capable of coordinating different field development engineers for project development.
Regarding career planning, different people have different views, and situations vary widely. The above is only for readers’ reference.
1.3 What Basics Are Needed to Learn Cortex-M
First, you need to have a certain understanding of the C language; you don’t need to master it, just be able to use some simple command statements. For example, assignment statements, if statements, for loops, while statements, one-dimensional arrays, two-dimensional arrays, etc. Another important aspect to focus on is the definition and calling of functions, as well as parameter passing and returning. I recommend a book for learning C language: “Tan Haoqiang’s C Language Programming,” which is also a textbook in many universities and is written in great detail. Additionally, there is Dr. Lin Rui’s “High-Quality Programming Guide C++/C Language,” which discusses C++/C language in more depth and includes many programming standards worth reading.
Once you have learned the C language, it means you have mastered the basics of software. Next, you need to learn some basic knowledge of hardware. You can buy a couple of books related to digital circuits and analog circuits at the bookstore. It is recommended that you do not need to learn too deeply, just have a simple understanding to be able to read circuit diagrams. When you actually get to the job, in large companies, software developers and hardware designers are usually separated; focusing on one thing allows for more refined work and better development. If you have previously learned about the 51 microcontroller, you are likely familiar with C language, analog circuits, and digital circuits. In that case, you can directly learn Cortex-M. It is important to note that when we learned the 51 microcontroller, we directly operated registers, while now most of our learning about Cortex-M involves calling library functions.
The requirements for beginners include having a basic microcontroller foundation, such as 51 or AVR, and having previously written microcontroller programs in C language, but mastery is not required. Readers learning Cortex-M should not worry too much about their foundation; what we need more is the courage to learn and the determination to master Cortex-M. Ask yourself, when we first started learning the simplest microcontroller, didn’t we also have no foundation? Did we stop our learning because of that? No. What we need to do is set a goal, take action, and persistently move towards that goal, enduring hardships along the way, which only you can understand.
1.4 How to Learn Cortex-M
I think this question is probably difficult to answer, as everyone has different foundations and learning methods, so the effectiveness of learning will naturally vary. However, regardless of the specifics, learning Cortex-M generally involves the following steps:
First step: Adapt to using firmware libraries for development, strengthen your ability to use C language, and establish project management awareness.
Second step: Familiarize yourself with the architecture of the Cortex-M series chips, understand the CMSIS standard, and get acquainted with the Cortex-M bus architecture.
Third step: Master various communication protocols such as I2C, SPI, SDIO, CAN, TCP/IP, etc. Once you have mastered these protocols, developing software drivers becomes relatively easy.
Finally, to facilitate everyone’s learning, I will continuously update a series of tutorials on Cortex-M, primarily focusing on the well-known STM32, but not limited to STM32; I will also cover some domestic MCUs, such as GD32.
The entire tutorial is mainly divided into five parts:
1. Introduction: Mainly introduces the basic concepts of Cortex-M, the hardware platform required for embedded development, and the setup and use of the Cortex-M development environment.
2. Basics: Mainly helps beginners quickly get started with Cortex-M, introducing knowledge about clocks, interrupts, storage, analog input/output, serial communication, SPI, I2C, etc. Using the example of lighting an LED, it deeply analyzes what firmware libraries are, why to use them, and how to use them. Starting from firmware libraries, creating projects, compiling, and downloading programs, it explains how to operate GPIO, allowing beginners to gradually enjoy the learning fun of Cortex-M. This section mainly discusses the on-chip peripherals of the MCU.
3. Peripherals: Classifies and explains commonly used sensors, communication devices, and other peripherals currently available on the market. The focus of this section is to explain the protocols involved with sensors or communication devices, as well as the relevant knowledge of the peripheral devices themselves. It mainly explains the usage methods of peripheral chips, including 24C04, FLASH chips, infrared transmission and reception, MP3, FM radio, USB communication, Ethernet, touch screens, etc.
4. System: Uses RT-thread as the development system, mainly explaining complex contents such as network protocol stacks and file systems;
5. Project: Mainly explains the basic processes and principles of embedded projects.
Learning embedded systems requires practice; I believe that as long as you persist and do not give up, you will definitely become a master of Cortex-M.
Leave a Comment
Your email address will not be published. Required fields are marked *