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
Finish off UF2 build support for MP at least for the ESP32-S2/S3 port #8222
Comments
The UF2 bootloader puts some constraints on the flash layout, how to enter the bootloader, and how to flash using the standard |
Link to relevant docs for the UF2 bootloader: https://github.com/adafruit/tinyuf2/tree/master/ports/espressif |
Hmm, ok, I feel this is a big opportunity missed if we can't find a way to allow folks to switch between CircuitPython, MicroPython, Arduino and whatever else that want to use that supports UF2 as easily as just going into the UF2 bootloader and loading the required firmware.uf2. Not everyone sticks to 1 dev platform, and most people new to Microcontrollers and specifically the ESP32-S range tend to get put off by the whole "esptool flashing MP and then having to reload UF2 bootloader and and then CPY or Arduino" to get things back. It puts MP into a "not going to try" category because of the that barrier, and we want no barriers to folks "trying" MicroPython. What about at least having the MP firmware respect the UF2 boot loader and not stomp it when flashing MP, so folks can get back into it if/when they want? |
Because the UF2 bootloader sits right in the middle of flash and takes up 256k. Projects not wanting to use UF2 (which is everything up until now) are therefore going to waste flash, and also have to reorganise their flash/filesystem layout. Furthermore, if the UF2 bootloader decides that it needs to change location/size, then we also need to update to follow suit, and so do all esp32-MicroPython projects. What boards currently ship with the UF2 bootloader installed? It would make sense to support those with UF2. If UF2 is going to be really popular then we could consider providing two builds of all boards: standard, and UF2 compatible. |
Right now all of my S2 and S3 boards ship with CPY and UF2 bootloader. So I'd like UF2 options for them. I'd assume if I had them for my boards, many other folks that use "other" ESP32-S2/S3 boards will want to get it as well... like the S2/S3 dev-kits for example. Just seeing the number of boards that get added to the CPY list as an indicator UF2 is super popular - I'd assume questions of "why is this not available for XXX board" might become common. |
If a board does not ship with the UF2 bootloader and we only have firmware that relies on it being there, then that won't work, it will confuse users that they need to install a bootloader first.
If it's added to the CircuitPython list, does that mean it ships with UF2 out of the factory? Or just that CircuitPython now supports it and provides instructions on how to install the UF2 bootloader first? |
It totally depends. An S3 devkit from Espressif does not ship with a UF2 bootloader on it. But Adafruit supply one for it and CPY to go with it. Supplying a MP UF2 version for boards Adafruit have CPY for is totally safe because Adafruit supply UF2 boot loaders for them as well. |
Ok, I think I might have been on the wrong track with this. It might be relatively easy to provide .uf2 files for all boards without any change. |
I have this working now. The changes needed are:
|
So a PR and Merge today? :D |
See #8246. |
That's wicked! Thanks for getting onto this so quickly! |
I totally agree with UnexpectedMaker's assessment of uf2's value for micropython. We've been using uP for commercial projects for several years now and love it. We're now in a situation where we're developing products that will need to be configured by less technical people and having them drag/drop configuration files using uf2 will be really valuable. This evening, I tried to get uf2 running on the latest nightly build without success. Here's what I tried:
|
You've confused what MicroPython on UF2 brings us... it has nothing to do with USB mass storage. A UF2 build of MicroPython just means that, assuming you have a board wit the UF2 bootloader on it, you can flash your board with MicroPython without using esptool (on the ESP32) and it wont stomp the UF2 bootloader, so you can go back into the UF2 bootloader and copy CircuitPython back on. It's about moving between dev environments and not requiring putting the UF2 back on after flashing MP like what happens now. MicroPython doesn't offer mounting as a USB mass storage device, and this doesn't change that. You still only get a USB serial device like you've always had. |
Thanks @UnexpectedMaker for the clarification. I'm actually trying (and failing) to reproduce what you've explained. I'm successful in creating a UF2 device with what I believe is the correct UF2 bootloader bin file from Adafruit. On this device, I can drop a circuitpython uf2 file successfully, however, I cannot replicate this behavior (call it 'dev environment change') with the latest nightly micropython uf2 file. The latter, while it does install micropython, stomps my preexisting uf2 bootloader thus disabling my ability to switch back to circuitpython. Perhaps the micropython forum is a better venue for me to ask for help or advice? Lastly, I will say that circuitpython's ability to share a file system on a host OS is very appealing. |
Are there any special flags that need to be set to build the UF2 file? When I run: I have tried putting print statements in makeimg.py and it seems like it isn't being called. idf is v4.4.1 and micropython is latest master branch Thanks |
@dpgeorge @mattytrentini Can we please finish off the work needed to get UF2 builds out of MP?
From my understanding, it's just the renaming of the FS partition so that the UF2 bootloader can find it is all that's needed?
Mat already got the uf2 build part done.
I feel this is REALLY important to make happen and quickly.
Thanks!
The text was updated successfully, but these errors were encountered: