嵌入式系统接口设计与应用2课件.pptx
《嵌入式系统接口设计与应用2课件.pptx》由会员分享,可在线阅读,更多相关《嵌入式系统接口设计与应用2课件.pptx(287页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、STM32F103MCU本课程的主要内容第1页/共287页主要内容Cortex-M3的总结STM32F系列的特点STM32F103系列的特点STM32F103的概述STM32F103的外特性STM32F103的内特性STM32F103的SFRSTM32F103的应用第2页/共287页主要参考资料STM32F103xxx_Datasheet.pdfSTM32F103xxx_Reference_Manual.pdfSTM32F103xxx_Library_Manual.pdfRVMDK 3.2第3页/共287页Cortex-M3的总结Cortex-M3的总结CM3NVIC第4页/共287页Cort
2、ex-M3的总结Cortex-M3的特性Cortex-M3 block diagram第5页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreARMv7-M architecture.The main features:Thumb-2 instruction set subset.Harvard Architecture with data load/store.Three-stage pipeline.Single cycle 32-bit multiply.Hardware divide.Thumb and Debug states.Handler m
3、odes and Thread modes.without the overhead of state saving and restoration between interrupts.Interruptible-continued LDM/STM,PUSH/POP.ARMv6 compatible BE8 and LE access support.ARMv6 compatible unaligned access support.第6页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreARMv7-M architecture.The main fea
4、tures:Low latency ISR entry and exit.Processor state saving and restoration,with no instruction fetch overhead.Exception vector is fetched from memory in parallel with the state saving,enabling faster ISR entry.Support for late arriving(迟来)interrupts.Tightly coupled interface to interrupt controller
5、 enabling efficient processing of late-arriving(迟来)interrupts.Tail-chaining(尾连)of interrupts,enabling back-to-back(背靠背)interrupt processing第7页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreRegisters The processor contains:13 general purpose 32-bit registers,R0 to R12Link Register(LR)-R14Program Counter
6、(PC)-R15Program Status Register,xPSRtwo banked SP registers.-R13第8页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreMemory interfaceThe processor has a Harvard interface to enable simultaneous instruction fetches with data load/stores.Memory accesses are controlled by:A separate Load Store Unit(LSU)that
7、decouples load and store operations from the Arithmetic and Logic Unit(ALU).A 3-word entry Prefetch Unit(PFU).One word is fetched at a time.This can be two Thumb instructions:one word-aligned Thumb 32-bit instruction;the upper/lower halfword of a halfword-aligned Thumb 32-bit instruction with one Th
8、umb instruction,or the lower/upper halfword of another halfword-aligned Thumb 32-bit instruction.第9页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreNVICThe NVIC is tightly coupled to the processor core.This facilitates low latency exception processing.The main features include:a configurable number of e
9、xternal interrupts,from 1 to 240a configurable number of bits of priority,from three to eight bitslevel and pulse interrupt supportdynamic reprioritization of interruptspriority groupingsupport for tail-chaining of interruptsprocessor state automatically saved on interrupt entry,and restored on inte
10、rrupt exit,with no instruction overhead.第10页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreBus matrixThe bus matrix connects the processor and debug interface to the external buses.The bus matrix interfaces to the following external buses:ICode bus.This is for instruction and vector fetches from code s
11、pace,it is a 32-bit AHB-Lite bus.DCode bus.This is for data load/stores and debug accesses to code space.it is a 32-bit AHB-Lite bus.System bus.This is for instruction and vector fetches,data LD/ST and debug accesses to system space.This is a 32-bit AHB-Lite bus.PPB.This is for data LD/ST and debug
12、accesses to PPB space.This is a 32-bit APB(v3.0)bus.第11页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreBus matrixThe bus matrix also controls the following:Unaligned accesses.The bus matrix converts unaligned processor accesses into aligned accesses.Bit-banding.The bus matrix converts bit-band alias ac
13、cesses into bit-band region accesses.It performs:bit field extract for bit-band loads;atomic read-modify-write for bit-band stores.Write buffering.The bus matrix contains a one-entry write buffer to decouple bus stalls from the processor core.第12页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreDWTYou ca
14、n configure the implementation to include a DWT.If present,you can configure the DWT to incorporate the following debug functionality:four comparators that you can configure either as a hardware watchpoint,an ETM trigger,a PC sampler event trigger,or a data address sampler event triggerseveral count
15、ers or a data match event trigger for performance profiling(性能分析)configurable to emit PC samples at defined intervals,and to emit interrupt event information.第13页/共287页Cortex-M3的总结Cortex-M3的特性Processor coreETMYou can configure the system at implementation to include an ETM.This is a low-cost trace m
16、acrocell that supports instruction trace only.WICYou can configure the implementation to include a Wake-up Interrupt Controller(WIC).第14页/共287页Cortex-M3的总结Cortex-M3的编程模式About the programmers modelThe processor architecture is the ARMv7-M.Instructions architecture is the Thumb-2.Operating modes:The p
17、rocessor supports two modes of operation,Thread mode and Handler mode:Thread mode is entered on Reset,and can be entered as a result of an exception return.Privileged and User(Unprivileged)code can run in Thread mode.Handler mode is entered as a result of an exception.All code is privileged in Handl
18、er mode.第15页/共287页Cortex-M3的总结Cortex-M3的编程模式About the programmers modelOperating statesThe processor can operate in one of two operating states:Thumb-2 state.This is normal execution running 16-bit and 32-bit halfword aligned Thumb instructions.Debug State.This is the state when in halting debug.第16
19、页/共287页Cortex-M3的总结Cortex-M3的编程模式Privileged access and user accessCode can execute as privileged or user:User(Unprivileged)execution limits or excludes access to some resources.Privileged execution has access to all resources.Handler mode is always privileged.Thread mode can be privileged or unprivi
20、leged.When Thread mode has been changed from privileged to user,it cannot change itself back to privileged.Only a Handler can change the privilege of Thread mode.Handler mode is always privileged.第17页/共287页Cortex-M3的总结Cortex-M3的编程模式Privileged access and user accessMain stack and process stackOut of
21、reset,all code uses the main stack.An exception handler such as SVC can change the stack used by Thread mode from main stack to process stack by changing the EXC_RETURN value it uses on exit.All exceptions continue to use the main stack.The stack pointer,r13,is a banked register that switches betwee
22、n SP_main and SP_process.Only one stack,the process stack or the main stack,is visible,using r13,at any time.It is also possible to switch from main stack to process stack while in Thread mode by writing to CONTROL1 using the MSR instruction,in addition to being selectable using the EXC_RETURN value
23、 from an exit from Handler mode.第18页/共287页Cortex-M3的总结Cortex-M3的编程模式RegistersThe processor has the following 32-bit registers:13 general-purpose registers,r0-r12Stack point alias of banked registers,SP_process and SP_mainLink register,r14Program counter,r15One program status register,xPSR.Figure sho
24、ws the processor register set.第19页/共287页Cortex-M3的总结Cortex-M3的编程模式RegistersThe processor has the following 32-bit registers:13 general-purpose registers,r0-r12Stack point alias of banked registers,SP_process and SP_mainLink register,r14Program counter,r15One program status register,xPSR.Figure shows
25、 the processor register set.第20页/共287页Cortex-M3的总结Cortex-M3的编程模式RegistersGeneral-purpose registersThe general-purpose registers r0-r12 have no special architecturally-defined uses.Most instructions that can specify a general-purpose register can specify r0-r12.Low registers Registers r0-r7 are acces
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 嵌入式 系统 接口 设计 应用 课件
限制150内