| Omniscient Code Generation for 8-, 16- and 32-bit Microcontrollers |
|
|
| Jul 01 2008 | |
|
Page 1 of 5
advertisement: C-language programs are usually developed by teams of engineers who are often geographically dispersed, leading to redundant code and inconsistent variable declarations between modules. Traditional compilation technology compiles each module separately with no regard for what goes on in the other modules and with no information about how pointers, stacks, variables and functions are used throughout the whole program. Traditional compilers tend to over-allocate memory space for pointers, stacks and registers. They are unable to fully exploit the wide variety of memory maps, and register and stack configurations available in today’s microcontrollers. All too often, the programmer must resort to manual optimizations that compromise portability (Figure 1). The engineer, too, must often specify an MCU with more resources and higher cost than are really required. In a worst-case situation, the design may have to be migrated from an 8-bit MCU to a more complex, expensive, and powerhungry 32-bit device because an otherwise ideal microcontroller does not have enough memory resources to accommodate the final program. Increasing onchip flash from 8 KBytes to 16 KBytes adds 20 cents to 50 cents to the BOM.“Omniscient Code Generation”A new compiler technology, called Omniscient Code Generation (OCG), cuts the code footprint by as much as half and frees up 10% to 15% of SRAM resources. Rather than relying on the linker to uncover errors between independently compiled modules, an OCG compiler completes the initial stages of compilation for each module separately. Then it compiles each module to an intermediate code file that represents a more abstract view of each module before producing any machine instructions or allocating any registers (Figure 2). |







