Basics of Assembly

Aus C und Assembler mit Raspberry
Version vom 23. August 2024, 11:03 Uhr von Satyria (Diskussion | Beiträge) (→‎The ARM Assembler)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Assembler is a programming language designed for the specific instruction set of a particular processor. This programming language was developed by Nathaniel Rochester between 1948 and 1950 and represents the second generation of processor programming. Previously, programming had to be done with very obscure numeric codes. Assembler code is more readable than the binary codes of machine language. Commands and their operators are represented in text form. Assembler is used to convert assembler code into machine language so that it is readable by the processor. Nowadays, assembler programs are available for all processors.

An advancement of simple assembler is macro programming. Here, certain sequences of code can be programmed into a single command, and the assembler replaces the command with the corresponding code sequence.

One can assume that an assembler program is almost a 1:1 copy of machine language. High-level languages usually use a generalization of commands that are no longer processor-dependent. These high-level languages often translate their code into another language (usually assembler), thus producing executable code. This is also the problem with high-level languages: since they use general commands and are designed to work in many operating environments, the compiler has to make compromises that can affect efficiency. However, many compilers are very good and utilize the capabilities optimally, making it often difficult to see improvements.

The ARM Assembler

As the title of this book suggests, we will be dealing with the ARM processor and the ARM assembler. Additionally, I will create programs for the Raspberry Pi 4 and Raspberry Pi 5 to specifically address this assembler.

First, one must know what ARM is. The ARM architecture was originally developed in 1983 by the computer company Acorn and later further developed by ARM Limited. The company itself does not produce its own processors but licenses the technology to other semiconductor companies. As a result, the ARM architecture is found in many processors. This type of processor is used in mobile devices due to its low power consumption, including mobile phones, PDAs, and routers. This architecture is of great importance in smartphones, as most operating systems support ARM. This processor type is also popular in portable game consoles, stationary consumer electronics, and the automotive industry. Additionally, it is used in IoT devices (single-chip systems); the best example is the Raspberry Pi, which contains an ARM microprocessor from Broadcom.

For the Raspberry Pi, there are now several generations that use different ARM processors. An overview can be found in the appendix.

In the chapter "Raspberry Pi 4," we will mainly deal with the Raspberry Pi 4, which is equipped with a Broadcom BCM2711 processor. This processor is based on the Cortex-A72 CPU family and uses the ARMv8 architecture, which is designed for 64-bit. However, it is backward compatible, so we can also refer to the ARMv7 architecture.

In the chapter "Raspberry Pi 5," we will work in 64-bit assembler. This uses the Broadcom BCM2712 processor, which is based on Cortex-A76 and utilizes the ARMv8.2-A architecture. But enough of this information for now. If you want to know more, you can find almost infinite information on the internet.

To finally get started, we first need to set up a programming environment. We need to pay attention to the respective Raspberry Pi, and the following chapters are described under the respective Raspberry Pi.


< Back (Preface) < Home > Next (Setting up the Programming Environment (Console)) >