Skip to content
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

try to implement esp32s2 boot2 stage update #138

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hathach
Copy link
Member

@hathach hathach commented Jul 30, 2021

Draft PR to allow boot2 stage update for esp32s2. I have tried to update the boot2 binary with update-uf2, there is a couple of issue

  1. There is a macro check to validate the address, though it is easily by passed by enabling unsafed write https://github.com/espressif/esp-idf/blob/master/components/spi_flash/esp_flash_api.c#L51
  2. There is some meta data required for boot2 bin
Invalid image block, can't boot.
ets_main.c 386 

Digging to esptool.py https://github.com/espressif/esptool/blob/master/esptool.py#L3488, look like it does some modification to bootlaoder image to add image size, flash mode, flash freq etc to the very frist 4 bytes (header). At this point, I don't think it is the worth effort to update it, since it seem rather unsafe. It is rather easy to flash boot2 update via rom bootloader. Boot2 won't change much anyway.

Originally posted by @hathach in #134 (comment)

PS: after giving a bit more thought, I think it is still worth updating, since ROM loader is there to unbrick. However, I don't quite feel comfortable following the esptool code, maybe if someone know where is the specs for the layout. We could get this done. I push my interim work to the branch here https://github.com/adafruit/tinyuf2/tree/esp32s2-update-boot2 . If anyone could help with meta data part, that would nail it.

failed due to lacking meta data (boot2 size, flash freq, flash mode)
added as header
https://github.com/espressif/esptool/blob/master/esptool.py#L3488
(_update_image_flash_params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant