Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug #46843] avrdude=>6 fails to write from 128k-mark onwards, loops back to 0x0000 #404

Closed
avrs-admin opened this issue Dec 10, 2021 · 3 comments
Labels
invalid This doesn't seem right

Comments

@avrs-admin
Copy link

Maarten van Eeuwijk maarten.van.eeuwijk@vpinstruments.com
Thu 07 Jan 2016 01:34:16 PM UTC

avrdude version 6 series fails to write programs bigger than 131.072 bytes to flash on my atxmega256a3bu. Instead of continuing onwards from the 131.072 byte (128kb) mark, the write procedure loops back to 0x0000, corrupting data from there on.

Or to put it an another way: When I flash a program 130kb in size, I end up with 128k of data in my flash, whereof the first 2kb is corrupted.

This problem was introduced in the version 6 series of avrdude (I tried 6.0.1, 6.1, 6.1-svn-20131205 and 6.2). Version 5.11 works fine for me.

No errors show up during writing, the bug manifests itself during verification and of course execution of the program, as the mangled program crashes the MCU.

Curiously this 128k mark is exactly on the second time an offset is defined in my intel .hex file. To rule out problems with the file reader code for that format I also tried .srec and .elf; same result for all.

This issue was migrated from https://savannah.nongnu.org/bugs/?46843

@mcuee
Copy link
Collaborator

mcuee commented Jun 5, 2022

The above is saying that this is a regression from 5.11. Not so sure if this has been fixed or not.

There are quite some xmega related issues list below but I do not have an xmega to carry out the test.

@mcuee
Copy link
Collaborator

mcuee commented Jun 20, 2022

This may be the same as #454 and #360.

Edit:
#454 and #360 are related to to AVR109/911 bootloader for xmega (AVR109 protocol extension).
The reporter of this issue #404 did not mention the programmer used. But it does not seem to be a bootloader since old version works. So the issue is different here.

@MCUdude
Copy link
Collaborator

MCUdude commented Sep 23, 2022

I'm not able to reproduce the issue. I've created two 256kiB hex files using srec_cat. The first one contains only 0x55s, and the other one contains 0x00's. I can flash and verify both files, and I can confirm that the correct content is there.

As a test, I've also created a with with 0xAA's that's written from the 128kiB mark and onwards. (My Dragon is a bit flakey, but it gets the job done). I'm pretty sure we can close this issue.

$ ./avrdude -cdragon_jtag -p atxmega256a3bu -e -Uflash:w:0x55_256kib.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9843 (probably x256a3bu)
avrdude: erasing chip
avrdude: reading input file 0x55_256kib.hex for flash
avrdude: writing 262143 bytes flash ...

Writing | ######################                             | 44% 28.21savrdude: jtagmkII_paged_write(): timeout/error communicating with programmer (status -1)
Writing | ################################################## | 100% 73.80s

avrdude: 262143 bytes of flash written
avrdude: verifying flash memory against 0x55_256kib.hex

Reading | ################################################## | 100% 52.63s

avrdude: 262143 bytes of flash verified

avrdude done.  Thank you.


$ ./avrdude -cdragon_jtag -p atxmega256a3bu -e -Uflash:w:0x00_256kib.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9843 (probably x256a3bu)
avrdude: erasing chip
avrdude: reading input file 0x00_256kib.hex for flash
avrdude: writing 262143 bytes flash ...

Writing | #############################################      | 89% 56.31savrdude: jtagmkII_paged_write(): timeout/error communicating with programmer (status -1)
Writing | ################################################## | 100% 73.26s

avrdude: 262143 bytes of flash written
avrdude: verifying flash memory against 0x00_256kib.hex

Reading | ################################################## | 100% 52.44s

avrdude: 262143 bytes of flash verified

avrdude done.  Thank you.

$ ./avrdude -cdragon_jtag -p atxmega256a3bu -e -Uflash:w:0xAA_128kib_256kib.hex 

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9843 (probably x256a3bu)
avrdude: erasing chip
avrdude: reading input file 0xAA_128kib_256kib.hex for flash
         with 131072 bytes in 1 section within [0x1ffff, 0x3fffe]
         using 257 pages and 512 pad bytes
avrdude: writing 131072 bytes flash ...

Writing | ################################################## | 100% 0.25s

avrdude: 131072 bytes of flash written
avrdude: verifying flash memory against 0xAA_128kib_256kib.hex

Reading | ################################################## | 100% 0.21s

avrdude: 131072 bytes of flash verified

avrdude done.  Thank you.

@stefanrueger for some reason, the read and write progress bar for the 0xAA_128kib_256kib.hex immediately jumped up to 100%, even though it took about 2x30 seconds for a read and write operation. I've attached the file for reference.

0xAA_128kib_256kib.hex.zip

@MCUdude MCUdude closed this as completed Sep 23, 2022
@mcuee mcuee added invalid This doesn't seem right and removed unconfirmed Maybe a bug, needs to be reproduced by someone else labels Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants