Bug 44940 - XMEGA RAMPZ Initialization
Summary: XMEGA RAMPZ Initialization
Status: RESOLVED DUPLICATE of bug 52461
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2010-07-14 23:18 UTC by darkdragon2000
Modified: 2012-03-03 14:11 UTC (History)
3 users (show)

See Also:
Target: avr
Known to work:
Known to fail:
Last reconfirmed: 2011-09-29 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description darkdragon2000 2010-07-14 23:18:37 UTC
When compiling a bootloader for the XMEGA128 (starting address 0x20000), RAMPZ is initialized to 2 in the __do_copy_data section.  This has the effect that any indirect register access will fail.

 For example the following code extract will result in the register NOT being set to 0xCB when RAMPZ = 2.

    20c6e:     2b ec           ldi     r18, 0xCB       ; 203
    20c70:     e0 e5           ldi     r30, 0x50       ; 80
    20c72:     f0 e0           ldi     r31, 0x00       ; 0
    20c74:     22 83           std     Z+2, r18        ; 0x02

To recreate this, simply put OSC.XOSCCTRL = 0xCB; in the main function and link to bootloader memory space.
Comment 1 Georg-Johann Lay 2011-09-29 22:26:44 UTC
Please show the compiler output together with -v as explained in http://gcc.gnu.org/bugs/#need together with a source that exhibits the problem. How to get such a source is also explained on the aforementioned page.

ATXmega is not supported by the FSF version of avr-gcc so you should either report the bug to the distributor of your toolchain or reproduce the artifact with in unpatched version of avr-gcc.
Comment 2 Georg-Johann Lay 2012-03-03 14:11:04 UTC

*** This bug has been marked as a duplicate of bug 52461 ***