-
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
Use page erase for UPDI programming #1837
Conversation
I think this is great idea to do it like that, just wanted to make sure - for the |
As these new AVRx[DE] devices are architecturally Xmega devices, it seems valid and useful to me to treat them the same wherever it makes sense. |
Yes, #1834 or #1835. Both should work with this PR. I take your preference.
Not at all: I have not looked into the code (and don't have these programmers). Like serialupdi they might not work with
I agree. From a theoretical point of view I can see how the suggested high-level use of page erase should work. Currently we don't seem to have the capacity to test within the core maintenance team (holidays, time pressures etc), so my strategy is to merge, so we widen the pool of testers before v 8.0 to those who like the bleeding edge versions. |
That's a tough choice to make. #1835 is a bit more "correct" as in it introduces new memory as a separate flow (which should be the case), but it adds extra page erase operation which in this situation doesn't seem to make sense anymore. I will implement another PR, similar to #1835 but without these additional page erase calls. This will ensure that we have separate flow for Would that be OK? |
@dbuchwald Sounds like the perfect plan! Thank you |
@stefanrueger done. Instead of creating new branch and a new PR I just changed the one used in #1835 - feel free to give it a try and if you like how it works, you can go ahead and merge it. I must say, I absolutely love this cooperation, every time I get an e-mail about new feature request or bug report I feel this excitement that got me into software engineering years ago. I really wish I could have such a great team in my daily work :) |
Thanks for the PR and for the kind words! Yes, AVRDUDE is a very neat project, and the best is that we get to collaborate with brilliant people. Thanks for being on the team @dbuchwald - without your code AVRDUDE wouldn't be what it is! |
This PR makes AVRDUDE use page erase for UPDI parts.
Traditionally, AVRDUDE has used page erase for XMEGAs in favour of chip erase unless the user decided to go for
-e
:avrdude/src/main.c
Lines 1684 to 1687 in 42c984c
The main change is to use
(PM_PDI | PM_UPDI)
instead ofPM_PDI
the remainder being documentation and clarification. A secondary change is to switch off trailing 0xff optimisation when page erase is used over chip erase, the reason being that in the rare but possible case of an application having0xff
data storage at its end that must not be cut off in absence of a CE. (Not doing so has been a bug for XMEGA programming.)Apart from the fact that it makes sense to program UPDI flash using page erase, it greatly simplifies the treatment of the new
bootrow
memory (AVR-DU and AVR-EB parts) that needs erasing before writing. Whilst @dbuchwald has offered a PR wherebootrow
is page erased before writing (thanks!), the same work would need to be done for all other UPDI programmers:In absence of -e the new method leaves the contents of not programmed UPDI flash pages as before. However, the user will be informed that no CE happens: