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

[VSC-1213] Enhance flash encryption #1247

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

radurentea
Copy link
Collaborator

Description

Added check for SDK config modifications for encryption.

Fixes #1067

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Steps to test this pull request

  1. Open a project
  2. Use "ESP-IDF: SDK Configuration editor (menuconfig)
  3. Enable "Enable flash encryption on boot (READ DOCS FIRST)"
  4. Build and Flash project with UART
  5. Flash should be successful and the task should contain the --encrypt flag
    EX:

Executing task: C:\xxxxx.espressif\python_env\idf5.0_py3.8_env\Scripts\python.exe c:\xxxxxx\esp-idf-v5.0.1\components\esptool_py\esptool\esptool.py -p COM5 -b 460800 --before default_reset --after no_reset --chip esp32s3 write_flash --flash_mode dio --flash_freq 80m --encrypt --flash_size 16MB 0x0 bootloader/bootloader.bin 0x20000 app.bin 0x8000 partition_table/partition-table.bin

Test Configuration:

  • ESP-IDF Version: 5.2
  • OS (Windows,Linux and macOS): Windows

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Copy link

github-actions bot commented Jul 9, 2024

Download the artifacts for this pull request:
You can test these changes by installing this VSIX by click menu View -> Command Palette..., type Install from VSIX and then select downloaded esp-idf-extension.vsix file to install the extension.

@radurentea radurentea self-assigned this Jul 24, 2024
@radurentea
Copy link
Collaborator Author

radurentea commented Jul 31, 2024

This PR is not ready to be tested / code reviewed:

  • we need to add validation for JTAG flashing (by default when flash encryption is enabled, an efuse is burnt that will disable JTAG flashing on the device), in case JTAG is disabled and user tries to flash via JTAG we need to catch this error and handle it properly.
  • we need to modify the flash encryption documentation

@brianignacio5 brianignacio5 added this to the 1.9.0 milestone Aug 1, 2024
Copy link

Pull request has been marked as stale since there are no activities, and this will be closed in 5 days if there are no further activities

@github-actions github-actions bot added the stale Stale PR or Issue label Aug 17, 2024
@brianignacio5 brianignacio5 added ongoing Ongoing Issue or PR, this label will be used for issue or PR which is to be excluded by stale bot and removed stale Stale PR or Issue labels Aug 19, 2024
@radurentea
Copy link
Collaborator Author

Hi @brianignacio5, Please take another look for the new commits in regards to the error handling of JTAG Flash when efuses are burnt

Copy link
Collaborator

@brianignacio5 brianignacio5 left a comment

Choose a reason for hiding this comment

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

Some changes

src/coverage/configureProject.ts Outdated Show resolved Hide resolved
src/utils.ts Outdated Show resolved Hide resolved
src/flash/flashCmd.ts Outdated Show resolved Hide resolved
src/extension.ts Outdated Show resolved Hide resolved
src/coverage/configureProject.ts Outdated Show resolved Hide resolved
@radurentea radurentea force-pushed the enhance/flash_ecryption_v2 branch 5 times, most recently from 47b9390 to 41fabfb Compare September 13, 2024 09:16
@radurentea
Copy link
Collaborator Author

Hi @brianignacio5 PTAL, I've made the modifications you've requested

@Fabricio-ESP Fabricio-ESP changed the title Enhance flash ecnryption [VSC-1213] Enhance flash ecnryption Oct 22, 2024
@brianignacio5 brianignacio5 changed the title [VSC-1213] Enhance flash ecnryption [VSC-1213] Enhance flash encryption Oct 28, 2024
Copy link
Collaborator

@brianignacio5 brianignacio5 left a comment

Choose a reason for hiding this comment

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

Some changes regarding deprecating idf.adapterTargetName and moving to docs_espressif documentation.

src/flash/verifyFlashEncryption.ts Outdated Show resolved Hide resolved
src/espIdf/documentation/getDocsVersion.ts Outdated Show resolved Hide resolved
docs/tutorial/flash_encryption.md Outdated Show resolved Hide resolved
@radurentea
Copy link
Collaborator Author

Hi @brianignacio5,

Thank you for the code review! I've done the changes you've requested.

Please take another look.


const idfTarget = await getIdfTargetFromSdkconfig(workspaceRoot);
const eFuse = new ESPEFuseManager(workspaceRoot);
const data = await eFuse.readSummary();
Copy link
Collaborator

Choose a reason for hiding this comment

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

The readSummary function takes some time to load and the user doesn't see any information until it is completed. Suggestion wrapping this function into

vscode.window.withProgress(
  {
    cancellable: true,
    location: ProgressLocation,
    title: "ESP-IDF: Checking encryption eFuse...",
  },
  async (
    progress: vscode.Progress<{
      message: string;
      increment: number;
    }>,
    cancelToken: vscode.CancellationToken
  ) => {}
);

Tested using esp32 Core board using esp-idf v5.4 with flash_encryption example.

Otherwise LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ongoing Ongoing Issue or PR, this label will be used for issue or PR which is to be excluded by stale bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The 'Flash device' button does not support encrypted mode (VSC-1213)
2 participants