原创 So what's Cortex

2011-11-10 21:31 1173 9 9 分类: MCU/ 嵌入式

The ARM Cortex family is a new generation of processor that provides a standard architecture for a wide range of technological demands. Unlike the other ARM CPUs, the Cortex family is a complete processor core that provides a standard CPU and system architecture.  The Cortex family comes in three main profiles: the A profile for high end applications, R for real time and M for cost-sensitive and microcontroller applications. The STM32 is based on the Cortex-M3 profile, which is specifically designed for high system performance combined with low power consumption. It has a low enough cost to challenge traditional 8 and 16-bit microcontrollers. 

         Cortex系列是ARM公司新一代的处理器内核,旨在为当前对技术的要求日渐广泛的市场提供一个标准的处理器架构。和其他ARM处理器不一样的是,Cortex系列处理器作为一个完整的处理器核心,在向我们提供标准CPU的同时,还提供了标准的系统架构。Cortex系列分为3个分支:专为高端应用场合而设的“A”(Application)分支,专为实时应用场合而设的“R”(Real-time)分支,还有专为对成本敏感的微控制器应用场合而设的“M”(Microcontroller)分支。STM32基于Cortex-M3分支,专为实现高系统性能与低功率消耗并存而设计。同时它足够低廉的价格也向传统的8位和16位微控制器发起了有力的挑战。

        While the ARM7 and ARM9 CPUs have been successfully integrated into standard microcontrollers, they do show their SoC heritage. This is particularly noticeable in the area of exception and interrupt handling, because each specific  manufacturer  has  designed  their  own  solution.  The  Cortex-M3  provides  a  standardised microcontroller core which goes beyond the CPU to provide the entire heart of a microcontroller (including the interrupt system,
SysTick timer, debug system and memory map). The 4Gbyte address space of the Cortex-M3 is split into well-defined  regions  for  code,  SRAM,  peripherals  and  system  peripherals.  Unlike  the  ARM7,  the  Cortex-M3  is a Harvard architecture and so has multiple busses that allow it to perform operations in parallel, boosting its overall performance. Unlike earlier ARM architectures, the Cortex family allows unaligned data accesses. This ensures the most efficient use of the internal SRAM. The Cortex family also supports setting and clearing of bits within two 1Mbyte regions of memory by a method called bit banding. This allows efficient access to peripheral registers and flags located in SRAM memory without the need for a full Boolean processor.

        随着ARM7和ARM9处理器被成功的整合进标准微控制器里,它们也展示了它们各自特有的产物:SoC(片上操作系统)。特别的,在对异常和中断的响应处理上,我们会更容易看到它们之间的区别,因为每家芯片制造商都有属于自己的一套解决方案。Cortex-M3提出标准化的微控制器核心,在CPU的基础上又提供了整个微控制器的核心部分(包括中断系统,系统节拍时钟,调试系统以及存储区映射)。Cortex-M3内部的4Gbyte线性地址空间被分为Code区,SDRAM区,外部设备区以及系统设备区。和ARM7不同,Cortex-M3基于哈佛体系,拥有多重总线,可以进行并行处理,因而提升了整体性能。同时也和早期的ARM架构不同,Cortex系列处理器允许数据非对齐存取,这能确保内部SDRAM能够得到有效的利用。Cortex系列处理器可以使用一种称为Bit-banding(译为“位带”)的技术,利用两个1Mbyte大小的内存区域实现对“位”的置位和清除。这样就可以有效地对设备寄存器和位于SRAM中的某些标志位提供存取接口,而不再需要完整的布尔逻辑运算过程。

        One of the key components of the Cortex-M3 core is the Nested Vector Interrupt Controller (NVIC). The NVIC provides a standard interrupt structure for all Cortex based microcontrollers and exceptional interrupt handling. The NVIC provides dedicated interrupt vectors for up to 240 peripheral sources where each interrupt source can be individually prioritised. The NVIC has been designed for extremely fast interrupt handling. The time taken from receiving an interrupt to reaching the first line of code in your service routine is just twelve cycles. This is achieved
in  part  by  automatic  stack  handling  which  is  done  by  microcode  within  the  CPU.  In  the  case  of  back  to  back interrupts, the NVIC uses a “tail chaining” method that allows succe-ssive interrupts to be served with only a six cycle latency.  During  the  interrupt stacking phase,  a  high  priority  interrupt can  pre-empt a  low  priority  interrupt without  incurring  any  additional  CPU  cycles.    The  interrupt  structure  is  also  tightly  coupled  to  the  low  power
modes within the Cortex-M3 core. It is possible to configure the CPU to automatically enter a low power on exit from an interrupt. The core then stays asleep until another exception is raised. 

1320931320_e3e6e7e2.jpg

        如上图示,STM3的核心Cortex-M3处理器,是一个标准的微控制器结构,拥有32位CPU,总线结构,中断嵌套向量控制单元,调试系统还有标准存储映射分布。中断向量控制器(Nested Vector Interrupt Controller,以下简称NVIC)是Cortex-M3处理器中一个比较关键的组件。NVIC为基于Cortex核心的微控制器提供了标准的中断架构和优秀的中断响应能力。NVIC为超过240个中断源提供专门的中断入口,而且可以赋予每一个中断源单独的优先级。NVIC专为得到极快的中断响应速度而设,从收到中断请求到执行中断服务程序的第一条指令所要花的时间仅仅为12个时钟周期。为了实现这种响应速度,一方面得益于堆栈的自动处理机制,这种机制通过固化在CPU内部的微代码实现。在中断请求连续出现的情况下,NVIC使用一种叫“尾链”的技术使连续中断在6个时钟周期之内得到服务。在中断压栈阶段,更高优先级的中断可以不耗费任何额外的CPU周期就能完成嵌入低优先级中断的动作。Cortex-M3的中断结构和CPU的低功耗实现也有紧密的联系。我们可以设置CPU自动进入低功耗状态,而使用中断来将其唤醒,CPU核心在中断事件来临之前会一直保持休眠状态。
        Although the Cortex-M3 is designed as a low cost core, it is still a 32-bit CPU and as such has support for two operating modes: Thread mode and Handler mode, which can be configured with their own stacks. This allows more sophisticated software design and support for real-time operating systems. The Cortex core also includes a 24-bit auto reload timer that is intended to provide a periodic interrupt for an RTOS kernel.While the ARM7 and ARM9 CPUs have two instruction sets (the ARM 32-bit and Thumb 16-bit instruction sets) the Cortex family is designed to support the ARM Thumb-2 instruction set. This blends both 16 and 32-bit instructions, to deliver the performance  of  the  ARM  32-bit  instruction  set  with  the  code  density  of  the  Thumb  16-bit  instruction  set.  The Thumb-2 instruction set is a richinstruction set that is designed as a target for C/C++ compilers. This means that a Cortex application can be entirely coded in C.
        即便Cortex-M3是一个低功耗内核,它仍然是一个32位的CPU,同时支持两种运行模式:线程模式与中断模式——它们都拥有属于自己的堆栈。这种设计使开发人员进行更为精密的程序设计,对实时操作系统的支持也更好。Cortex核心还包含一个24位的自动重装载定时器,用以在实时内核中提供一个周期性的中断。ARM7和ARM9处理器都有两种指令集(ARM 32位指令集和Thumb 16位指令集),而Cortex系列处理器支持ARM Thumb-2指令集。Thumb-2混合了16位和32位指令集,在ARM 32位指令集的性能和Thumb 16位指令集的代码密度之间取得了平衡。Thumb-2是为C/C++编译器专门进行设计的指令集,这意味着Cortex系列处理器的开发应用可以全部在C语言环境中完成。
PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
9
关闭 站长推荐上一条 /3 下一条