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

Flash Size in bootloader causing flashing issues with firmware built with IDF5.x #2950

Merged
merged 1 commit into from
Jun 6, 2024
Merged

Flash Size in bootloader causing flashing issues with firmware built with IDF5.x #2950

merged 1 commit into from
Jun 6, 2024

Conversation

AdrianSoundy
Copy link
Member

@AdrianSoundy AdrianSoundy commented Jun 6, 2024

Description

This is a issue caused by the change in IDF5.x
Originally when flashing the NF firmware bootloader the actual flash size was updated in the bootloader header. With IDF 5.x this is not done by default as a new SHA1 digest has been added to detect corruption.

This causes a problem when flashing a module which has a different flash size to what was specified in the build.

  1. When the target flash was smaller then what was in the build we get an exception when trying to init the nvs.
  2. When the target flash was larger then build size we had a problem when it tried to validate the partition sizes. i.e. The bootloader contains size of 4MB but partition table for the 8MB flash had been loaded by nanoff because flash size is 8MB.

If built flash size was same as target flash size it all worked ok

i.e.

ESP32_S3 firmware's built with flash size of 8MB

  • ESP32_S3 with 8MB flash = OK
  • ESP32_S3 with 4MB flash = error

ESP32 firmware's built with flash size of 4MB

  • ESP32 with 4MB flash = OK
  • ESP32(Wrover) with 8MB flash = error

When target flash size is bigger then built size you could work around problem using
--partitiontablesize 4 option.

Other possible ways to fix this in long term so that digest is correct.

  • Updating flash size at start of application.
  • Building multiple bootloaders for different flash sizes and choosing the correct bootloader in nanoff
  • Patching flash size and updating digest in nanoff.

Changes made.

Have added the option CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE to all target sdkconfigs.
This will cause the flash size to be updated correctly in bootloader and all then works correctly.

The only problem now is there is a warning in the boot log that the digest is incorrect.

Also changed all sdkconfigs to always build with a 4MB flash size.

Motivation and Context

Also Discord thread
https://discord.com/channels/478725473862549535/1247532363173330945

How Has This Been Tested?

Tested locally with a ESP32_S3 with 4MB and 2MB psram (ESP32_S3 lolin mini )
Now flashes and runs OK

Tested a ESP32 REV3 8MB and OK

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).

Summary by CodeRabbit

  • New Features

    • Introduced CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE configuration option across various ESP32 targets to enhance flash size management.
  • Configuration Updates

    • Updated flash size configurations and partition table filenames for ESP32S3 targets to align with new flash size settings.

@nfbot nfbot added the Type: bug label Jun 6, 2024
@AdrianSoundy AdrianSoundy requested a review from josesimoes June 6, 2024 10:12
Copy link

coderabbitai bot commented Jun 6, 2024

Walkthrough

The recent changes introduce the CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE configuration option across various ESP32 target configuration files. This update ensures that the flash size is correctly identified and updated in the firmware header, addressing issues with incorrect flash size detection during the boot process.

Changes

File(s) Change Summary
targets/ESP32/_IDF/sdkconfig.default Added CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with value y
targets/ESP32/_IDF/sdkconfig.default.esp32c3, targets/ESP32/_IDF/sdkconfig.default_rev3.esp32c3, targets/ESP32/_IDF/sdkconfig.default_rev3_noconsole.esp32c3 Introduced CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE configuration option
targets/ESP32/_IDF/sdkconfig.default.esp32c6, targets/ESP32/_IDF/sdkconfig.default.esp32h2, targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32, targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32, targets/ESP32/_IDF/sdkconfig.default_rev3_ipv6.esp32 Replaced CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y with CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y
targets/ESP32/_IDF/sdkconfig.default.esp32s2 Enabled CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE configuration option
targets/ESP32/_IDF/sdkconfig.default.esp32s3, targets/ESP32/_IDF/sdkconfig.default_ble.esp32s3 Adjusted flash size configurations and partition table filenames, added CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE
targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32, targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32, targets/ESP32/_IDF/sdkconfig.default_pico, targets/ESP32/_IDF/sdkconfig.default_rev3.esp32 Introduced CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE configuration option

Assessment against linked issues

Objective Addressed Explanation
Ensure correct flash size detection for ESP32_S3 (Issue #1492)
Update partition table filenames and configurations for ESP32_S3 to reflect 4MB flash size

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@AdrianSoundy AdrianSoundy added Platform: ESP32 Everything related specifically with ESP32 platform Status: in progress labels Jun 6, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 47e7bb3 and 9acc5d4.

Files selected for processing (17)
  • targets/ESP32/_IDF/sdkconfig.default (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default.esp32c3 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default.esp32c6 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default.esp32h2 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default.esp32s2 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default.esp32s3 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_ble.esp32s3 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_pico (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_pico_ble_rev3 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32c3 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_rev3_ipv6.esp32 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_rev3_noconsole.esp32c3 (1 hunks)
Files skipped from review due to trivial changes (6)
  • targets/ESP32/_IDF/sdkconfig.default.esp32c6
  • targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_rev3_noconsole.esp32c3
Additional comments not posted (12)
targets/ESP32/_IDF/sdkconfig.default.esp32c3 (1)

7-7: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y aligns with the PR's objectives to handle flash size discrepancies. Ensure this setting integrates well with other configurations.

Verification successful

The previous script failed due to an incorrect file type specification. Let's correct the file type and re-run the search to verify the integration of the configuration setting.


The search results indicate that the configuration setting CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y is consistently used across multiple configuration files for various ESP32 targets. This suggests that the setting is intended to be a standard configuration across different ESP32 variants, and there are no apparent conflicts.

  • targets/ESP32/_IDF/sdkconfig.default.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default_rev3_ipv6.esp32
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_pico_ble_rev3
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32
  • targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32
  • targets/ESP32/_IDF/sdkconfig.default_pico
  • targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_ble.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default_rev3_noconsole.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default.esp32h2
  • targets/ESP32/_IDF/sdkconfig.default.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default.esp32s2
  • targets/ESP32/_IDF/sdkconfig.default
  • targets/ESP32/_IDF/sdkconfig.default_octal_ble.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default.esp32c6

This confirms that the addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y in sdkconfig.default.esp32c3 is consistent with other configurations and does not introduce any conflicts.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicting settings.
rg --type python $'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 110



Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicting settings.
rg 'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 1740

targets/ESP32/_IDF/sdkconfig.default_rev3_ipv6.esp32 (1)

5-5: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y aligns with the PR's objectives to handle flash size discrepancies. Ensure this setting integrates well with other configurations.

Verification successful

The previous script failed due to an incorrect file type specification. Let's correct this and search for the configuration setting in the relevant files.


The search results indicate that the configuration setting CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y is consistently used across multiple configuration files within the targets/ESP32/_IDF/ directory. This suggests that the setting is intended to be a standard part of the configuration for various ESP32 targets.

  • targets/ESP32/_IDF/sdkconfig.default_rev3_noconsole.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_rev3_ipv6.esp32
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_pico_ble_rev3
  • targets/ESP32/_IDF/sdkconfig.default_pico
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_ble.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default.esp32h2
  • targets/ESP32/_IDF/sdkconfig.default.esp32c6
  • targets/ESP32/_IDF/sdkconfig.default.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default
  • targets/ESP32/_IDF/sdkconfig.default_octal_ble.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default.esp32s2
  • targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32

Given this consistency, it appears that the addition of this configuration setting in sdkconfig.default_rev3_ipv6.esp32 is appropriate and aligns with the overall configuration strategy for the ESP32 targets.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicting settings.
rg --type python $'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 110



Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicting settings.
rg 'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 1740

targets/ESP32/_IDF/sdkconfig.default.esp32s3 (1)

16-17: The changes to flash size settings and partition table filename are consistent with the PR's objectives to correct flash size discrepancies. Ensure these settings integrate well with other configurations.

Also applies to: 20-20

Verification successful

The search results indicate that the configurations for CONFIG_ESPTOOLPY_FLASHSIZE_4MB and CONFIG_PARTITION_TABLE_CUSTOM_FILENAME are consistently used across multiple configuration files within the targets/ESP32/_IDF/ directory. There are no conflicting settings found.

  • CONFIG_ESPTOOLPY_FLASHSIZE_4MB is set to y in all relevant configuration files.
  • CONFIG_PARTITION_TABLE_CUSTOM_FILENAME is consistently set to "targets/ESP32/_IDF/${TARGET_SERIES_SHORT}/partitions_nanoclr_4mb.csv" or similar paths.

These findings confirm that the changes made in sdkconfig.default.esp32s3 are consistent with other configurations and do not introduce any conflicts.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of flash size settings and partition table filename with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicting settings.
rg --type python $'CONFIG_ESPTOOLPY_FLASHSIZE_4MB|CONFIG_PARTITION_TABLE_CUSTOM_FILENAME' targets/ESP32/_IDF/

Length of output: 141



Script:

#!/bin/bash
# Description: Verify integration of flash size settings and partition table filename with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicting settings.
rg 'CONFIG_ESPTOOLPY_FLASHSIZE_4MB|CONFIG_PARTITION_TABLE_CUSTOM_FILENAME' targets/ESP32/_IDF/

Length of output: 4428

targets/ESP32/_IDF/sdkconfig.default.esp32h2 (1)

38-38: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y aligns with the PR's objectives to handle flash size discrepancies. Ensure this setting integrates well with other configurations.

Verification successful

The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y is consistent with other configurations in the repository, indicating no conflicts.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicting settings.
rg --type python $'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 110



Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicting settings.
rg 'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 1740

targets/ESP32/_IDF/sdkconfig.default (1)

10-10: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE aligns with the PR objectives to handle flash size discrepancies. Ensure this setting integrates well with other configurations.

Verification successful

The configuration option CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is consistently present across multiple configuration files within the targets/ESP32/_IDF/ directory. This indicates that the addition is well-integrated and does not conflict with other configurations.

  • targets/ESP32/_IDF/sdkconfig.default_rev3_noconsole.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_pico_ble_rev3
  • targets/ESP32/_IDF/sdkconfig.default_pico
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_rev3_ipv6.esp32
  • targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32
  • targets/ESP32/_IDF/sdkconfig.default.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default_ble.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32
  • targets/ESP32/_IDF/sdkconfig.default.esp32h2
  • targets/ESP32/_IDF/sdkconfig.default.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default.esp32c6
  • targets/ESP32/_IDF/sdkconfig.default
  • targets/ESP32/_IDF/sdkconfig.default.esp32s2
  • targets/ESP32/_IDF/sdkconfig.default_octal_ble.esp32s3
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicts.
rg --type python $'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 110



Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicts.
rg --type conf 'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 106



Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicts.
rg 'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 1740

targets/ESP32/_IDF/sdkconfig.default_ble.esp32s3 (1)

16-20: Updated flash size and partition table filename to ensure consistency with actual hardware specifications. Verify the correctness of the partition table file.

Verification successful

The partition table file targets/ESP32/_IDF/esp32s3/partitions_nanoclr_4mb.csv exists and is correctly formatted. The partition definitions are consistent with the 4MB flash size setting.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correctness of the updated partition table filename.

# Test: Check if the partition table file exists and is correctly formatted. Expect: Valid file.
cat targets/ESP32/_IDF/esp32s3/partitions_nanoclr_4mb.csv

Length of output: 1064

targets/ESP32/_IDF/sdkconfig.default_pico (1)

9-9: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is consistent with the PR's objectives to handle flash size discrepancies. Ensure this setting integrates well with other configurations.

Verification successful

The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is consistent across multiple configuration files for various ESP32 variants. This indicates a deliberate and uniform update to handle flash size discrepancies.

  • targets/ESP32/_IDF/sdkconfig.default_rev3_noconsole.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_rev3_ipv6.esp32
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_pico_ble_rev3
  • targets/ESP32/_IDF/sdkconfig.default_pico
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32
  • targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32
  • targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_ble.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default.esp32s2
  • targets/ESP32/_IDF/sdkconfig.default.esp32h2
  • targets/ESP32/_IDF/sdkconfig.default.esp32c6
  • targets/ESP32/_IDF/sdkconfig.default.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default
  • targets/ESP32/_IDF/sdkconfig.default_octal_ble.esp32s3

This confirms that the configuration change is well-integrated and consistent across the board.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicts.
rg --type python $'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 110



Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicts.
rg 'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 1740

targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32 (1)

5-5: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is consistent with the PR's objectives to handle flash size discrepancies. Ensure this setting integrates well with other configurations.

Verification successful

The previous script failed due to an incorrect file type specification. Let's correct this and re-run the search for potential conflicts.


The search results indicate that the CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE setting is consistently used across multiple configuration files for various ESP32 variants. This suggests that the addition of this configuration in sdkconfig.default_nopsram_ble.esp32 is aligned with the existing configurations and should not cause conflicts.

  • targets/ESP32/_IDF/sdkconfig.default_rev3_noconsole.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_pico_ble_rev3
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_pico
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32
  • targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32
  • targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32
  • targets/ESP32/_IDF/sdkconfig.default_ble.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default_rev3_ipv6.esp32
  • targets/ESP32/_IDF/sdkconfig.default.esp32h2
  • targets/ESP32/_IDF/sdkconfig.default.esp32c3
  • targets/ESP32/_IDF/sdkconfig.default.esp32s2
  • targets/ESP32/_IDF/sdkconfig.default
  • targets/ESP32/_IDF/sdkconfig.default.esp32c6
  • targets/ESP32/_IDF/sdkconfig.default_octal_ble.esp32s3
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32

This confirms that the configuration change is consistent with the rest of the codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicts.
rg --type python $'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 110



Script:

#!/bin/bash
# Description: Verify integration of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE with other configurations.

# Test: Search for potential conflicts in configuration. Expect: No conflicts.
rg 'CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE' targets/ESP32/_IDF/

Length of output: 1740

targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32 (2)

19-19: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y aligns with the PR's objectives to manage flash size discrepancies effectively.


20-20: Updating the partition table filename to partitions_nanoclr_4mb.csv correctly reflects the new flash size setting, ensuring the system uses the appropriate partition layout.

targets/ESP32/_IDF/sdkconfig.default_pico_ble_rev3 (1)

9-9: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y is crucial for ensuring the bootloader header correctly reflects the flash size, addressing the issues outlined in the PR.

targets/ESP32/_IDF/sdkconfig.default.esp32s2 (1)

386-386: The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y is crucial for ensuring the bootloader correctly updates the flash size, addressing the boot issues reported.

Verification successful

The addition of CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y does not conflict with other flash-related settings in the configuration file targets/ESP32/_IDF/sdkconfig.default.esp32s2.

  • targets/ESP32/_IDF/sdkconfig.default.esp32s2 contains multiple flash size settings, but they do not conflict with the new setting.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the new setting does not adversely affect other configurations.

# Test: Search for any potential conflicts with other flash-related settings.
rg --type python $'CONFIG_ESPTOOLPY_FLASHSIZE'

Length of output: 76



Script:

#!/bin/bash
# Description: Verify that the new setting does not adversely affect other configurations.

# Test: Search for any potential conflicts with other flash-related settings.
rg 'CONFIG_ESPTOOLPY_FLASHSIZE'

Length of output: 2319

Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

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

LGTM!
Yes, this is inline with what I've investigated when updating nanoff.
We should look into this with a long-term perspective.
A lot of changes were brought in by IDF 5 which are making our use of it somewhat complicated and requiring a lot of adjustments and ended up on a bunch of new firmware images to cover all possible variantions and combinations...

@AdrianSoundy AdrianSoundy merged commit 07ea173 into nanoframework:main Jun 6, 2024
17 checks passed
@AdrianSoundy AdrianSoundy deleted the FlashSize_Update branch June 6, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: ESP32 Everything related specifically with ESP32 platform Status: DONE Type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESP_S3 could not boot on ESP32_S3_ZERO
3 participants