bugAVR C Runtime Library - Bugs: bug #47113, XMegaE series won't write eeprom

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #47113: XMegaE series won't write eeprom

Submitter:  Scott Price <scottprice>
Submitted:  Wed 10 Feb 2016 09:53:54 PM UTC
   
 
Category:  Library Severity:  3 - Normal
Priority:  5 - Normal Item Group:  libc code
Status:  Invalid Assigned to:  None
Percent Complete:  0% Open/Closed:  Closed
Release:  2.0.0 Fixed Release:  None

Mon 07 Mar 2016 09:26:48 PM UTC, comment #4: 

OK, I'm glad it works for you now, and thanks for telling us!

Joerg Wunsch <joerg_wunsch>
Group administrator
Mon 07 Mar 2016 09:16:44 PM UTC, comment #3: 

This must have been something in my environment.  I rebuilt everything from scratch, using gcc 5.3.0, binutils 2.26 and avr-libc 2.0.0, and now it works.

Could you please close this bug as invalid?

Scott Price <scottprice>
Fri 19 Feb 2016 11:24:43 PM UTC, comment #2: 

I am also having problems with the Mega16/32 series.  I can't read or write eeprom in those. 

As soon as I can get to the git repository, I am going to see if I can find the first checkin  that caused the problem.

Scott Price <scottprice>
Wed 10 Feb 2016 10:03:38 PM UTC, comment #1: 

Sorry, I was writing the bug as I was debugging.  The paragraph that starts out "In the XMegaE series" is confusing and conflicting.

The problem is this:

For the XMegaE5, the #if defined() statement is making the wrong choice.  It should be compiling in the #else block, but it is not.  If only the #else block is left in the code (that is what the attached patch does) then it works.

Scott Price <scottprice>
Wed 10 Feb 2016 09:53:54 PM UTC, original submission:  

This bug is in 2.0.0.

None of the eeprom write or update functions work on the XMega32E5.  It seems to be a problem stemming from this block of code starting at line 119 in libc/misc/eewr_byte.S:

#if     defined (NVM_EEMAPEN_bm)
        std     Z + NVM_DATA0 - NVM_BASE, r18
#else
        movw    XL, addr_lo
        subi    XL, lo8(-MAPPED_EEPROM_START)
        sbci    XH, hi8(-MAPPED_EEPROM_START)
        st      X, r18
#endif

In the XMegaE series the memory mapping can't be turned off (it doesn't have NVM_EEMAPEN_bm) so it uses the code in the #else.  However, this code seems to do nothing.  If the code is changed so that it uses the line under the if statement, it writes the eeprom properly.  I tested it using the patch attached, but I don't know enough about the other XMega processors to know if it will break anything else.

As I dig into this more I am confused, though.  NVM_EEMAPEN_bm is not defined for the E5 series, in the ioxXe5 header files.  Yet if the code, before this patch, seems to be building like it has that defined.  The patch was just removing the #if statement, only leaving what is in the #else block.  That should have been what was built for the E5.


Scott Price <scottprice>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #36344:  libc.correct.patch added by scottprice (631B - text/x-patch - This is the correct patch. I attached the wrong file before.)
file #36306:  libc.patch added by scottprice (539B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Updated the item)
  • -email is unavailable- added by scottprice (Submitted the item)
  •  

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-07 joerg_wunsch StatusNone Invalid
        Open/ClosedOpen Closed
    2016-02-15 scottprice Attached File- Added libc.correct.patch, #36344
    2016-02-10 joerg_wunsch ReleaseAny 2.0.0
    2016-02-10 scottprice Attached File- Added libc.patch, #36306

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code