嵌入式系统架构软体设计课件.ppt
- 【下载声明】
1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
3. 本页资料《嵌入式系统架构软体设计课件.ppt》由用户(三亚风情)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 嵌入式 系统 架构 软体 设计 课件
- 资源描述:
-
1、嵌入式系统架构软体设计嵌入式系统架构软体设计 -using ARMDay#3,#4,#5 Modules Outline嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARM课程介绍课程介绍q Day#3 Simple RISC Assembly Language ARM Assembly Language ARM Development Suite 使用练习q Day#4 Arm Instruction set Important ASM Programming Skills ARM/THUMB/C Interworkingq Day#5 ARM Exception Handler
2、 Build ARM ROM Image Use NET-Start!ucLinux BSP嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARM嵌入式系统产品设计流程概观嵌入式系统产品设计流程概观嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMq ARM system-on-chip Architecture,2nd ed.q ARM architecture reference manual,2nd ed.q ARM Development Suite-Getting Startedq ARM Development Suite-Developer Guideq
3、ARM Development Suite-Assembler Guideq uclinux.org/q 2019嵌入式系统开发经验q Building powerful platform with Windows CEq Software Engineering,A practitioners Approach 3rd ed.q Professional Symbian Programming嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARM嵌入式系统架构软体设计 -using ARMModule#3-1:Simple RISC Assembly Concept嵌入式系统架构软
4、体设计嵌入式系统架构软体设计-using ARMRISC精简指令集精简指令集vs.CISC复杂指令集复杂指令集Hardware instruction decode logicPipeline executionSingle executionLarge microcode ROMs to decode instructionAllow little pipelineMany cycles to completer a single instructionA smaller die sizeA shorter development timeA higher performance Poor
5、code densityClockFetchDecodeRegisterALUMEMWriteFetchDecodeRegisterALUMEMWriteFetchDecodeRegisterALUMEMWriteRISC(e.g.ARM)CISC(e.g.x86)FetchDecodeRegisterALUMEMWrite嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMMUO 一个简单的处理器一个简单的处理器PCIRACCMEMControlALUAddress busData bus硬体单元功能PCProgram CounterACCAccumulatorALUArithm
6、etic logic unitIRInstruction register嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMMUO指令集与资料路径指令集与资料路径指令Opcode功能LDA S0000ACC=memSSTO S0001memS=ACCADD S0010ACC=ACC+memSSUB S0011ACC=ACC-memSJMP S0100PC=SJGE S0101If ACC=PC=SJNE S0110If ACC!=0 PC=SSTP 0111stopOpcodeS4 bits12 bits指令规则PCIRACCMEMControlALUAddress busDat
7、a bus嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARM指令执行范例指令执行范例PCIRACCMEMControlALUAddress busData busqADD 0 x16AACC:=ACC+mem0 x16A嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARM运算范例运算范例C function:Main()C=A+B;MUO 机器指令LDA 0 x100ADD 0 x104STO 0 x108指令Opcode功能LDA S0000ACC=memSSTO S0001memS=ACCADD S0010ACC=ACC+memSSUB S0011ACC=ACC-
8、memSJMP S0100PC=SJGE S0101If ACC=PC=SJNE S0110If ACC!=0 PC=SSTP 0111stopPCIRACCMEMControlALUAddress busData bus0 x100ABC0 x1040 x108嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARM练习:练习:MUO微处理器的运算微处理器的运算0 x100 LDA 0 x1000 x002 SUB 0 x1040 x004 STO 0 x1000 x006 JNE 0 x0000 x008 STP请描述此段程式的动作,暂存器值的变化、与资料流。请用C语言来写出这段程
9、式码。PCIRACCMEMControlALUAddress busData bus0 x0001113140 x0020 x0040 x00610100120 x1080 x1040 x100指令Opcode功能LDA S0000ACC=memSSTO S0001memS=ACCADD S0010ACC=ACC+memSSUB S0011ACC=ACC-memSJMP S0100PC=SJGE S0101If ACC=PC=SJNE S0110If ACC!=0 PC=SSTP 0111stop嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARM嵌入式系统架构软体设计 -usin
10、g ARMModule#3-2:ARM Assembly Language嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMARM7TDMI资料流资料流e.g.r3:=r4+(r4,2)ADD r3,r4,r4,LSL#2 A bus B busAddress RegisterRegister BankMultiplierBarrelShifter32 Bit ALUDecode Stage instruction DecompressionRead DataRigisterWrite DateRegisterIntroductionDecoderandControlLogicB
11、BUSABUSALUBUSAdress IncrementerincrementerABEPCA31:0PC UpdateDBED31:0BIGENOMCLKnWAITnRWMAS1:0ISYNCnIRQnFIQnRESETABORTnTRANSnMREQSEQLOCKnM4:0nOPCnCPICPACPB嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMARM 的暂存器的暂存器q30 general-purpose,32 bits registersq1 Program Counter(PC)q1 Current Program Status Register(CPSR)q5
12、Saved Program Status Registers(SPSR)User mode FIQ mode irq mode SVC mode abort mode undefined mode嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMProgram Status Registerq CPSR:Currrent Program Status Regiterq SPSR:Saved Program Status Registerq Condition code flags -N:Negative rsult from ALU -Z:Zero result from ALU
13、 -C:ALU operation Carried out -V:ALU operation overflowedq Inerrupt Disable bits-I:disable the IRQ-F:Disable the FIQq T bit-Architechture xT only-T=0:ARM state-T=1:Thumb stateq Q:Stickly Overflow flag-Architecture 5TE only-QADD,QSUBqJ:Processor in Jazelle stateArchitecture 5TEJ onlyqMode bitsSpecify
14、 the processor mode10000 User10001 FIQ10010 IRQ10011 SVC10111 Abort11011 Undef11111 System31 30 29 28 27 24 7 6 5 4 0N Z C V Q J undefined I F T mode嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMProgram counter R15q ARM state:All ARM instructions are four bytes long(one 32-bit word)and are always aligned on a wor
15、d boundary.The PC value is stored in bits 31:2 with bits 1:0 undefined.q In Thumb state:All instructions are 16 bits wide,and halfword aligned The PC value is stored in bits31:1 with bits 0 undefined.q In Jazelle state:All instructions are 8 bits wide.The processor performs a word access to read 4 i
16、nstructions at once.嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMLink Register R14q Register 14 is the Link Register(LR).q This register holds the address of the next instruction after a Branch and Link(BL)instruction,which is the instruction used to make a subroutine call.q At all other times,R14 can be used as
17、 a general-purpose register嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMOther Register R0-R13q The remaining 15 registers have no special hardware purpose.q Their uses are defined purely by software.q By convention,ARM assembly language use R13 as Stack Pointer.q C and C+compilers always use R14 as the Stack Poi
18、nter(SP)嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMStructure of ARM Assembly Language ModuleAREA Sectionname,attr,attrStart of New code or data section.CODE:contain machine instructions.READONLY:section should not be written to.Other attr:DATA,NOINIT,READWRITE,Declares an entry point to a program.Labels.Declar
19、es the end of the source file.AREA ARMex,CODE,READONLY ;C:ARMADSv1_2Exampleasmarmex.s ;MOV r0,#10MOV r1,#3ADD r0,r0,r1MOV r0,#0 x18LDR r1,=0 x20026SWI0 x123456ENTRYstartstopEND嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMCalling Subroutines Uses BLq BL destination destination is the label on the first instructio
20、n of the subroutine.BL does:place the return address in the link register(R14)sets PC to the address of the subroutine.In the subroutine we can use“MOV pc,lr”to return.By convention,R0-R3 are used to pass parameters.嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMCalling Subroutines Example ;C:ARMADSv1_2Exampleasms
21、ubrout.s ;AREA subrout,CODE,READONLYENTRY startMOVr0,#10MOVr1,#3BLdoaddMOVr0,#0 x18LDRr1,=0 x20026SWI0 x123456stopdoadd ADD r0,r0,r1MOV pc,lrEND;name this block of code;mark first instruction;to execute;Set up parameters;Call subroutine;angel_SWI reason_report Exception;ADP_Stopped_ApplicationExit;A
22、RM semihosting SWI;Subroutine code;Return from subroutine.;Mark end of file嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMConstant Data Typesq Numbers Numeric constants are accepted in three forms:Decimal,for example,123 Hexadecimal,for example,0 x7B n_XXX where:n is as base between 2 and 9 xxx is a number in that
23、 base.q Boolean TRUE and FALSE must be written as TRUE and FALSE.q Characters constants consist of opening and closing single quotes X,enclosing either a single character or an escaped character,using the standard C escape characters.q Strings consist of opening and closing double quotes“XXXX”.If do
24、uble quotes or dollar signs are used within a string as literal text characters,they must be represented by a pair of the appropriate character.For example,you must use$if you require a single$in the string.The standard C escape sequences can be used within string constants.嵌入式系统架构软体设计嵌入式系统架构软体设计-us
25、ing ARMq Almost all ARM instructions can be conditionally executed.e.g.ADDS r0,r1,r2ADDEQ r0,r1,r2q Execute if the N,Z,C and V flags in the CPSR satisfy a condition specified in the instruction,otherwise,NOP.Conditional ARM Instructions指令名称条件XXXCC嵌入式系统架构软体设计嵌入式系统架构软体设计-using ARMq Almost every ARM in
展开阅读全文