Embedded Systems Applications
Embedded systems development environment
Embedded software build process is a transformation performed by software running on a general purpose computer.
The compiler, assembler, linker and locator are all pieces of software that run on a host computer, rather than on the embedded system itself. Finally executable image run on a target embedded system.
Host (Development) machine communicate to the target various types of interfaces like UART, Ethernet and USB.
Types of computer architectures
- Based on Program Memory and Data Memory (Harvard and Von Neumann computer architectures)
- Based on Mechanism (RISC and CISC)
- Based on Data transfer to the Memory (Little Endian and Big Endian)
- Based on Types of Address (I/O mapped I/O and Memory Mapped I/O)
- Based on Instruction Set
Harvard and Von Neumann computer architectures
- It is named after the mathematician and early computer scientist John Von Neumann. The computer has single storage system memory) for storing data as well as program to be executed.
- There is no real difference between data and instructions.
- Data and instructions share the same memory.
- Processor needs two clock cycles to complete an instruction. Pipelining the instructions is not possible with this architecture.
- In the first clock cycle the processor gets the instruction from memory and decodes it. In the next clock cycle the required data is taken from memory. For each instruction this cycle repeats and hence needs two cycles to complete an instruction
- The name is originated from “Harvard Mark I” a relay based old computer.
- The computer has two separate memories for storing data and program.
- Processor can complete an instruction in one cycle if appropriate pipelining strategies are implemented. In the first stage of pipeline the instruction to be executed can be taken from program memory. In the second stage of pipeline data is taken from the data memory using the decoded instruction or address.
- Most of the modern computing architectures are based on Harvard architecture. But the number of stages in the pipeline varies from system to system.
RISC and CISC:
CISC | RISC |
Many complex instructions | Simple instructions, few in Number, Few addressing modes |
Variable length instructions | Fixed length instructions |
Many instructions can access memory | Only LOAD/STORE instructions access memory |
mov ax, 10 mov bx, 5 mul bx, ax |
mov ax, 0 mov bx, 10 mov cx, 5 Begin add ax, bx loop Begin |
The total clock cycles for the CISC version might be: (2 movs × 1 cycle) + (1 mul × 30 cycles) = 32 cycles |
While the clock cycles for the RISC version is: (3 movs × 1 cycle) + (5 adds × 1 cycle) + (5 loops × 1 cycle) = 13 cycles |
Example: x86 ISA | Examples: ARM, MIPS, PowerPC (IBM), SPARC (Sun) |
Little Endian and Big Endian
Little Endian | Big Endian |
“Little Endian” means that the lower-order byte of the number is stored in memory at the lowest address, and the high-order byte at the highest address. | “Big Endian” means that the high-order byte of the number is stored in memory at the lowest address, and the low-order byte at the highest address. |
For example, a 4 byte Integer Byte3 Byte2 Byte1 Byte0 will be arranged in memory as follows: Base Address+0 Byte0 Base Address+1 Byte1 Base Address+2 Byte2 Base Address+3 Byte3 |
The same 4 byte integer would be stored as: Base Address+0 Byte3 Base Address+1 Byte2 Base Address+2 Byte1 Base Address+3 Byte0 |
Intel processors (those used in PC’s) use “Little Endian” byte order. | ARM processors (those used in PC’s) use “Big Endian” byte order. |
I/O mapped I/O and Memory Mapped I/O:
I/O Mapped I/O | Memory Mapped I/O |
Separate address bus for I/O and memory. | Common address bus for I/O and Memory. |
Support IN and OUT Assembly Instructions. | There are no separate IN & OUT instructions. What are the instructions are to communicate memory same instructions useful to communicate I/O. |
Separate control lines for I/O. IOR and IOW | No separate control Lines for I/O. Memory control lines only MEMR, MEMW. |
Register Plus Memory Architecture and Load Store Architecture
Register Plus Memory | Load Store Architecture |
Allows operations to be performed on (or from) memory, as well as registers. If the architecture allows all operands to be in memory or in registers, or in combinations, it is called a “register plus memory” architecture. |
load/store architecture divides instructions into 2 categories: • Memory access (load and store between memory and registers). • ALU operations (which only occur between registers). |
Example: ADD M ; A <- A + [M | Example: ADD r3,r2,r1 |
Embedded Hardware
Hardware Required | Desktop Computer | Simple Embedded Computer Ex: remote Controller |
Complex Embedded Computer Ex: Mobile Phone |
Processor (Bus Width) |
High end processor 32 bit/ 64 bit Ex: Intel Processor |
Low End Processor 8 bit/16 bit Ex: 8051 (8 bit) ARM Cortex M4 |
High end processor 32 bit/ 64 bit Ex: ARM Cortex A9 |
CISC or RISC | CISC | RISC | RISC |
Caches and MMU | Yes | No | Yes |
Memory | 2G to 64 GB | 32KB to 128 MB | 128 MB to 4GB |
Multiprocessor | Supports Dual Core/ Quad Core/ Hexa Core | Doesn’t support Multicore | Supports Dual Core/ Quad Core/ Hexa Core |
Sensors | Doesn’t Support Sensor interface | Support Sensors Interface | Support High end sensors interface |
External Device Interface | Supports | Once Device manufactured, can’t interface new device to the target. | Once Device manufactured, can’t interface new device to the target. |
Embedded Software
Software Layers in the Computer
Software Required | Desktop Computer | Simple Embedded Computer Ex: remote Controller |
Complex Embedded Computer Ex: Mobile Phone |
Software layers in the Computer | |||
Operating System | Windows/Linux | Doesn’t Support OS. | Supports Windows/Linux/Android |
Firmware | BIOS | Whole system develops using firmware | Bootstrap program |
Programming Languages | C/C++/Java/html/ php |
Assembly/C | Assembly/C/C++/Java/ html/php |
At the lowest level are programs that are run by the processor when the computer first powers up. These programs initialize the other hardware subsystems to a known state and configure the computer for correct operation. The software, because it is permanently stored in the computer’s memory, is known as firmware.
Above the firmware, the operating system controls the operation of the computer.
Firmware:
Firmware is software that is programmed into chips permanent/temporary and usually performs basic instructions, like BIOS, for various components, Network cards, and computer BIOS, etc…
Embedded C Programming is also called Firmware.
Embedded C vs General C:
- C is a widely used general purpose high level programming language mainly intended for system programming.
- Embedded C is an extension to C programming language that provides support for developing efficient programs for embedded devices.
- Embedded C has to use with the limited resources, such as RAM, ROM, I/Os on an embedded processor.
Operating System
An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs.
Kernel
Kernel is core part of the operating system. Kernel provides core service like Process management, Memory management, File management, Device and network services.