-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
added example of flashing from python code (ESPTOOL-952) #1029
base: master
Are you sure you want to change the base?
Conversation
👋 Hello brentpicasso, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. Click to see more instructions ...
Review and merge process you can expect ...
|
Hi @brentpicasso, We will be refactoring esptool to be easily usable as a Python module in the next major release, so this script will most likely stop working quite soon due to changing APIs. On the other hand, starting with the documentation now won't hurt; this contribution seems like a good start. I have some issues and suggestions before we can move on. Feel free to say you don't have time for this, in that case, I can take over. |
|
|
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.
Left a few suggestions. Let me know if that seems reasonable!
Flashing from your python code | ||
============================== | ||
|
||
The following is an example on how to flash the ESP32 from a custom application: |
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.
Changing ESP32
to {IDF_TARGET_NAME}
will make it dynamically change based on the selected target.
# Typical block size (16 KB) | ||
BLOCK_SIZE = 0x4000 | ||
|
||
#beginning of flash address |
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.
Please keep all the comments formatted uniformly.
stub.flash_begin(total_size, FLASH_BEGIN) | ||
|
||
# Flash in blocks using flash_block | ||
block_size = BLOCK_SIZE |
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.
This is called FLASH_WRITE_SIZE
in esptool and changes depending on if that's the ROM bootloader or the stub.
So in this case block_size = stub.FLASH_WRITE_SIZE
seems better.
BLOCK_SIZE = 0x4000 | ||
|
||
#beginning of flash address | ||
FLASH_BEGIN = 0x10000 |
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.
Suggest renaming to FLASH_ADDRESS
or FLASH_OFFSET
Hi, @radimkarnis I ran out of time this week, preparing for some travel. I accept your offer to move it forward! Thank you! |
Example app demonstrating how to flash from python code. Follow up from PR #1022