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

 
 

bug #47113: XMegaE series won't write eeprom

Submitted by:  Scott Price <scottprice>
Submitted on:  Wed 10 Feb 2016 09:53:54 PM UTC  
 
Category: LibrarySeverity: 3 - Normal
Priority: 5 - NormalItem Group: libc code
Status: InvalidPercent Complete: 0%
Assigned to: NoneOpen/Closed: Closed
Release: 2.0.0Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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.)

Attach File(s):
   
   
Comment:
   

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
  • -unavailable- added by joerg_wunsch (Updated the item)
  • -unavailable- added by scottprice (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 07 Mar 2016 09:26:48 PM UTCjoerg_wunschStatusNone=>Invalid
      Open/ClosedOpen=>Closed
    Mon 15 Feb 2016 02:50:38 PM UTCscottpriceAttached File-=>Added libc.correct.patch, #36344
    Wed 10 Feb 2016 11:02:07 PM UTCjoerg_wunschReleaseAny=>2.0.0
    Wed 10 Feb 2016 09:53:54 PM UTCscottpriceAttached File-=>Added libc.patch, #36306

    Back to the top


    Powered by Savane 3.1-cleanup1