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.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVRRelative Jump/Call WrappingOn devices with 8K of program memory, all memory locations can be reached with <strong>the</strong>relative jump <strong>and</strong> call instructions (rjmp <strong>and</strong> rcall). To accomplish that, relativejumps <strong>and</strong> calls are wrapped around <strong>the</strong> 8K boundary. For example, a <strong>for</strong>ward jump tobyte location 0x2100 (0x2000 is 8K) is wrapped to <strong>the</strong> byte location 0x100.This option is automatically detected by <strong>the</strong> Project Manager whenever <strong>the</strong> target’sprogram memory is exactly 8192 bytes.M128x ConsiderationsThe M128x AVRs have 128K bytes of flash. Indirect function calls use 16 bit wordpointers <strong>and</strong> can reach <strong>the</strong> entire address space (see Program Areas <strong>for</strong> descriptionof func_lit) <strong>and</strong> you do not need to do anything special when using functionpointers.However, to access constant in <strong>the</strong> upper 64K bytes, you will need to modify <strong>the</strong>RAMPZ IO register to point to <strong>the</strong> upper bank manually (<strong>and</strong> reset it when done). Wemay add support <strong>for</strong> “far” pointers in <strong>the</strong> future so constant accesses will betransparent, albeit at <strong>the</strong> cost of larger code size.M256x ConsiderationsThe M256x AVRs have 256K bytes of flash. A 16-bit word pointer is no longersufficient to hold <strong>the</strong> value of all possible function addresses. For each functionpointer, a 3-byte entry is made in <strong>the</strong> efunc_lit area (see Program Areas). Theefunc_lit must be located in <strong>the</strong> lower 64 bytes of <strong>the</strong> address space.For constant data, <strong>the</strong> same issue as with M128x applies <strong>and</strong> you must set <strong>the</strong>RAMPZ IO register explicitly.XMega ConsiderationsThe XMega is large backward compatible with <strong>the</strong> ATMega devices. One notabledifference is that <strong>the</strong> CPU registers are no longer mapped onto data memory space<strong>and</strong> <strong>the</strong> IO registers have <strong>the</strong> same IO memory addresses <strong>and</strong> data memoryaddresses. In previous AVRs, <strong>the</strong> IO registers are offset by 32 bytes when referencedin <strong>the</strong> data memory space. Also see Accessing Memory Outside of <strong>the</strong> 64K Range <strong>for</strong>issues on accessing extended memory space using RAMPD, RAMPX, RAMPY <strong>and</strong>RAMPZ registers.140

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

Saved successfully!

Ooh no, something went wrong!