Skip to content

Request ROM bootloader when resetting using the 'serial trick' #5880

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

Merged
merged 3 commits into from
Jan 21, 2022

Conversation

jepler
Copy link

@jepler jepler commented Jan 17, 2022

Closes: #5870.

Copy link
Collaborator

@microdev1 microdev1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to request UF2 bootloader here instead of the default ROM bootloader? This won't work on non-UF2 boards.

@jepler
Copy link
Author

jepler commented Jan 18, 2022

For my use case, yes. This makes it just the same as other family Adafruit boards. Basically it allows me to have a single make rule which operates across different microcontroller families that builds & programs circuitpython all at once.

If there's a way to tell whether tinyuf2 is not present, and fall back to the ROM bootloader, that's fine. Or, if a specific board is designed to run without bootloader, we could make it compile-time conditional instead. Or to notice at CP start that UF2 was requested but did not run(if that's possible) and then jump from there into the ROM bootloader?

microdev1
microdev1 previously approved these changes Jan 18, 2022
Copy link
Collaborator

@microdev1 microdev1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think the consistency with other boards should be enough for now, a new issue topic can be opened to discuss further.

@tannewt
Copy link
Member

tannewt commented Jan 18, 2022

I think it'll end up back in CP if TinyUF2 isn't installed. I'm not sure what state is saved but I bet CP can check it on startup in port_init.

@jepler
Copy link
Author

jepler commented Jan 19, 2022

I checked what Arduino does, and even if tinyuf2 is installed, the "1200 baud trick" sends it to the ROM bootloader. Which is better, consistency with Arduino or consistency with other uf2-bootloader boards? I prefer uf2, because it can auto-reset into the new FW; esptool can't over USB for some reason I don't understand.

@tannewt
Copy link
Member

tannewt commented Jan 19, 2022

1200 should go to ROM to match arduino because it's meant for folks to escape CP back into Arduino. CP's API can reset into UF2 to match our other boards.

@dhalbert
Copy link
Collaborator

@jepler is this all set to merge, or is there still something to discuss? It sounds to me like it's all OK.

@jepler
Copy link
Author

jepler commented Jan 21, 2022

@dhalbert sounds like scott's asking me to change it, so that the 1200 trick returns to the state that 'works for arduino'.

Per Scott, the purpose of this trick is to make the board programmable from Arduino even when CP is installed, so my convenience of escaping into UF2 is not going to work out.
@dhalbert dhalbert requested a review from tannewt January 21, 2022 02:29
@jepler jepler changed the title Request UF2 bootloader when resetting using the 'serial trick' Request ROM bootloader when resetting using the 'serial trick' Jan 21, 2022
@microdev1 microdev1 added the espressif applies to multiple Espressif chips label Jan 21, 2022
@microdev1 microdev1 merged commit dab35f7 into adafruit:main Jan 21, 2022
@tannewt
Copy link
Member

tannewt commented Jan 21, 2022

@jepler if you want a baudrate way of resetting into uf2 you could add another magic baudrate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
espressif applies to multiple Espressif chips
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rebooting into bootloader doesn't work
4 participants