-
Notifications
You must be signed in to change notification settings - Fork 1k
Add dfu-util upload method #351
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
Conversation
There is several possibilities for DFU:
I guess in a first step we should focus on the built-in one.
I don't think. Default address is ok anyway this could be handled later by using a command wrapper as done using the https://github.com/stm32duino/Arduino_Tools/blob/9d655e1880145895719a2a71e686cc3800ee203c/linux64/maple_upload#L12
For the built-in DFU, it requires
|
Thanks for the detailed reply!
I agree, that's probably the most useful thing for most people, and should be the most straightforward - that seems to be working fine on the boards I have tested, but it would be good if anyone else has boards to test.
I think it's good to have the option to set the flash address - the bootloader I'm using needs that, but I don't know if that is common. I'm not sure how Roger's bootloader handles that - perhaps through the ALT flag, as you mentioned. Thanks for the explanation about
I think you're right. The booloader I'm using requires So, my understanding is that we could change this line:
To:
And then change the boards.txt definition to update the
And then anyone that is using custom bootloaders can change the I guess for 90% of boards (those using built-in bootloader) the Then DFU upload for most boards with hardware DFU bootloaders would only need the two lines:
Not sure if that is possible, but it would keep the boards.txt file cleaner. |
Right
I think it should be possible as (currently no other upload method use I've tested with a Nucleo F429ZI. This work under Linux but not under windows. Anyway under windows I've didn't succeed with STM32CubeProgrammer. Currently, I don't know why and need to investigare as my device is well recognized as STM32DFU. |
Allow specifying dfu-util altsetting, needed by some bootloaders.
Right, I've changed the upload pattern to include the protocol flag, so now the I couldn't figure out setting |
So, now that the latest tools release includes the updated dfu-util for Windows, I think this is usable for DFU upload using the built-in DFU support on some STM32 chips. Custom DFU bootloaders should be supported too, but I haven't tested much with those recently. No reason they shouldn't work though. I've tested my custom boards using an F446 (RUMBA32 and another one), along with an F407 board, and both are happy uploading via DFU from the IDE provided I jumper BOOT0 when I reset / power-on the board (i.e., the micro needs to be in bootloader mode). I assume other people are interested in having DFU upload working. Should we see if we can get this merged? For reference, with this merged, we can enable DFU upload targeting the built-in bootloader on boards like so:
That's working for my application - jumper BOOT0, press reset, hit upload, and it works. It would be great if we could get this merged, as I'm hoping to start shipping RUMBA32 boards now but at the moment will need to tell my customers to manually add in DFU support. I've been holding off on this seeing the progress that has been made in #415, but this PR is working so maybe we should merge it and it can be improved / replaced later if better methods become available. What do you think @fpistm? |
Hi @chrissbarr |
This PR is superseded by #514 |
This allows the dfu-util tool to be used as an upload method if specified in a board's definition. In my testing this is compatible both with the built-in DFU bootloader (only tested on an F446) and a custom software bootloader that implements DFU mode (again, on the F446).
At the moment I'm using it in my WIP branch adding my RUMBA32 board, here. It's partly dependent (on Windows) on the recent PR I submitted in the Arduino_Tools repo updating the dfu-util version (stm32duino/Arduino_Tools#29), as the older version of dfu-util did not seem to work on Windows, and the file structure has been updated slightly.
I haven't added any examples to any of the existing boards, mostly because I'm not sure which boards would benefit from using the DFU upload method - but I could get them added to this PR if anyone has suggestions.
Here are two boards.txt examples from my RUMBA32 fork. The first uses ST's built-in DFU bootloader (so BOOT0 must be held high on reset):
And this using my bootloader, which sits in the first page(s) of flash and is supposed to upload the user code to the page starting at 0x08010000:
I'm not sure that my bootloader in particular is any use with this core (I wrote it to set aside space for EEPROM emulation in the STM32GENERIC core - haven't yet investigated if I will still need it with this core), but because the address, VECT_TAB_OFFSET and ldscript can be set in the upload_method definition, this should be adjustable to any other bootloaders people want to use - or just with the built in DFU bootloader common to many STM32 chips.
Questions:
address
variable? It's likely to be0x08000000
for most boards, unless they use a custom bootloader.upload.protocol
andupload.tool
inboards.txt
? I'm missing something in how they map from theboards.txt
to theplatform.txt
in my examples, and feel I probably shouldn't be repeating the same thing twice.build.extra_flags
, rather than overwriting it (like in my second example), where all I want is to add theDVECT_TAB_OFFSET=0x10000
flag?Before merging:
Thoughts?