Beginner-Friendly Embedded Concepts and Hardware Composition

1. Concepts of MPU, MCU, SoC,

Application Processors

https://www.microcontrollertips.com/microcontrollers-vs-microprocessors-whats-difference/

https://www.microcontrollertips.com/difference-microprocessors-application-processors/

In an electronic system, the processor occupies the most important position, known as the Central Processing Unit: CPU (Central Processing Unit). It reads data from IO devices, processes it, and then displays it.

There are two development paths for CPUs: MPU and MCU.

MPU is just a processor and requires many other peripherals to form a system;

MCU integrates a processor, memory, Flash, and other modules, and can form a system with only a few peripherals.

The MPU route was very popular in the 1980s, and microcomputers and game consoles were using MPUs. For example, Motorola’s 68000 chip was a mainstream microprocessor (MPU). The following image shows a circuit board from the Alpha Micro AM-1000 series, where the largest chip in the middle of the right side is the MPU 68000.

Beginner-Friendly Embedded Concepts and Hardware Composition

Later, the MPU gradually declined, and it can be said that now only Intel and AMD’s x86 series CPUs remain. These CPUs are becoming increasingly complex, making it inappropriate to refer to them as “microprocessors”. In the personal computer field, you can see motherboards like the one shown below. By inserting the CPU, memory modules, sound cards, etc., a computer is formed. The entire motherboard is large and complex to manufacture:

Beginner-Friendly Embedded Concepts and Hardware Composition

The MCU route integrates the CPU, memory, and Flash on a single chip, and with other external devices, a complete system can be built. The development of MCU has gone through 8-bit 8051 microcontrollers, 16-bit AVR microcontrollers, 32-bit STM microcontrollers, etc.:

Beginner-Friendly Embedded Concepts and Hardware Composition

We typically use the 51 microcontroller and STM32 microcontroller to handle relatively simple tasks, with limited application scenarios. The main chip in our mobile phones is much more complex, as it contains both a CPU and a DSP for data processing, as well as a GPU for graphical display. The circuit boards designed using such main chips are even more complex and can perform at levels comparable to personal computers:

Beginner-Friendly Embedded Concepts and Hardware Composition

To distinguish from personal computers, electronic products that use a chip containing a CPU are referred to as embedded systems, embedded products, or embedded boards.

Embedded boards are a type of computer with a different shape, and compared to computers, several concepts can be introduced:

1. CPU (Central Processing Unit)

The central processing unit, in PCs, is an independent chip.

In embedded systems, it is a unit within the chip, along with other modules such as USB, UART, and audio.

The well-known three-stage pipeline: fetch, decode, execute refers to the CPU, and the operating principles of almost all CPUs can be divided into four stages: Fetch, Decode, Execute, and Writeback.

The CPU fetches instructions from memory or cache, places them into the instruction register, decodes the instructions, and executes them. The programmability of a computer mainly refers to programming the CPU.

2. MPU (Micro Processor Unit)

The microprocessor unit serves the same purpose as the CPU used in PCs, but it is just a processor that requires memory, Flash, and other peripherals to function.

Currently, apart from CPUs in personal computers, MPUs are almost nonexistent. Moreover, we generally do not refer to the CPU in a computer as an MPU, as it is quite large and not ‘micro’.

3. MCU (Micro Controller Unit)

The microcontroller unit, sometimes referred to as a single-chip microcontroller.

The MCU integrates a processor and various modules, such as USB controllers, UART controllers, memory, Flash, etc. It can build an electronic system with just a few external components.

Chips like C51 and STM32 are all MCUs.

The internal memory or Flash of MCU chips typically ranges from a few KB to several hundred KB or a few MB, meaning that external memory or Flash is generally unnecessary.

4. Application Processors

The main chip in mobile phones is similar to an MCU, as it also integrates a processor and various modules. However, its performance has greatly improved, allowing it to connect to several GB of memory and Flash.

In mobile phones, this main chip is generally used for display processing, input, and running user programs, thus it is referred to as “Application Processors.”

The concept of “Application Processors” can be extended to other scenarios and is no longer limited to mobile phones.

Comparing with MCUs, Application Processors have the following differences:

a. More integrated modules:

° Application Processors integrate more modules internally, such as DSPs for data processing, GPUs for graphical display, and even multiple processors.

° This introduces a concept of “System on Chip” (SoC), which means that a complete system can be built on a single chip.

° However, this concept is quite broad in everyday use: MCU chips can also be referred to as SoCs, and Application Processors can also be considered SoCs, even if they must connect to memory/Flash and other peripherals to operate.

° In previous documents, when SoC was mentioned, it referred to relatively complex systems; at that time, MCUs were not considered SoCs since they were simpler. However, as time progresses, MCUs have become increasingly complex, so it is also acceptable to consider them as SoCs.

° In mobile phone circuit boards, the available space is very limited. Application Processors also need to be paired with memory chips to function, leading to the development of a technique called package-on-package (PoP): soldering the Application Processors onto the circuit board first and then soldering the memory chips on top of the Application Processors, effectively stacking two chips together.

b. Different operating systems:

° MCUs generally do not run operating systems or run small real-time operating systems (RTOS) that consume fewer resources.

° MCUs are typically used for tasks that require high real-time performance and for handling relatively simple tasks.

° Application Processors usually run more complex operating systems (like Linux) and operate multiple apps on top of the OS.

To summarize: the development of CPUs starts from MPUs and splits into two paths, one for dedicated CPUs (like the CPUs in our personal computers) and the other for integration, combining CPUs with other modules to form MCUs (microcontrollers), which further develops into AP (Application Processors). Note: Chips can be classified into two categories: MCU and AP, but in daily work, the corresponding counterparts of MCUs include AP and MPU, where MCUs are used for running microcontrollers, while AP/MPUs are used for running Linux operating systems. This might conflict with the previous summary, but we only need to understand that AP/MPUs are opposite to MCUs.

2. Harvard Architecture and Von Neumann Architecture

Beginner-Friendly Embedded Concepts and Hardware Composition

CPU architecture can be divided into Harvard architecture and Von Neumann architecture. In Harvard architecture, instructions and data are stored separately, allowing the CPU to read instructions and read/write data simultaneously. In Von Neumann architecture, instructions and data are stored together, requiring the CPU to read instructions and read/write data sequentially and not operate on instructions and data simultaneously.

ARM’s chips, ARM7 and earlier, use the Von Neumann architecture, while ARM7 and later use the “improved Harvard architecture.” The “improved Harvard architecture” is shown below:

Beginner-Friendly Embedded Concepts and Hardware Composition

In the “improved Harvard architecture,” instructions and data are mixed in external memory; during CPU operation, instructions are fetched from the instruction cache and data is read/written from the data cache.

3. Concept of XIP

eXecute In Place, local execution. It allows code to be run directly from its storage space without the need to copy it to memory.

4. Hardware Composition of Embedded Systems

In summary, an embedded system supports multiple device startups.

Questions arise:

a. The system supports SPI FLASH startup, which means it can run code on SPI FLASH.

b. However, SPI FLASH is not an XIP device, and the CPU cannot directly execute the code inside.

Here comes the question: How does the CPU execute code on SPI FLASH? Upon power-up, where is the first instruction executed by the CPU?

Answer:

a. ARM boards support various startup methods: XIP device startup, non-XIP device startup, etc. For example: Nor Flash, SD card, SPI Flash, and even support for UART, USB, and network card startups. Many of these devices are not XIP devices.

Question: Since the CPU cannot directly run code from non-XIP devices, how can it start from non-XIP devices?

Answer: After power-up, the first instruction executed by the CPU is located in the on-chip ROM, which is an XIP device. This program will perform necessary initializations, such as setting the clock and configuring memory; then it reads the program from the “non-XIP device” into memory; finally, it starts executing this program.

Speculation: ARM chips have many components; this is a system on chip (System on chip), for example: cpu rom ram memory controller --- ddr sd/mmc controller --- sd card spi controller --- spi flash usb controller --- usb storage device uart controller ...... interrupt controller

b. Comparing with PCs: CPU —- separate chip Startup device —- BIOS chip DDR —- separate pluggable module Storage device —- SATA hard drive, pluggable USB controller …

5. Overview of the Startup Process of Embedded Systems

The main chip has ROM, and the ROM program assists in starting from non-XIP devices. Taking SD card startup as an example. The CPU can only run programs from XIP devices, so what does the ROM program do? Clearly: the ROM needs to read the program from the SD card into memory (on-chip RAM or external DDR).

Things the ROM program needs to do:

a. Initialize hardware.

Initializing the clock to increase the speed of the CPU and peripherals; initializing memory: DDR needs to be initialized before use; initializing other hardware, such as watchdogs, SD cards, etc.

b. Copy the program from peripherals to memory.

b.1 With so many startup methods, SD card, SPI FLASH, USB DISK, how to choose? By jumper, select a specific device; or by jumper, select a list of devices and try them one by one in order, or not allow customer selection, trying them one by one in a fixed order.

b.2 With such a large memory, where to copy the program from SD card and other devices into memory? How long to copy? The program burned onto the SD card and other devices contains a header information specifying the memory address and length; or without allowing customer selection, the program is copied to a fixed location in memory with a fixed length.

b.3 How is the program stored on the SD card? As raw binary (raw bin), or saved as a file in a partition.

c. Execute the new program.

Beginner-Friendly Embedded Concepts and Hardware Composition

Beginner-Friendly Embedded Concepts and Hardware Composition

Beginner-Friendly Embedded Concepts and Hardware Composition

Beginner-Friendly Embedded Concepts and Hardware Composition

Leave a Comment