-
Notifications
You must be signed in to change notification settings - Fork 136
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
-U writes sometimes more bytes to flash/memory than input file has #1050
Comments
Yes, this is a problem. Tested with ATmega2560 and usbasp (with PR #1051 to address the stdin verification issue).
|
I agree. |
@stefanrueger If it is just applicable for terminal mode, then the penalty is small. Same probably for the case of Since you have the other idea of implementing |
@stefanrueger Sorry not yet. This issue is still there in CLI mode.
|
Terminal mode is okay.
|
Yes, this Issue is only for It normally affects EEPROM (which might be saved on a chip erase when the fuses are set accordingly), but also flash, eg, with |
Indeed. Just tested it with an Arduino Uno clone. I can see that the four bytes
|
Without PR #1188, using git main, the issue is there.
|
With PR #1188. @stefanrueger
|
The updated version is okay now, tested with |
Problem. -U writes sometimes more bytes to flash/memory than input file has. This happens when
pgm->page_erase()
beforepgm->page_write()
)is_bootloader
programmers that carry out SPM erase before a page writeSolution. The culprit is
avr_write()
that uses paged write routines when possible and assumes all memories look like NOR-memory (for which writing 0xff is a NOP). For now, I suggest always reading back the unset bytes in partially filled memory pages before the paged write. This is not necessary for flash that looks like NOR-memory, but there is (currently) no way of knowing which programmer/part combination makes flash look like NOR-memory or not: Sometimes bootloaders pretend to be following a certain protocol, but don't (think optiboot and-c arduino
or Trinket/Gemma that pose as-c usbtiny
). The small delay for read-back of partially filled memory pages is a price worth paying to ensure AVRDUDE does not alter memory outside the input file.Example. Use your own favourite programmer instead of ... and try below. Notice the
echo -n H
input should write one byte, but four bytes are written as evidenced by the three 0xff at addresses 1..3.The text was updated successfully, but these errors were encountered: