avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] 2.0.0 and XMega32E5 eeprom troubles...


From: Sivanupandi, Pitchumani
Subject: Re: [avr-libc-dev] 2.0.0 and XMega32E5 eeprom troubles...
Date: Wed, 10 Feb 2016 08:13:07 +0000

> -----Original Message-----
> From: address@hidden [mailto:avr-
> address@hidden On Behalf Of Scott Price
> Sent: 10 February 2016 00:54
> To: address@hidden
> Subject: [avr-libc-dev] 2.0.0 and XMega32E5 eeprom troubles...
> 
> 
> I am not able to get any of the eeprom_write_* or eeprom_update_* functions
> working on an XMega32E5.  There are no compile errors or warnings, the
> functions just don't do anything.  The eeprom read functions that I am using
> all work fine.
> 
> I had previously been using a version of avr-libc that I lifted from
> AVRStudio 6.2 to get support for the E5.  The eeprom functions worked well
> on that version.
> 
> I compiled it using gcc-4.9.3 on Ubuntu Trusty.
> 
> Atmel's nvm functions work for me, but add a significant amount of code.
>   I would rather use the ones from avr-libc, since I use them for all of my
> other AVR projects.
> 
> Looking through the code and the docs it seems like the functions should
> work.
> 
> I have done a number of experiments, including writing a fixed value to a
> fixed location on boot then reading the eeprom out with avr-dude.
> Nothing I have done has produced a successful write.
> 
> What more information do you need, or what tests can I run to help debug
> this?

Hi Scott,

If you are building avr-libc, could you try below patch?
This is the related difference I could see from Atmel's avr-libc build.

Regards,
Pitchumani

diff --git a/avr-libc/libc/misc/eewr_byte.S b/avr-libc/libc/misc/eewr_byte.S
index 98008c2..30b1595 100644
--- a/avr-libc/libc/misc/eewr_byte.S
+++ b/avr-libc/libc/misc/eewr_byte.S
@@ -61,6 +61,12 @@ ENTRY        eeprom_write_r18
 #  define NVM_CMD_ERASE_EEPROM_BUFFER_gc       0x36
 # endif

+#if    ! defined (NVM_EEMAPEN_bm)
+  ; Saving X register because it might contain source address of block
+    push XL
+    push XH
+#endif
+
   ; Prepare base address of NVM.
        ldi     ZL, lo8(NVM_BASE)
        ldi     ZH, hi8(NVM_BASE)
@@ -136,6 +142,12 @@ ENTRY      eeprom_write_r18
   ; Increment address.
        adiw    addr_lo, 1

+#if    ! defined (NVM_EEMAPEN_bm)
+  ; Restoring X register
+    pop XH
+    pop XL
+#endif
+
        ret

 #else          /* ---------------------------------------------------- */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]