Column navigation

Contact us

Tel :135-5872-1680
Tel :028-62533148 

Add:Building 602, A, Financial

    Center, Pidu District,

    Chengdu City, Sichuan Province

Improving MCU performance with incremental C-coding

Position:Index >> News

Improving MCU performance with incremental C-coding

   Efficient coding has been an important subject for years especially for resource constrained systems running real-time applications.

   Most people take compiler optimizations for granted and do not realize the effect of efficient ‘C’ programming on program execution time. The examples described in this article are intended to serve as a reminder and testament to the fact that program execution speed mainly relies on efficient programming practices

   To exemplify the notion consider writing a multiplication subroutine for a processor that does not have a hardware multiplier. Using simple repetitive addition algorithm, the loop will take the multiplicand and adds to itself n times, where n is the multiplier. Think of the run time of 5x1000=5000, versus a 1000x5=5000. A smarter loop would take the smaller number as the multiplier and the larger as the multiplicand.

   In this article I have implemented small incremental code improvements to an embedded Ethernet driver, and proved that a performance gain of nearly 17% has been achieved. This figure does not account for the effect of additional compiler optimizations or TCP windowing improvements.

Contacts:Mr.Chen      Tel:135-5872-1680     Tel:028-62533148
Address:Building 602, A, Financial Center, Pidu District, Chengdu City, Sichuan Province

Production Address: 39 Tonggang Road, Pidu Industrial South District