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

Write the image to the correct target app partition #634

Merged
merged 1 commit into from
May 23, 2024

Conversation

simpkins
Copy link
Contributor

@simpkins simpkins commented May 4, 2024

Perhaps I am misunderstanding what the --target-app-partition flag is supposed to do, but the code previously always wrote the image to the "factory" app partition if one was present, regardless of the partition specified with the --target-app-partition flag.

This change updates the code to write the image to the partition specified with the --target-app-partition flag.

I confirmed that using espflash flash --target-app-partition ota_0 now causes espflash to write the image to the ota_0 partition. Note that this leaves the factory partition and any ota_data partition unchanged, so the bootloader will still boot from the factory partition by default, but this makes it possible to write new app images to the OTA partitions for testing purposes.

@simpkins
Copy link
Contributor Author

simpkins commented May 4, 2024

It looks like the --target-app-partition code was working correctly when added in #461, but it looks like it was probably broken shortly afterwards in d886d33 which updated the code to always write to the factory partition again.

Copy link
Member

@SergioGasquez SergioGasquez left a comment

Choose a reason for hiding this comment

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

Hi! Thanks for your contribution! Changes LGTM!

Mind solving the conflicts so we can merge it?

This updates the code to honor the --target-app-partition flag,
and write the application image to the specified partition.  Previously
the code always wrote the image to the "factory" app partition if one
was present, regardless of the partition specified with the
`--target-app-partition` flag.  (It seems like this behavior was likely
broken in d886d33, which updated the code to always write to the
factory partition again.)

I confirmed that using `espflash flash --target-app-partition ota_0` now
causes espflash to write the image to the `ota_0` partition.  Note that
this leaves the `factory` partition and any `ota_data` partition
unchanged, so the bootloader will still boot from the factory partition
by default, but this makes it possible to write new app images to the
OTA partitions for testing purposes.
Copy link
Member

@SergioGasquez SergioGasquez left a comment

Choose a reason for hiding this comment

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

LGTM!

@SergioGasquez SergioGasquez merged commit 4acd8f6 into esp-rs:main May 23, 2024
28 checks passed
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.

None yet

2 participants