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 AVRGenerating Production ELF FileSome of <strong>the</strong> current AVR flash programming tools accept a “production ELF” file asinput. Prior to using <strong>the</strong> production ELF file, <strong>the</strong> binary code <strong>for</strong> flash <strong>and</strong> EEPROMare stored in different files <strong>and</strong> o<strong>the</strong>r special control bytes (such as “lock bits”, <strong>and</strong>“fuses”) must be h<strong>and</strong>led specially using <strong>the</strong> flash programming tool. This is acumbersome <strong>and</strong> error-prone process. In contrast, a production ELF file contains all<strong>the</strong> binary code needed to program an AVR device; including flash, EEPROM, fuses,etc.One example of an AVR tool that uses production ELF file is Atmel Studio 6, under <strong>the</strong>"Device Programming/Production file" dialog.ICCV8 <strong>for</strong> AVR generates additional .bin files, <strong>and</strong> in a post-linker step, combines<strong>the</strong>m into a single production ELF file. This process is transparent to <strong>the</strong> users. Notethat this is <strong>for</strong> production use only <strong>and</strong> <strong>the</strong> ELF file does not contain debug symbols.To debug using Atmel Studio, continue to use <strong>the</strong> .cof COFF output file.In addition to <strong>the</strong> .bin output, contents of flash <strong>and</strong> EEPROM continue to be availablein <strong>the</strong> respective .hex <strong>and</strong> .eep output files as be<strong>for</strong>e. (See Initializing EEPROM onhow to define EEPROM data.) Use <strong>the</strong> following #pragma to specify content <strong>for</strong> o<strong>the</strong>rspecial AVR areas. Each pragma must appear in only one source file (i.e. do not put itin a header file where it will be included by multiple source files).Note that <strong>the</strong> <strong>compiler</strong> does not check <strong>the</strong> content specified in <strong>the</strong>se pragmas. Youmust ensure that <strong>the</strong> correct values are used. #pragma <strong>avr</strong>_signature (signature0, signature1, signature2)AVR signature is always three bytes. Signature0 is always <strong>the</strong> Atmelmanufacturer code of 0x1E. The o<strong>the</strong>r two bytes are device dependent. This is <strong>for</strong>device verification - if Studio cannot verify that <strong>the</strong> device has <strong>the</strong> right signaturebytes, no o<strong>the</strong>r programming will be per<strong>for</strong>med.We have defined <strong>the</strong> macros SIGNATURE0, SIGNATURE1 <strong>and</strong> SIGNATURE2 in<strong>the</strong> common iccio<strong>avr</strong>.h header file so if you use that header file, you can write<strong>the</strong> following <strong>for</strong> any AVR device:#include ...#pragma <strong>avr</strong>_signature(SIGNATURE0, SIGNATURE1, SIGNATURE2)114

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

Saved successfully!

Ooh no, something went wrong!