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

[Feature Request]: 需要让flasher_args可手动配置分区文件是否需要烧录 (VSC-1572) #1407

Open
shishirong opened this issue Jan 21, 2025 · 14 comments · May be fixed by #1436
Open
Assignees
Labels
Feature / Enhancement Request Request for Feature/ Enhancement

Comments

@shishirong
Copy link

Is your feature request related to a problem? Please describe.
使用场景:我的工程分区表如下:

nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
ota_0,app,ota_0,0x10000,1M,
ota_1,app,ota_1,0x110000,1M,
storage,data,littlefs,0x210000,1984K,

调试过程中,会经常烧录应用程序,目前默认行为是会烧录所有分区文件,但是平时调试时只需要烧录ota_0 而其他分区需要保持不变,vscode-esp-idf-extension并没有找到相关配置可以控制这个默认烧录行为

Describe the solution you'd like
允许用户手动配置分区文件是否需要烧录

@shishirong shishirong added the Feature / Enhancement Request Request for Feature/ Enhancement label Jan 21, 2025
@github-actions github-actions bot changed the title [Feature Request]: 需要让flasher_args可手动配置分区文件是否需要烧录 [Feature Request]: 需要让flasher_args可手动配置分区文件是否需要烧录 (VSC-1572) Jan 21, 2025
@SinglWolf
Copy link
Contributor

It would be great if the file build functions for the partition and the upload of this file into the partition looked like this (as in PlatformIO):

Image

@brianignacio5
Copy link
Collaborator

brianignacio5 commented Feb 13, 2025

This feature is already available in the extension but unfortunately not documented.

PTAL @shishirong @SinglWolf and let me know what you think.

  1. In the Activity bar click the Espressif icon and expand the Device Partition Explorer section.

Image

  1. Click the Refresh Partition Table button that appear next to Device Partition Explorer title. Partitions will be now shown in this section.

Image

  1. The list of partitions will be read from the device (check that the serial port shown in the status bar is correct). When you click a partition you can now: 1) read the current partition and save as bin in the current project or 2) select a bin to flash in the current partition.

  2. You can also right click a .bin file and select Flash binary to partition.... A dropdown will appear to select one of current device partitions or manually type offset to flash to.

Image

@brianignacio5 brianignacio5 self-assigned this Feb 13, 2025
@SinglWolf
Copy link
Contributor

PTAL @shishirong @SinglWolf and let me know what you think.

The Device Partition Explorer feature is interesting, but it is too complicated to use and unsafe for practical use - all partitions are writable for any binary files. In addition, the Device Partition Explorer does not have the mode you described for downloading a partition to file. This would be useful for subtypes coredump, nvs, fat, spiffs, littlefs (littlefs is not supported in the Partition Table Editor). There is also no easy way to download only bootloader.bin to the device partition.

@shishirong
Copy link
Author

This feature is already available in the extension but unfortunately not documented.

这个确实可以实现烧录部分分区文件的功能,只不过操作起来还是繁琐了一点,因为开发与调试过程中,通常都是直接使用 Build, Flash and Monitor: Build, Flash and Monitor 来进行烧录的

@brianignacio5
Copy link
Collaborator

brianignacio5 commented Feb 14, 2025

In addition, the Device Partition Explorer does not have the mode you described for downloading a partition to file.

You are right I'm not sure why I thought it was there. I could add this feature is not very hard.

There is also no easy way to download only bootloader.bin to the device partition.

You can right click bootloader.bin and select the offset but I understand because you would prefer to see these partitions listed in the Device Partition Explorer above.

I've just noticed that gen_esp32part.py doesn't really return all partitions from current device.

So let me summarize the required changes, to my understanding, for the feature request implementation here:

  1. Find a way to obtain all partitions from current serial port device.
  2. Add read partition and save to file option
  3. Add a command to build and another to flash specific partition

@brianignacio5
Copy link
Collaborator

brianignacio5 commented Feb 21, 2025

Hello guys @shishirong @SinglWolf !

I've created a PR to fix issues we discussed in here #1436

Please take a look.

bootloader and partition table information come from build directory's flasher_args.json and bootloader size from bootloader.bin.
Now we can read a partition from device and saved as bin in current project.
Also added commands to build and flash just App, bootloader and partition table listed as ESP-IDF: Build App, ESP-IDF: Flash App only, ESP-IDF: Build Bootloader, ESP-IDF: Flash Bootloader Only, ESP-IDF: Build Partition Table, ESP-IDF: Flash Partition Table Only

Screenshot 2025-02-21 at 18 21 48

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.

@brianignacio5
Copy link
Collaborator

brianignacio5 commented Feb 21, 2025

About the filesystem Image and OTA, I think is very similar to provide functionality with the previous comment.

It will depend that your current project does have a partition table with related partitions (ota, spiffs).

About building these filesystems please review this:

for FATFS: https://github.com/espressif/esp-idf/blob/c71d74e2f853b1135c63f47e349f2a08f63f3e01/examples/storage/fatfs/fatfsgen/main/CMakeLists.txt#L18
for SPIFFS: https://github.com/espressif/esp-idf/blob/c71d74e2f853b1135c63f47e349f2a08f63f3e01/examples/storage/spiffsgen/main/CMakeLists.txt#L9
for LittleFS: https://github.com/espressif/esp-idf/blob/c71d74e2f853b1135c63f47e349f2a08f63f3e01/examples/storage/littlefs/main/CMakeLists.txt#L7
for NVS: https://github.com/espressif/esp-idf/blob/c71d74e2f853b1135c63f47e349f2a08f63f3e01/examples/storage/nvsgen/main/CMakeLists.txt#L9

Since a filesystem existence in your project depends on configuration is hard to determine an script to trigger this from IDE without more information.

I try to discuss it with ESP-IDF Storage team to see if there something we can do about it.

@SinglWolf
Copy link
Contributor

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.

Unfortunately, I don't have a spare computer to check. I'll wait for you to approve my PR #1409.

Copy link

github-actions bot commented Mar 9, 2025

This issue 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 Mar 9, 2025
@shishirong
Copy link
Author

This feature is already available in the extension but unfortunately not documented.

这个确实可以实现烧录部分分区文件的功能,只不过操作起来还是繁琐了一点,因为开发与调试过程中,通常都是直接使用 Build, Flash and Monitor: Build, Flash and Monitor 来进行烧录的

@brianignacio5 可以考虑一下这个提议吗?

@brianignacio5
Copy link
Collaborator

Sorry @shishirong I don't understand what you want to achieve. build flash monitor function is already there. What is missing ?

@github-actions github-actions bot removed the stale Stale PR or Issue label Mar 10, 2025
@shishirong
Copy link
Author

shishirong commented Mar 10, 2025

@brianignacio5 "Build Flash Monitor " default is flash all partition , but Just want to "Build + flash<app partition> + Monitor" at development usually. Although the ESP-IDF: Flash App only command has been added now, it is still not as convenient to use as Build Flash Monitor.

@brianignacio5
Copy link
Collaborator

brianignacio5 commented Mar 10, 2025

Oh I see. The question is where to set this option. App Bootloader and Partition Table could be set in a setting that allows you to define what to flash, for example "idf.partitionToFlash": ["all", "app", "bootloader", "partitionTable", "ask"]. The ask option could be used to display a dropdown with all partition binary from <build-dir>/flasher_args.json and allow you to choose what to flash.

What do you think @shishirong ?

@shishirong
Copy link
Author

yes, add option for config build and flash partition in some args.json file (flasher_args.json will change after every build). if add a gui page similarly "ESP-IDF Partition Table Editor" for edit It couldn't be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature / Enhancement Request Request for Feature/ Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants