-
Notifications
You must be signed in to change notification settings - Fork 5
Enhancements for the esp32_flash task #52
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
base: master
Are you sure you want to change the base?
Conversation
5685f2a to
91a5fc9
Compare
91a5fc9 to
783d3ad
Compare
586a1ef to
d334c12
Compare
pguyot
left a comment
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.
(Partial review)
src/atomvm_esp32_flash_provider.erl
Outdated
| auto -> | ||
| read_flash_offset(EspTool, Port, Partition, State); | ||
| Val -> | ||
| Offset0 = read_flash_offset(EspTool, Port, Partition, State), |
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.
Nicer transition behaviour would be to check that offset matches the beginning of any partition (main.avm or named otherwise).
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.
Good idea! Now if the given offset does not match the expected partition name a warning will be issued, but as long as it is a data partition of a valid subtype (any subtype not specifically reserved for other purposes - i.e. cordump, nvs, nsv_keys, fat, etc) the partition will be used.
src/esp_part_dump.erl
Outdated
| "0xc00", | ||
| TempFile | ||
| ]), | ||
| os:cmd(Cmd), |
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.
os:cmd doesn't return the status. We may want to use the good old open_port({spawn_executable, 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.
I updated this file and the esp32_flash provider to use open_port/2, this had the added benefit of faster flash operations and quieter output.
Changes error reporting for the esp32_flash task to include stack trace when rebar3 is executed with DIAGNOSTIC=1 or DEBUG=1. Signed-off-by: Winford <[email protected]>
3a391b9 to
4d4e57e
Compare
11dfd1c to
9b7d519
Compare
The `offset` for the beam application partition is now read from the partition table on the attached esp32 device. When a custom partition table is used that does not use `main.avm` for the beam app partition name the `app_partition` parameter should be used to specify the application partition to be flashed. Valid application partition sub-types (the type is `data`) are `phy` or `0xAA`. If the `offset` parameter is specified it will be used to verify that the offset address of the application partition matched the expected value. This may be used to prevent flashing to a standard build of AtomMV for application that require a custom partition table. The `port` that the ESP32 is attached to is now auto discovered by default. When more than one ESP32 device is plugged into USB the port should be specified to control which device is flashed. Error reporting has been improved with descriptive error messages. Dialyzer warnings for the esp32_flash task have been fixed when analyzing atomvm_rebar3_plugin. Signed-off-by: Winford <[email protected]>
9b7d519 to
fe79208
Compare
Changes include automatic detection of the beam application partition (default
main.avm) to prevent overwriting the wrong flash sectors. This prevents overwriting Elixir library modules for Elixir supported builds, and assures that the application will be written to the same address that AtomVM will load and run. When flashing to a device with a custom partition table theapp_partitionparameter should be supplied if the app partition is not namedmain.avm.Other changes include: