11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVRThe Machine Independent Optimizer makes debugging even more challenging.MIO may eliminate or move code or modify expressions, <strong>and</strong> <strong>for</strong> RISC-liketargets, <strong>the</strong> register allocator may allocate different registers or memory locationsto <strong>the</strong> same variable depending on where it is used. Un<strong>for</strong>tunately, currently mostdebuggers have only limited support <strong>for</strong> debugging of optimized code.You may have encountered a <strong>compiler</strong> error. If you encounter an error message of<strong>the</strong> <strong>for</strong>m“Internal Error! ...,”this means <strong>the</strong> <strong>compiler</strong> has detected an internal inconsistence. If you see amessage of <strong>the</strong> <strong>for</strong>m...The system cannot execute this means that un<strong>for</strong>tunately <strong>the</strong> <strong>compiler</strong> crashed while processing your code. Inei<strong>the</strong>r case, you will need to contact us. See Support.You may have encountered a <strong>compiler</strong> bug. Un<strong>for</strong>tunately, <strong>the</strong> <strong>compiler</strong> is a set ofrelatively complex programs that probably contain bugs. Our front end (<strong>the</strong> partthat does syntax <strong>and</strong> semantic analysis of <strong>the</strong> input C programs) is particularlyrobust, as we license <strong>the</strong> LCC software, a highly respected ANSI C <strong>compiler</strong> frontend. We test our <strong>compiler</strong>s thoroughly, including semi-exhaustively testing <strong>the</strong>basic operations of all <strong>the</strong> supported integer operators <strong>and</strong> data types.Never<strong>the</strong>less, despite all our testing, <strong>the</strong> <strong>compiler</strong> may still generate incorrectcode. The odds are very low, though, as most of <strong>the</strong> support issues are not<strong>compiler</strong> errors even if <strong>the</strong> customer is “certain of it.” If you think you have found a<strong>compiler</strong> problem, it always helps if you try to simplify your program or <strong>the</strong> functionso that we may be able to duplicate it. See Support.Testing Your Program LogicSince <strong>the</strong> <strong>compiler</strong> implements <strong>the</strong> ANSI C language, a common method of program<strong>development</strong> is to use a PC <strong>compiler</strong> such as Borl<strong>and</strong> C or Visual C <strong>and</strong> debug yourprogram logic first by compiling your program as a PC program. Obviously, hardwarespecificportions must be isolated <strong>and</strong> replaced or stubbed out using dummy routines.Typically, 95% or more of your program's code can be debugged using this method.If your program fails seemingly r<strong>and</strong>omly with variables having strange values or <strong>the</strong>PC (program counter) in strange locations, <strong>the</strong>n possibly <strong>the</strong>re are memory overwritesin your program. You should make sure that pointer variables are pointing to validmemory locations <strong>and</strong> that <strong>the</strong> stack(s) are not overwriting data memory.40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!