-
Notifications
You must be signed in to change notification settings - Fork 4
allow board variant to has its own custom partition.csv and bootloader.bin #2
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
platform.txt
Outdated
@@ -4,10 +4,9 @@ version=2.0.0 | |||
runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf | |||
runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf | |||
|
|||
tools.esptool_py.path={runtime.platform.path}/tools/esptool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason why esptool is defined this way is because the path gets replaced when packaging for the board manager. Can not accept this in the main repo :) it will break the process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, sorry, I didn't know about that. is trying to remove duplication code, maybe we could have an variable for upload e.g
tools.esptool_py.upload.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{build.path}/{build.project_name}.bootloader.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin"
tools.esptool_py.upload.pattern="{path}/{cmd}" {pattern_args}
tools.esptool_py.upload.pattern.linux=python "{path}/{cmd}" {pattern_args}
Though it is totally up to you, I would revert it if that is your preference, since you are the maintainer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure :) any optimisation and removing of duplication is great :) as long as that line stays the same so it will be properly replaced
I would have implemented it the same way :) maybe not a bad idea to add the option to have a bootloader in the sketch folder as well. I have one question though... who will take care of updating those bootloaders when the other ones get updated? Is all of their source public? If so, we should add them to the lib builder repo (4.2 branch) then they will get rebuilt every time that libs are updated. This happens mostly by cron action. |
I will update the PR to also include the command to check for the bootloader.bin in the sketch folder as well.
I am glad you asked, Adafruit is working on an opensource cross-platfrom uf2 bootloader based on tinyusb called tinyuf2 which also feature esp32s2 https://github.com/adafruit/tinyuf2/tree/master/ports/esp32s2, it contains a slight modification of IDF bootloader to load a factory app (which can be used to update ota partition) and/or set an indicator to user. Note: if you are new to uf2, the format is introduced by Microsoft for their makecode https://github.com/microsoft/uf2 and used as main method to update firmware for Adafruit Circuitpython https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/uf2-bootloader-details . It shows up as MSC drive and user can just drag and drop the uf2 file to perform DFU. Although Espressif IDF is easy to install by developer standard, it is still a problem to install it on hundreds of computers in a school or institution which requires training, setup for teachers and students. For Circuitpython, they can just download the pre-built uf2 binary and drag &drop, actually the firmware update is rare, most of the modification is the python script :) . Though some of the user may want to switch back and forth between Arduino and Circuipython (many do !), therefore it is nice to have the custom partition and bootloader for board/variant to make the switch seamlessly and user doesn't need to re-flash tinyuf2 or loose any files on fatfs. |
Updated esptool using the path and PS: @me-no-dev I don't quite understand how the CI failed, it say the source list and cmakelist don't match, but I haven't changed either of those. Would you mind giving me some hints on how to fix it :) |
601ec5d
to
5b5b61c
Compare
@me-no-dev I have another question, it would be nice to also have a custom |
this is tested and ready to merge! |
@hathach yes I also looked at the fail and did not get the reason. It's a script that makes sure that CMakeLists.txt includes all source files in the framework (so that it works as IDF component). On the |
For factory to work in any way, the following string will have to be added to the flash command, based on a board option: |
@hathach there is something wrong with this branch. Did you start it off of master? CI is downloading old toolchain and probably have other old stuff also. CMakeLists.txt and the parser have both changed. Seems you probably have only one changed here :) so the test fails. |
we are working off of 4.2 branch |
It is based on the release/v4.2 , maybe it has some hipcup, we will figure it out when submitting PR to official repo :)
ah thank you very much for the suggestion, |
…oad.extra_flags (#5056) done on behalf of @ladyada, this PR does: Add Adafruit FunHouse and upcoming Adafruit Feather Esp32s2 Update Adafruit magtag and metro esp32s2 to have tinyuf2 as factory app Also modify platform.txt as discussed in adafruit#2 + adafruit#3 + adafruit#4 to add support for Board/variant partition.csv, bootloader.bin ( priority is user sketch > variant > build.parition/boot ) upload.extra_flags to optionally flash tinyuf2 as factory application Remove duplicated parameter in running python script in linux and windows Please review and let me know if you want any changes. Notes: tinyuf2 is a uf2 bootloader for multiple platforms. For esp32s2, it is an factory app to perform uf2 firmware update.
This PR is essentially adding same function like #1, but targeted the
v4.2
instead ofesp32s2
branchThis PR allow variant to has its own custom patition.csv and 2nd stage bootloader.bin. If those don't exist, it will use default sdk partition.csv and sdk/bootloader. This is required for board that have pre-loaded tinyuf2 bootloader and allow to switching back and forth between circuitpython and arduino without overwrite the user fatfs and/or the bootloader + tinyuf2
It looks good however, but require modifying the platform.txt, maybe espressif would have other ideas on how to implement this.