PIC32 Compiler Offers Faster Interrupt Handling, 40% Smaller Code

Transparent Debugging of Fully Optimized Code


PHOENIX, AZ--(Marketwire - July 21, 2008) - MASTERs Conference -- HI-TECH Software today launched an "omniscient" ANSI C compiler for Microchip's PIC32 family of microcontrollers that can boost real-time performance by 25% or more, and can provide nearly double code density. HI-TECH C® PRO for the PIC32 MCU Family is the only PIC32 compiler that optimizes stack and register allocation across all code modules prior to generating the object code. Smaller code generally executes more quickly and requires smaller, less expensive flash memory for storage.

The HI-TECH C PRO compiler has an omniscient code generator (OCG) that collects comprehensive data on every register, stack, pointer, object and variable declaration across the entire program. It uses this information to optimize register usage, stack allocations and pointers across the whole program. It also ensures consistent variable and object declarations between modules and deletes unused variables and functions. HI-TECH C PRO is the only PIC32 compiler with this capability.

The majority of other PIC32 compilers are based on GCC compilation technology which generates code one-module-at-a-time, without comprehensive cross-module data. Without knowing how objects are used across the whole program, it is impossible to achieve the same level of optimization as an OCG compiler. In code density benchmarks, HI-TECH's OCG compiler achieves code that can be as much as 40% smaller than that generated using industry leading GCC-based PIC32 compilers. The smaller code size can cut device costs by reducing the amount of on-chip flash required.

Register Coverage. In addition, GCC-based PIC32 compilers have a constraint on which registers can be used to store parameters for called functions. Whenever a function is called from another code module, the parameters of that function are usually stored in the registers. GCC-based PIC32 compilers typically reserve four specific registers for this purpose. If the function has more than four parameters, the additional parameters must be stored on and passed to the called function using the stack (in RAM) -- a cycle intensive process that degrades performance and leads to increased RAM usage.

Interrupt-intensive code, compiled with HI-TECH's OCG-enabled compiler typically requires 26% fewer cycles for the PIC32 to execute than code compiled using a non-OCG compiler. By reducing the number of CPU cycles spent moving data between the registers and stack, HI-TECH's OCG compiler effectively gives the CPU a 26% performance boost. More importantly, called functions frequently call other functions, which may in turn call other functions. This is particularly true for interrupt intensive applications. For example, if the code calls a function, which then calls a second function, the parameters for the first function will have to be saved to the stack to make room for the parameters for the second function. If this second function calls a third function, the parameters for the second function will also have to be saved to the stack to make room for the parameters of the third function. Data will have to be shifted continuously between the stack and the registers. The penalty for this is at least a cycle every time data is moved to or from the stack -- or 8 cycles to move the data for a single four-parameter function to the stack and back to the registers.

Even if other registers are available, the GCC compiler allocates the extra parameters to the stack once the fixed set of four registers is full. This process wastes both cycles and RAM. It also results in code bloat due to the extra instructions required to save function parameters to the stack.

In contrast, HI-TECH's OCG compiler has perfect knowledge of the register usage of each function. At any point in the program, it knows which registers are available and which registers are not available, and can optimize register usage without any arbitrary constraints. When there are two or three deep function calls, it allocates parameters for different functions into non-overlapping register sets, often eliminating the need to store parameters into memory completely. This results in better utilization of the available registers, fewer cycles wasted moving parameters between the stacks and the registers, and less RAM usage. It also contributes to smaller code size by reducing or eliminating the need for code to save registers to the stack.

Faster Interrupt Handling. Since HI-TECH C PRO knows the register usage of every function in the entire program, including interrupts and any functions that are called by the interrupt code, it also knows exactly which registers need to be saved and restored for each interrupt routine. The HI-TECH C PRO compiler saves only those registers that are necessary, reducing the size of the interrupt context switching code, and decreasing the number of cycles required to execute the interrupt routine.

Memory Optimization for Better Power & Performance. Since the HI-TECH C PRO compiler knows the usage of every instance of every variable in the program, it has the ability to optimize the allocation of every variable between either the stack or the registers. The optimization is based on the frequency of use of each variable. Variables that are used intensively can be allocated permanently to registers, which have no cycle penalty at all. All register and stack allocations are always optimized to elicit the best overall performance for the entire program. This highly refined optimization of memory both boosts performance and minimizes power consumption by keeping frequently used data in locations that have the shortest access time.

Debugging With Optimizations. Although code size and performance are important issues, object code is useless if it can't be debugged. Turning on compiler optimizations often results in changes to the code that can cripple the ability to debug. The HI-TECH C PRO compiler preserves all the relationships between the object code and the original C-code, making the debug process as quick and simple as possible.

Compatible with MPLAB® IDE. The HI-TECH C PRO compiler is seamlessly integrated into Microchip's MPLAB® IDE (integrated development environment), as well as most 3rd-party development tools. HI-TECH C PRO runs on multiple platforms including Windows (2000, XP, Vista 32/64) Linux and Mac OS X.

HI-TECH Debugging. HI-TECH Software will offer its free Eclipse-based IDE, HI-TIDE™ 3, including full project management, a flexible editor and a fast, accurate simulator with JTAG Debug Interface, in the third quarter of 2008.

Library Code and Runtime Modules Included. HI-TECH's PRO compiler is available with full source code to all library routines, including a run-time start-up module that it automatically customizes for the code each time the compiler is run. A PIC32 peripheral library, fully source-compatible with Microchip's Peripheral Library, allows easy configuration of and access to the PIC32's on-chip peripherals. There are no restrictions or limitations on use of executable library code.

Pricing and Availability. HI-TECH C PRO for the PIC32 MCU Family is available now through September 30, 2008 for the introductory price of US$1595, after which it will sell for US$1995. It includes, free of charge, HI-TECH Priority Access™ (HPA) -- 12 months access to updates and technical support -- as well as a 30-day money back guarantee. Multi-user, and educational user discounts are available.

Free Full-featured Evaluation. A fully functional 45-day release trial version of HI-TECH C PRO for the PIC32 MCU Family can be downloaded, free of charge, at HI-TECH's website http://microchip.htsoft.com.

Additional information on HI-TECH C PRO for the PIC32 MCU family is available at http://microchip.htsoft.com/products/compilers/pic32.php.

Editors note: Illustrations are available at:

Product shot: http://microchip.htsoft.com/images/pack-pic32.jpg

Register usage without OCG: http://microchip.htsoft.com/images/080718_traditional_parameter_register.jpg

Register usage with OCG: http://microchip.htsoft.com/images/080718_parameter_register_PIC32_PRO.jpg

About HI-TECH Software. HI-TECH Software is a world class developer of development tools for embedded systems, offering compilers and an Eclipse based IDE (HI-TIDE) for 8-, 16-, and 32-bit microcontroller and DSP chip architectures. Its products also support the entire range of Microchip PICmicro® MCUs and DSCs. HI-TECH is the number one vendor of compilers for Microchip Technology's PIC® MCUs, with approximately 64% market share. Its customers include tens of thousands of embedded system developers including General Motors, Whirlpool, Qualcomm, and John Deere.

Founded by Clyde Stubbs, in 1984 in Brisbane, Australia, HI-TECH Software has an office in the US and an extensive network of distributors around the globe.

Contact Information: Contacts: Nancy B. Green The William Baldwin Group +1 650 856 6192 Nicky Douglas HI-TECH Software +61 7 3722 7777