The Hi-Tech PIC18 PRO C compiler for the Microchip PIC18 family of microcontrollers, featuring a new compilation technique known as OSG (Omniscient Code Generator), is now available in the UK from Computer Solutions. Unlike compilers which claim to provide ‘global’ optimisation but which in reality optimise each individual module separately, OCG partially compiles each module and then completes code generation for all modules together at what would otherwise be known as ‘link time’. The result is a substantial reduction in code size, with the additional benefit of allowing the code generator to automatically make many decisions (memory page allocation or pointer allocation, for example) that would otherwise need to be actively managed by the programmer.
The code size reduction achieved by the new system results from a combination of minimised compiled stack size, the ‘in-lining’ of functions not called by others, minimal register save and restore requirements, the stripping out of code for un-used return values, and an optimised start-up code. In addition, the sprintf() function only needs to include the formats that will be used.
In a typical application, the program size using PIC18 Pro with OCG is only 83% of that using the conventional PIC 18-STD compiler and around half of that using other major manufacturers’ compilers.
PIC18 PRO also offers a number of design improvements for the user. It catches inconsistent variable and object definitions, and truly optimises register allocation over the whole program. It also provides efficient address space and pointer allocation, manages re-entrant and recursive calls, and allocates the most accessed variables to the fastest accessed memory.
The OCG technology in PICC-18 PRO automatically generates customised code, based on the use of each function in the program. For example, the C library functions for formatting text strings or output, sprintf() and printf(), can occupy 5 kbyte or more. PICC-18 PRO’s code generator analyses the format strings supplied to these functions to determine the exact set of format specifiers and modifiers actually used by the program, and creates the smallest customised version to meet program requirements.
PICC-18 PRO is compatible with MPLAB(r), and integrates into Microchip’s MPLAB integrated development environment (IDE), as well as most third-party development tools. It runs on multiple platforms including Windows (2000, XP) Linux and Mac OS X.
A 30 days’ evaluation version of the PIC-18 PRO compiler is available for engineers wishing to evaluate this new release.
OCG will be rolled out over future months for use on PIC, dsPIC, AVR, 8051 and ARM compilers.
Computer Solutions Ltd. is the UK’s premier supplier of microprocessor development tools. It supplies a wide range of software and hardware tools that support over 100 different microprocessor families. Software tools include: assemblers, debuggers, C compilers, real-time executives, TCP/IP stacks and other high-level protocol libraries for USB and CAN. Hardware products include: device programmers, in-circuit emulators and logic analysers, as well as analysers for USB and a range of CAN interfaces and tools. With 28 years’ experience, Computer Solutions Ltd. has unrivalled expertise in embedded tools, consultancy and support.