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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

COMMAND-LINE COMPILEROVERVIEWCompilation Process[ Underneath <strong>the</strong> user-friendly IDE is a set of comm<strong>and</strong>-line <strong>compiler</strong> programs. Whileyou do not need to underst<strong>and</strong> this chapter to use <strong>the</strong> <strong>compiler</strong>, this chapter is good<strong>for</strong> those who want to find out “what's under <strong>the</strong> hood.” ]Given a list of files in a project, <strong>the</strong> <strong>compiler</strong>'s job is to translate <strong>the</strong> files into anexecutable file in some output <strong>for</strong>mat. Normally, <strong>the</strong> compilation process is hiddenfrom you through <strong>the</strong> use of <strong>the</strong> IDE’s Project Manager. However, it can be importantto have an underst<strong>and</strong>ing of what happens “under <strong>the</strong> hood”:1. icppw.exe, <strong>the</strong> C preprocessor, processes <strong>the</strong> # directives in a C source file.2. iccom<strong>avr</strong>.exe, <strong>the</strong> <strong>compiler</strong> proper, translates <strong>the</strong> preprocessed source file toan assembly file.3. ias<strong>avr</strong>.exe, <strong>the</strong> assembler, translates each assembly file (ei<strong>the</strong>r from <strong>the</strong><strong>compiler</strong> or assembly files that you have written) into a relocatable object file.4. ilnk<strong>avr</strong>.exe is <strong>the</strong> linker. After all <strong>the</strong> files have been translated into object files,<strong>the</strong> linker combines <strong>the</strong>m toge<strong>the</strong>r to <strong>for</strong>m an executable file. In addition, a mapfile, a listing file, <strong>and</strong> debug in<strong>for</strong>mation files are also output.5. Optionally, <strong>the</strong> linker per<strong>for</strong>ms <strong>the</strong> Code Compression optimization <strong>and</strong> generatesoptimized output file.6. ilst<strong>avr</strong>.exe, <strong>the</strong> listing file manager, generates <strong>the</strong> .lst intersperse C <strong>and</strong>asm listing file.7. icc2<strong>avr</strong>-elf.exe generates <strong>the</strong> ELF production file.All <strong>the</strong>se details are h<strong>and</strong>led by <strong>the</strong> <strong>compiler</strong> driver. You give it a list of files <strong>and</strong> ask itto compile <strong>the</strong>m into an executable file (default) or to some intermediate stage (<strong>for</strong>example, to <strong>the</strong> object files). The driver invokes <strong>the</strong> <strong>compiler</strong>, <strong>the</strong> assembler, <strong>and</strong> <strong>the</strong>linker as needed.The previous versions of our IDE generate a makefile <strong>and</strong> invoke <strong>the</strong> make program tointerpret <strong>the</strong> makefile, which causes <strong>the</strong> <strong>compiler</strong> driver to be invoked.Version 8’s Code::Blocks IDE (C::B) does not use <strong>the</strong> make program <strong>and</strong> uses aninternal build system that calls <strong>the</strong> <strong>compiler</strong> driver directly.

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

Saved successfully!

Ooh no, something went wrong!