嵌入式操作系统 《ARM System Developer's Guide》
来源:互联网 发布:淘宝牙齿矫正器的好处 编辑:程序博客网 时间:2024/06/06 03:12
本章包含两部分:
1. 讲述组成嵌入式操作系统的基础组件和关于ARM处理器的特殊问题
2. 通过简单的嵌入式操作系统Simple Little Operating System(SLOS) 来看看基础组件的实现
Fundamental Components
Example:Simple Little Operating System
以上就是7种嵌入式操作系统的基础组件。本部分通过实例SLOS来展现基础组件的具体实现。
Initialization
There are three main stages pf initialization SLOS.(具体内容见p385)
1. startup-sets up FIQ registers and SVC,System,IRQ mode stacks.
2. PCB stepup code-initialize PCB,which contains task’s states and all registers
3. C initialization code-initialize device driver, event handler and periodic timer
Memory Model
(具体图片见p390)
We adpoted a simple memory model for SLOS.Code portion are located in low momery.The stacks for IRQ and for each task are loacted in high memory.SVC stack is located in top of memory.The arrows in the memeory show the dirction of stack growth.
Interrupts and Exceptions Handling
我们仅仅使用了3种异常,其余异常handler均设置为dummy handlers。
Reset
理论上可以用其重新初始化系统,例如在响应watchdog的时候对系统进行重启。
SWI
SWI指令强制processor从user模式进入SVC模式。在SWI handler中保存相应寄存器值并且跳转到C handler进行相应处理,r0包含SWI number,r1指向 存储在SVC stack中的寄存器。
(代码见p392)
IRQ
IRQ handler比SWI handler简单很多。是一种基础的无嵌套中断handler。The handler first saves the context and then copied the contents of the interrupt contrller status register,INTPND,int register r0.If r0 is matched with a particular interrupt source, then the service routine is called.
最简单的例子:
eventsTickVener BL eventsTickService; //reset tick hardware B kernelScheduler; //branch to scheduler
解释:当发生定时器中断时,重置定时器的值,并且执行了一次内核调度。
Scheduler
The low-level shceduler, or dispatcher, used in SLOS is a simple round-robin algorithm.following:
//pseudocodetask t = 0;task t';scheduler(){ t' = t + 1; if(t' == MAX_NUMBER_OF)TASKS) { t' = 0; } ContextSwitch(t, t');}
执行Scheduler的结果如下:
1. PCB_PtrCurrentTask指向当前激活的PCB的地址
2. PCB_PtrNextTask指向下个激活的PCB的地址
3. PCB_CurrentTask holds the value of the next task identifier
Context Switch
通过使用scheduler更新后的信息,context switch完成task t和task t’之间的切换。为完成切换,需要经过two stage:(图解见p396)
stage-1 Save the Current Context
作用:
1. reset the IRQ stack and save it to PCB_IRQStack
2. The user mode registers for task t are saved to the current PCB
stage-2 Load the Next Context
作用:
1. transferring the PCB for t‘ into the banked user mode registers
2. The IRQ stack is restored to the original setting before entering the IRQ handler
Device Drive Framework(DDF)
DDF通过SWI instructions实现。DDF通过避免应用直接访问hardware来保护操作系统,and provide a uniform standard interface for tasks.If a task wanna to access a device ,it must first obtain a unique indentification number(UID).UID一般用于确定没有其他任务访问同一个设备。
SWI指令能作为从非特权模式切换到特权模式的一种方法。(p400图演示任务访问设备的流程)一旦SWI指令被执行,processor进入SVC模式,并且自动失能IRQ中断。
- 嵌入式操作系统 《ARM System Developer's Guide》
- Chapter10 Firmware 《ARM system developer's guide》
- 【原创】ARM System Developer's Guide 读书笔记-前言
- Chapter9-2.Interrupts 《ARM system developer's guide》
- Chapter9-3.Interrupt handling schemes 《ARM system developer's guide》
- Caches 《ARM System Developer's Guide》chapter-12
- Optimized Primitives 《ARM System Developer‘s Guide》Chapter-7
- Digital Signal Processing 《ARM System developer’s Guide》Chapter-8
- 理解write buffer与cache的好文章--摘自Arm system developer's guide chapter 12
- MPU(Memory Protection Units) 《ARM System Developer's Guide》Chapter-13
- Symbian Developer's Guide
- Ruby Developer's Guide
- ZK Developer's Guide
- Application developer's guide
- The Developer's Guide
- BTrace Developer's Guide
- UIX Developer's Guide
- Hibernate Developer's Guide Updated
- Populating Data Model
- Qt入门一之创建项目
- 视音频数据处理入门:UDP-RTP协议解析
- iOS安全系列之二:HTTPS进阶
- 读取properties 配置文件
- 嵌入式操作系统 《ARM System Developer's Guide》
- 同一个布局文件id命名重复
- Servlet 3.1 新特性示例
- 【蓝牙BLE】cc2540主机获取广播包存在的一些问题。
- 深入C++的new
- Qt 安装
- Java学习笔记(48)------------泛型详解
- KEIL MDK中的RO、RW和ZI DATA
- Java 8 中的 Streams API 详解