嵌入式系统01.pdf

嵌入式系统嵌入式系统 北京邮电大学 计算机科学与技术学院 邝 坚2007年9月 计算机系统结构 计算机应用技术 计算机软件与理论 A General Definition Embedded systems are computing systems with tightly coupled HW and SW integration that are designed to per a DEDICATED function The word embedded reflects the fact that these systems are usually an internal part of a larger system known as the embedding system Multiple embedded systems can coexist in an embedding system Real Time Concepts for Embedded Systems 嵌入式系统无所不在嵌入式系统无所不在 Something interesting A calculator Intel 4004 was intended for 当今的处理器中有当今的处理器中有95 是用于嵌入式应用是用于嵌入式应用 通常面向特殊应用通常面向特殊应用 Microcontrollers Network Firm real time missing a deadline has a non acceptable quality reduction as a consequence Soft real time deadlines may be missed and can be recovered from The reduction of system quality is acceptable Non real time no deadlines have to be met Hard and Soft Real Time DeadlineDeadline Valuue Structure of real time system Job List Trigger Generator cution Actuators ClockDisplay Management Environment Keep in mind 即使在同一个实时系统内 对不同事件处 理的实时性要求也是不同的 即使在同一个实时系统内 对不同事件处 理的实时性要求也是不同的 事件的分类 事件的分类 Synchronous Events 周期性的 系统可 预见下一次同类事件发生的时刻 周期性的 系统可 预见下一次同类事件发生的时刻 Asynchronous Events 非周期性的 事件 发生的时间不可预测 非周期性的 事件 发生的时间不可预测 如何处理 如何处理 Real Time Embedded System Embedded Real time System Real time System Soft Real time Hard Real time RT mission in a car SteeringSteering brakesbrakes RadioRadio lightslights DoorsDoors WindowsWindows HW core Architectures Embedded Microprocessor What is Embedded Microprocessor A programmable processor whose programming interface is not accessible to end user of the product The only user interaction is through the actual application From GP Processor to Embedded Processor Focuses on perance that not achievable with GP processor Network Telecom equipment Focuses on size power and price PDA interactive and display intensive rather then computation intensive Focuses on special DSPs Graphics Processors Media Processors Microprocessors Cost Perance 通用微处理器 嵌入式微处理 器 DSP 微控制器 FEATURES 1 Powerful support for Real Time Multi Task 2 Great memory protect ability 3 Processor architecture is expandable 4 Low power consumption Embedded Processors ARM PowerPC X86 MIPS 68K SH3 SH4 8260 Example Application What is an Example Application Quad T1 Framer Quad T1 Framer TDM0 TDM7 155 Mbps ATM PHY MII Transceiver Framer UTOPIA Multi PHY 10 100BaseT E3 clear channel a TDM required Slow Comm PHY SMC I2C SPI SCC Channelized data up to 256 channels 60 x bus SDRAM DRAM SRAM FLASH ATM Connection Tables optional Local bus SDRAM DRAM SRAM Local Bus Slaves DSP bank Remote Access Server MPC8260 The Architecture in Focus The Architecture in Focus SW Core RTOS The SW Plat What s RTOS RTOS Program that schedule cution in a timely manner manage system resources and provide a consistent foundation for developing application code How about GPOS KEY Real time Highly modularized MultiTasking High perance HW dependence It s heart of real time system RTOS vs GPOS Reliable predictable high perance compact and scalable 实时性 实时性 大多数嵌入式系统工作在实时性要求很高的环境 中 对外部事件的响应 包括数据的获取 处理和数据的输 出都必须在deadline规定的时间内完成 这就要求实时嵌入 式操作系统必须将实时性作为一个重要指标 小型化 可裁减 小型化 可裁减 嵌入式系统所能提供的资源有限 所以 实时嵌入式操作系统必须做得小巧 以满足嵌入式系统的硬 件限制 同时必须能够根据应用的要求进行裁减 去除多余 的部分 或者简化相应的模块 强稳定性 强稳定性 与桌面系统不同 大多数嵌入式系统一旦开始 运行就不需要人过多的干预 在这种条件下 要求作为系统 资源总管的操作系统具有较高的稳定性 RTOS vs GPOS 固化代码 固化代码 在嵌入式系统中 操作系统与应用软件代码通 常被固化在嵌入式系统的ROM中 目前辅助存储器 如磁 盘 在嵌入式系统中很少使用 因此 实时嵌入式操作系 统的文件管理功能应该能够很容易裁减 取而代之的是各 种内存文件系统 弱交互性 弱交互性 除消费类电子设备以外 大多数嵌入式系统的 工作过程不需要人的干预 因此多数实时嵌入式操作系统 所提供用户操作接口相对简单 主要通过系统调用命令向 用户程序提供服务 专业化强 专业化强 每一种实时嵌入式操作系统通常面向特定类型 或几种相近类型应用 某些操作系统会根据不同的应用对 象采用不同的模块搭配 有些操作系统甚至是自行研制的 内部产品 RTOS improvement 1 Baby embedded arithmetic 主要通过中断控制调度系统运行 具有Real Time特征 但一般不具备Task或进程概念 更不具备完备的信息传递方式 存储管理方式 较为简陋 没有用户接口 一般用于可编程控制器 提供监测 饲服或指 示等基本功能 RTOS improvement 2 YA embedded RT cutive 提供embedded core 提供基于优先级的 Task或进程调度 支持存储管理 消息驱动 定时器等RTOS的基本功能 但用户接口简 单 没有集成开发环境 一般不提供高级应用 模块 其代码的硬件相关性一般为100 一般用于嵌入式处理机 主要用于自动控制或 小型嵌入系统 RTOS improvement 3 Man RTOS 具备强大的通用型OS功能 如文件 目录管 理 设备支持 网络支持 用户界面 图形接 口等 具有丰富的API和嵌入式开发工具 提 供完备的集成开发环境和调试环境 运行于各种类型功能强大的微处理器上 所实 现的嵌入系统已能完成几乎所有其它计算机系 统所能实现的功能 而性能和稳定性却比之强 许多倍 评价指标评价指标 任务切换时间 任务切换时间 Task switch time 系统中两个具有相同优先级任 务之间切换所需要的平均时间 抢占时间 抢占时间 Preemption time 时间 时间 系统中某个高优先级任务抢占 低优先级的任务花费的平均时间 中断等待时间 中断等待时间 Interrupt latency time 从CPU收到中断请求到执 行中断服务程序的第一条指令所用的时间 信号量延迟时间 信号量延迟时间 Semaphore shuffle time 从一个任务释放信 号量到另一个等待信号量的任务被激活的时间延迟 死锁解脱时间 死锁解脱时间 Deadlock break time 指系统解开死锁所需的平 均时间 造成死锁的原因是高优先级任务抢占某一低优先级任务后 进 而需要刚刚被抢占任务所拥有的资源 任务间消息传递延迟 任务间消息传递延迟 Intertask message latency 非零长度消 息在任务间传递的操作系统内部延迟时间 数据报吞吐量 数据报吞吐量 Datagram throughput time 任务间利用操作系 统通信原语传递数据 每秒所传送的字节数 RTOS List 1 Microware System Crop OS 9 Microtec ResearchVRTX 3ComPalm OS CMX System IncCMX Accelerated Technology Inc Nucleus Plus MicrosoftWindowsCE Wind RiverTornado VxWorks ISI to Wind RiverpSOSystem IntelRMX RTOS List 2 QNX Software System Ltd QNX Embedded Power CorporationRTXC uCLinux RTLinux 嵌入式嵌入式Linux ChinaPencil 北