-
Notifications
You must be signed in to change notification settings - Fork 335
[VSC-1539] Fix scenario for partial encryption #1373
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
[VSC-1539] Fix scenario for partial encryption #1373
Conversation
|
Download the artifacts for this pull request: |
Move unencrypted files at the beginning
|
Pull request has been marked as |
|
Pull request has been marked as |
brianignacio5
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.
LGTM
Fabricio-ESP
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.
Confirmed partially encrypted files are now handled properly when generating flash command for esptool.
Description
Issue:
When using the --encrypted-files flag, the flash command generates duplicate arguments, causing the bootloader at address 0x0 to be written twice. This duplication can corrupt the encrypted bootloader during the flashing process.
Root Cause:
The current implementation appends encrypted files after the --encrypt-files flag, then appends all files (both encrypted and unencrypted) again, resulting in duplicated entries for encrypted files.
Fixes #1366
Type of change
Please delete options that are not relevant.
Steps to test this pull request
Prerequisites
I've used esp32-h2 devkitm-1 board with flash encryption already enabled in development mode, but any board should do.
ESP-IDF "flash_encryption" example project
Test Procedure
Setup the test environment:
flasher_args.jsonCreate test configuration:
flasher_args.jsonwith the following test configuration:{ "write_flash_args": [ "--flash_mode", "dio", "--flash_size", "4MB", "--flash_freq", "48m" ], "flash_settings": { "flash_mode": "dio", "flash_size": "4MB", "flash_freq": "48m" }, "flash_files": { "0x0": "bootloader/bootloader.bin", "0x20000": "flash_encryption.bin", "0xd000": "partition_table/partition-table.bin", "0x3b2000": "storage.bin", "0x16000": "ota_data_initial.bin" }, "bootloader": { "offset": "0x0", "file": "bootloader/bootloader.bin", "encrypted": "true" }, "app": { "offset": "0x20000", "file": "flash_encryption.bin", "encrypted": "true" }, "partition-table": { "offset": "0xd000", "file": "partition_table/partition-table.bin", "encrypted": "true" }, "storage": { "offset": "0x3b2000", "file": "storage.bin", "encrypted": "false" }, "ota_data": { "offset": "0x16000", "file": "ota_data_initial.bin", "encrypted": "false" }, "extra_esptool_args": { "after": "no_reset", "before": "default_reset", "stub": true, "chip": "esp32h2" } }Create placeholder files:
storage.binandota_data_initial.binfiles in the build folderFlash the device:
Expected Results
✅ With this fix:
❌ Without this fix (master branch):
Notice the duplicate entries for encrypted files in the broken version.
How has this been tested?
As described above
Test Configuration:
Checklist