Application Note of 8-bit Atmel Microcontrollers.



Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers.


Features

• Atmel® AVR® core and Atmel AVR GCC introduction

• Tips and tricks to reduce code size

• Tips and tricks to reduce execution time

• Examples application



Introduction

AVR core is an advanced RISC architecture tuned for C code. It ensures the

development of good products with more features at less cost.

When talking about optimization, we usually refer to two aspects: code size and

code speed. Nowadays, C compilers have different optimization options to help

developers get an efficient code on either size or speed.

However, good C coding gives more opportunities for compilers to optimize the

code as desired. And in some cases, optimizing for one of the two aspects affects

or even causes degradation in the other, so a developer has to balance the two

according to their specific needs. An understanding of some tips and tricks about C

coding for an 8-bit AVR helps the developers to know where to focus in improving

code efficiency.

In this application note, the tips are based on avr-gcc (C compiler). However these

tips could be implemented in other compilers or with similar compiler options, and

vice versa.





avr_optimize c code.pdf


+ Recent posts