目录
嵌入式系统概念
嵌入式系统(Embedded system):
- 是为执行特定任务而设计的计算机系统
- 通常被嵌入在系统或设备中,而不是计算机中
例子1:路由器(network router)
It is a computing system dedicated to the task of routing packets in a network.
It is a standalone embedded system
它是一个专门用于网络中分组路由任务的计算系统。
它是一个独立的嵌入式系统
例子2 微波炉(microwave oven)
it is an electronic appliance which happens to contain a computing system to control its user interface and cooking time
The embedded system is the user interface/cooking controller
It is embedded within the microwave oven appliance
是一种电子电器,碰巧包含一个计算机系统来控制它的用户界面和烹饪时间
嵌入式系统是用户界面/烹饪控制器
它嵌入在微波炉电器中
嵌入式系统的主要组成:(具体之后详细讲)
- Input/output
-
- to communicate with sensors, actuators, displays etc. (与传感器、执行器、显示器等进行通信)
- Processor(处理器)
-
- the computing engine (计算引擎)
- [Optional] Hardware acceleration (邮件加速器)
-
- E.g. ASICs, FPGAs, AI accelerators, etc
- Firmware (固件)
-
- embedded software
嵌入式系统在哪些方面与其他电脑系统不同?
- Task specific, not general purpose 特定用途
- real time 实时
it has deadlines for system response to an input 有系统响应输入的截止日期
Outputs must be both correct and on time
Predictable vs. fast - fault handling 故障处理
- power and operating environment 电源和操作环境
- cost 成本
- range of processor types 处理器种类
4, 8, 16, 32 bit
About 98% of all 32-bit processors are used in embedded systems, not PCs. - Resource constrained 资源限制
例子: PIC16F876A has just 368 Bytes of data memory
Often few input buttons and simple displays. Greatly affects software design.
只有少量输入和简单显示,影响软件设计。 - Program code in ROM
Affects data initialization, debugging. 影响数据初始化和调试
ps: ROM(只读内存(Read-Only Memory)简称)。ROM所存数据,一般是装入整机前事先写好的,整机工作过程中只能读出,而不像随机存储器那样能快速地、方便地加以改写。 - Specialized development/debugging tools 专门的开发调试工具
Cross compiler/assembler 交叉编译器/汇编器
Emulator 模拟器
In-Circuit Debugger 电路内置调试器
Processor Technology 处理器技术
三种处理器 processor
- GPP
General Purpose Processor 通用处理器
Programmable for any application
Usually requires external support hardwar
可为任何应用编程,通常需要外部支持 - ASIP
Application Specific Instruction Processor 特定应用指令处理器
Optimized for specific application areas, but still software programmable
针对特定的应用领域进行优化,但仍可通过软件进行编程 - SPP
Single purpose processor 单用途处理器
Optimized for one specific task only with no flexibility.
Algorithm “hard coded” in finite state machine, not software programmable.
只针对一个特定的任务进行优化,没有灵活性。
算法“硬编码”在有限状态机中,不是软件可编程的。
处理器指令集
ISC(复杂指令集计算)例如 Intel x86 family
- The main goal is to complete a task with as few instructions as possible
主要目标是用尽可能少的指令完成一项任务。 - 处理器硬件更为复杂,每条指令可能有一系列底层操作(underlying operations)
RISC(精简指令集计算)例如:ARM Advanced RISC Machine
- The focus is on really simple instructions that can be executed in one instruction cycle
重点是可以在一个指令周期内执行的非常简单的指令 - 硬件被简化,编译器承担更多的工作
Memory architecture 内存架构
体系结构 | 结构 | 特点 |
---|---|---|
冯·诺依曼 | 程序和数据共用一个存储空间;采用单一的地址及数据总线。 | 执行指令时, 先从储存器中取指解码,再取操作数执行运算,即使单条指令也要耗费几个甚至几十个周期,在高速运算时,在传输通道上会出现瓶颈效应。 |
哈佛 | 程序和数据存储在不同的存储空间中,每个存储器独立编址、独立访问。 | 分离的程序总线和数据总线可允许在一个机器周期内同时获取指令字(来自程序存储器)和操作数(来自数据存储器),从而提高执行速度,提高数据的吞吐率。因此取指和执行能完全重叠,具有较高的执行效率。 |
在给定的时钟速度下,如果没有内存缓存(典型的低端处理器),哈佛架构将允许更快的执行,因为指令和数据可以同时读取
总线 bus
字长(word size),是CPU一次能处理的二进制数的位数
位宽(bit wide),就是内存或显存一次能传输的数据量
数据总线 data bus 单位:bit,D
(1) 是CPU与内存或其他器件之间的数据传送的通道。
(2)数据总线的宽度决定了CPU和外界的数据传送速度。
(3)每条传输线一次只能传输1位二进制数据。eg: 8根数据线一次可传送一个8位二进制数据(即一个字节)。
(4)数据总线是数据线数量之和。
地址总线 address bus 单位:bit,A
(1)CPU是通过地址总线来指定存储单元的。
(2)地址总线决定了cpu所能访问的最大内存空间的大小。eg: 10根地址线能访问的最大的内存为1024位二进制数据(1024个内存单元)(1B)
(3)地址总线是地址线数量之和。
控制总线
(1)CPU通过控制总线对外部器件进行控制。
(2)控制总线的宽度决定了CPU对外部器件的控制能力。
(3)控制总线是控制线数量之和。
总结:
地址总线的宽度决定CPU的寻址能力;
数据总线的宽度决定CPU与其他元器件一次最大传送的数据量;
控制总线决定CPU对其他元器件的控制能力。
与嵌入式相关
- D determines the native integer si