With the introduction of microcontrollers based on the ARM Cortex-M3 core, a developer wanting a low cost 32-bit device can choose either a Cortex-M3 base or an ARM7TDMI. What are the criteria to consider when making that choice?
ARM approachesThe ARM Cortex-M3 is an implementation of the ARM7v architecture,the latest evolution of ARM’s embedded cores. It is a Harvard architecture, using separate buses for instructions and data (rather than a von Neumann architecture where data and instructions share a bus): the Harvard architecture is intrinsically significantly faster but physically more complex. With Moore’s Law, the complexity is not such a significant issue and the increase in throughput is valuable.The Cortex-M3 is aimed by ARM at the deeply embedded market. It is designed to be very low cost, low power and to provide good performance for the cost and power. ARM sees it as particularly suited to automotive and wireless communications applications. As with all ARM designs, they license the design to manufacturers who produce their own implementation, and already a number of manufacturers have committed to producing microcontrollers based on the Cortex-M3, although at the time of writing only one (Luminary Micro) has announced a specific product. Luminary is shipping devices with volume pricing at less than $1. There is a developing ecosystem of development tools and system software, evolving from the ARM7TDMI ecosystem and anticipating further manufacturers entering the area.The other ARM core aimed at the same market is the ARM7TDMI (and ARM7TDMIS). This has been around for more than ten years and is one of the drivers pushing ARM to world dominance in processorcores. Many manufacturers (ARM claim more than sixteen) are selling families of microcontrollers based on ARM7 cores and the ecosystem of software, development and debugging tools is truly impressive. The ARM7TDMI is, in many ways, the workhorse of the embedded world.
DifferencesAs well as using the Harvard Architecture, the Cortex-M3 has other significant differences. It is a smaller basic core, reducing price and increasing speed. Integrated with the core are system peripherals, such as the interrupt controller, bus matrix and debug functionality, which would normally be added by the microcontroller implementer. It has an integrated sleep mode and the option of an integral eight-regionMemory Protection Unit. It is designed for the THUMB-2 Instruction set, and reduces assembler usage to a minimum.
Instruction setWhile the ARM7 implements both the ARM and Thumb instruction sets, the Cortex-M3 is designed for the new Thumb-2 and supports only this instruction set. This has several advantages:
• There is no need to switch state between Thumb and ARM code, which reduces performance with earlier processors.
• Thumb-2 is designed specifically to implement C, and includes an If/Then construct (predicating conditional execution of the next four instructions), hardware division and native bitfield manipulation.
• Thumb-2 allows applications to be maintained and modified at the level of the C code, and portions of C can be easily reused.
• Thumb-2 is designed to include functionality that would normally require calling assembler level code: Luminary claims that there is no need ever to drop into assembly language.
• These advantages add up to easier implementation and possibly faster time to market for new products.
InterruptsAnother innovation on the Cortex-M3 is the Nested Vector Interrupt Controller (NVIC). Unlike external interrupt controllers, as are used in ARM7TDMI implementations, this is integrated into the Cortex-M3 core and can be configured by the silicon implementer to provide from a basic 32 physical interrupts with 8 levels of preemption priority up to 240 physical interrupts and 256 levels of priority. The design is deterministic with low latency, making it particularly applicable to automotive applications. The NVIC uses a stack based exception model. Program counter, program status register, link register and general purpose registers are all pushed on to the stack to handle the interrupt, and once it is completed, the registers are restored. Stack handling is in hardware, so there is no longer a need to create assembler wrappers for stack manipulation for interrupt service routines.Interrupts can be nested. An interrupt can exert a higher priority for earlier servicing and priority levels can be changed during run time. Using a technique of tail-chaining successive interrupts takes only three cycles, compared to 32 needed for a successive stack pop and push, reducing latency and increasing performance.If the NVIC is stacking (pushing) when an interrupt of higher priority arrives, merely fetching anew vector address is all that is needed to service the higher priority one. Similarly, the NVICwill abandon a pop to service a new interrupt. This also achieves lower latency and is completely deterministic.
SleepThe Cortex-M3 power management scheme supports Sleep Now, Sleep on Exit (from exitingthe lowest priority ISR) and SLEEPDEEP modes, through the NVIC. To generate regular time intervals for interrupts, the NVIC has an integrated System Tick timer,which can also be used as a heartbeat for scheduled tasks or for an RTOS. This means that there is no need for an external clock, unlike previous ARM architectures.
Memory protection unitThe memory protection unit is an implementation option. When implemented it allows areas of memory to be associated with specific processes in the application with rules governing accessby other processes. For example, some memory can be totally blocked for all other processes,while other areas can be readonly for specific other processes. Another rule could halt executionif a process attempts to enter a memory area. This provides a significant improvement inreliability, particularly in realtime.
DebugThe integrated debug and trace Debug Access Port can be implemented as either a two pin Serial Wire Debug Port or a Serial Wire JTAG Debug Port. In association with the Flash Patch and Breakpoint unit, the Data Watchpoint and Trace unit, the implementation option of the Embedded Trace Macrocell and the Instrumentation Trace Macrocell, it is possible to carry out a wide range of debug and monitoring functions within the core. It is, for example, possible to set breakpoints, watchpoints, define fault conditions or carry out debug requests, and either halt operations or continue while monitoring. All of these facilities have been available in ARM architectures but the Cortex-M3 pulls them together in a neat package for the developer.
RangeWhile the ARM7 cores do not have such deeply integrated peripherals as the Cortex family, there is vast range of ARM7 based devices with an even larger range of peripherals, shading from general purpose MCUs, through to application oriented MCUs, SoCs and even an ARM7 core in an FPGA from Actel. There are around 150 different MCUs based on the ARM7 (and that number can be even higher, depending on how you count versions). For almost every application in the embedded space it is possible to find an ARM7 implementation that has been customized, to some degree or other, to meet the requirements. To the standard core the implementer adds different memory types and sizes and other peripherals, such as serial interfaces, bus controllers, memory controllers and graphics units. They use a range of packaging types and for industrial, automotive and other demanding applications, provide extended temperature range versions. They may also bundle software, such as TCP/IP stacks or even application specific software.For example, the STR7 product line (from STMicroelectronics) has three major families, with a total of 45 members with variants in packaging and memory. Each family has a different peripheral set aimed at specific applications - for example the STR730 family is designed forindustrial and automotive applications so is available in an extended temperature range andincludes multiple I/O and 3 CAN interfaces, while the STR710 is aimed at consumer, point of sales and high-end industrial applications and has multiple communication interfaces including USB, CAN, ISO7816 and four UART, large memory and an external memory interface.Implementers also choose to add help for developers, for example,by implementing ARM’s Embedded Trace Macrocells (ETM) and by supplying development and debug tools. By contrast, only Luminary is shipping Cortex-M3 based products, at the time of writing,although other companies have announced their intention to produce products.
ToolsThe ubiquity of the ARM7 has lead to an explosion in third party products for developing and debugging applications. The ARM web site lists over 130 companies and other companies are also serving this market.Most manufacturers provide a basic development board, housing the device and providing interfaces to load programs, attach debugging tools and drive peripherals. It will include a statusdisplay of LEDs or a single line screen. Normally the board is packaged as part of a kit with acompiler and some debugging software. More advanced kits, including those from third parties,will include a full integrated development environment (IDE) with a compiler, linker, debugger,editor and other tools. They may also include hardware, such as JTAG probes to connect the JTAG port on the device to the PC.In-Circuit Emulators (ICEs), one of the earliest and most useful forms of debugging tools, are available with ARM7 interfacing, from a range of manufacturers. Software development tools abound: they range from modeling and visual design front-ends through to compilers. Application modules and middleware sit on top of real-time operating systems (RTOS) for rapid development, and more of these are coming to the market.And, perhaps very importantly, there is a huge base of experienced ARM7 developers.There is already an emerging tools base for the Cortex-M3,but obviously this has still somedistance to go. However, the integrated debug in the Cortex-M3 will make system bring-upand debug much easier and more efficient and removes the need for In-Circuit Emulators (ICEs).
Decision timeSo, which do you choose today? If cost is an absolute driver – probably Cortex-M3. If lookingfor better performance and improved power at low cost – you might again consider the Cortex-M3, particularly if the application is in the areas that ARM sees as primary targets – automotive and wireless.The integrated elements within the core and the Thumb-2 instruction set should make developing and debugging on the Cortex-M3 easier and faster than the ARM7TDMI.The drawback at the moment is that Luminary is the sole supplier. However, although only ST and Actel have made a formal announcement, many of the companies with ARM7 based devices are working on Cortex- M3 designs, and it would be worthwhile talking to suppliers to get a feeling for timescales and implementation details.But as retargeting an application from the ARM7TDMI is not difficult, particularly when using an RTOS, the conservative route may be to use a device with an ARM7TDMI core for now but ensure that design and implementation do not use features that will make retargeting morecomplex. aFurther readingTwo ARM white papers that provide further reading are ‘Introduction to the ARM Cortex-M3Processor’ and ‘Running ARM7TDMI Processor Software on the Cortex-M3 Processor’. Both can be downloaded fromhttp://www.arm.com/documentation
订阅:
博文评论 (Atom)

没有评论:
发表评论